How to Install LAMP Stack on Ubuntu 18.04
The term LAMP is an acronym of the names of its four open-source components:
- L - Linux operating system
- A - Apache, a HTTP and reverse proxy server
- M - MySQL or MariaDB relational database management system
- P - PHP programming language.
This series of tutorials will guide you through the steps necessary to install Apache, create Apache virtual hosts, generate a free Let's Encrypt SSL certificate, install and secure MySQL and install PHP 7.2.
The detailed tutorials that are part of this series are listed at the end of this page.
If you are in a hurry and don't want to read more detailed documentation you can install LAMP Stack on your Ubuntu 18.04 server by following our Quickstart section.
Install LAMP Stack on Ubuntu 18.04 [Quickstart]
This quickstart will show you the basic steps required to get a LAMP stack installed on an Ubuntu 18.04 server.
The user you are logged in as must have sudo privileges to be able to install packages.
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
Step 2. Installing MySQL
The next step is to install the MySQL packages. To do so type:
sudo apt install mysql-server
Once the installation is completed, issue the
mysql_secure_installation command to improve the security of the MySQL installation:
You will be asked to set the root password, remove the anonymous user, restrict root user access to the local machine and remove the test database. You should answer “Y” (yes) to all questions.
Step 3. 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
For more detailed instructions about each step, please consult the following tutorials.
Jun 24, 2018
How to Install Apache on Ubuntu 18.04
Jul 24, 2018
How To Set Up Apache Virtual Hosts on Ubuntu 18.04
Jul 31, 2018
Secure Apache with Let's Encrypt on Ubuntu 18.04
Jun 20, 2018
How to Install MySQL on Ubuntu 18.04
Jul 1, 2018