A LAMP Stack (Linux, Apache, MySQL, PHP) is a common web stack used for hosting web content. In this tutorial, we’ll provide a step by step instructions about how to set up LAMP Stack on Ubuntu 18.04 LTS.
You’ll need to be logged in as a user with sudo privileges in order to install the LAMP Stack.
Step 1. Installing Apache
Apache is available in Ubuntu repositories. Update the packages index and install Apache with the following commands:
$ sudo apt update $ sudo apt install apache2
– Start and enable Apache at system startup using the following commands
$ sudo systemctl enable apache2 $ sudo systemctl start apache2
Step 2. Installing PHP
Ubuntu 18.04 LTS ships with the latest and greatest PHP version 7.2. To install PHP and several other most common PHP modules type:
$ sudo apt install php libapache2-mod-php php-opcache php-cli php-gd php-curl php-mysql
– Once the PHP packages are installed restart the Apache service with:
$ sudo systemctl restart apache2
Step 3. Installing Mariadb
– To install the latest version of MariaDB just follow our previous guide How to install MariaDB 10 Server on Ubuntu 18.04 LTS Bionic Beaver
Step 4.Test LAMP Stack
– Create a simple PHP Info page to test your LAMP Stack installation like below
$ sudo bash -c "echo -e '<?php\nphpinfo();\n?>' > /var/www/html/phpinfo.php"
– Now, open your web browser to your new LAMP install using the following URL:
You have successfully installed LAMP Stack on your Ubuntu 18.04 LTS or Ubuntu 16.04 LTS server. You might want to check the following guides:
- How To Install PostgreSQL 11 on Ubuntu 18.04 LTS Bionic Beaver
- How To Install Apache Tomcat 9 Server on Ubuntu 18.04 LTS Bionic Beaver
- How to Install Zabbix Server 4 on Ubuntu 18.04 LTS Bionic Beaver
We hope this tutorial was enough Helpful. If you need more information, or have any questions, just comment below and we will be glad to assist you!