The following instruction assumes that you know what a LAMP Server is and what it is for.
1. Install Apache
To install Apache you must install the Metapackage apache2. This can be done by searching for and installing in the Software Centre, or by running the following command.
sudo apt install apache2
2. Install MySQL
To install MySQL you must install the Metapackage mysql-server. This can be done by searching for and installing in the Software Centre, or by running the following command.
sudo apt install mysql-server
3. Install PHP
PHP requires a few packages to work as you expect, so we recommend the following command.
sudo apt install php-pear php-fpm php-dev php-zip php-curl php-xmlrpc php-gd php-mysql php-mbstring php-xml libapache2-mod-php
4. Restart Server
Your server should restart Apache automatically after the installation of both MySQL and PHP. If it doesn’t, execute this command.
sudo service apache2 restart
5. Verify Apache
You can type the following in terminal to check your web server.
Or open a web browser and navigate to http://localhost/. You should see a message saying It works! or type
6. Verify PHP
You can check your PHP by executing any PHP file from within /var/www/html. Alternatively you can execute the following command, which will make PHP run the code without the need for creating a file.
php -r 'phpinfo();'
You should now have your Ubuntu LAMP Server.