How To Install LAMP In Ubuntu 18.04

How To Install LAMP In Ubuntu 18.04
How To Install LAMP In Ubuntu 18.04. In this tutorial, We’ll show you how to install Lamp on Ubuntu 18.04 server. The LAMP is stands for Linux, Apache, Mysql, and PHP.

How To Install LAMP In Ubuntu 18.04. In this tutorial, We’ll show you how to install Lamp on Ubuntu 18.04 server. The LAMP is stands for Linux, Apache, Mysql, and PHP. It is an open source platform and works on the Linux operating system. It uses Apache web server, MySQL relational database management system, and PHP object-oriented scripting language.

Before we install Lamp in ubuntu 18.04. We will know about Lamp.

Lamp
L => Linux operating system
A => Apache web server
M => MySQL relational database management system
P => PHP object-oriented scripting language


Before Install the Lamp on Ubuntu. First update the apt package :

sudo apt-get update

sudo apt-get upgrade 

1. Install The Apache On Ubuntu

Install apache on ubuntu using this below command :

sudo apt-get install apache2

Check Apache Status :

After the Apache installation process, the web server service should be started automatically, You can check the Apache service status :

sudo systemctl status apache2
                                    Output

apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           `-apache2-systemd.conf
   Active: active (running) since Sun 2018-12-31 05:18:45 PDT; 2min 30s ago
 Main PID: 3143 (apache2)
    Tasks: 55 (limit: 2321)
   CGroup: /system.slice/apache2.service
           |-3143 /usr/sbin/apache2 -k start
           |-3144 /usr/sbin/apache2 -k start
           `-3145 /usr/sbin/apache2 -k start

Manage the Apache services using these below commands :

To start Apache

sudo systemctl start apache2

To Stop Apache

sudo systemctl stop apache2 

Restart Apache

sudo systemctl restart apache2

Disable Apache

sudo systemctl disable apache2

2. Install MySQL on Ubuntu

sudo apt install mysql-server

Secure MySQL Server Installation

Default MySQL is insecure , we need to secure the database server.

After installation is complete, the mysql_secure_installation utility runs. 
Run the below command and answer the few questions based on your environment requirements.

sudo mysql_secure_installation

3. Install PHP 7.2 On Ubuntu

sudo apt-get install python-software-properties -y 

sudo add-apt-repository ppa:ondrej/php 

Install PHP with Exetension

sudo apt-get install php7.2

sudo apt-get install php7.2-<extension-name> 

See example below

sudo apt-get install php7.2-fpm  php7.2-curl php7.2-mysql \  php7.2-xml php7.2-zip php7.2-gd

Test PHP Version

Use the below command to check the PHP version installed on your server :

php -v

Finally, we need to restart the Apache Web Server :

sudo systemctl restart apache2

Conclusion

In this article, we have successfully install LAMP on Ubuntu 18.04.

If you have any questions or thoughts to share, use the comment form below to reach us.

Suggest:

PHP Tutorial for Absolute Beginners - Learn PHP from Scratch -

25 Years of PHP

Learn Ubuntu for Beginners

NodeJS vs PHP | Which is best for beginners

PHP Application with Kubernetes on Ubuntu 18.04

How to Install and Configure Laravel with LEMP on Ubuntu 18.04