How to Install LAMP on Ubuntu

The following tutorial presumes you understand what a LAMP Server is, how to work a website from the back end and how to install software using either the Software Centre or the Terminal. It also expect experience running other Basic Terminal Commands.

There is also an excellent article on Digital Ocean that may be of more relevance if you are working on a remote or public facing server.

Install Apache

To install Apache you must install the Metapackageapache2. This can be done by searching for and installing in the Software Centre, or by running the following command.

Install MySQL

To install MySQL you must install the Metapackagemysql-server. This can be done by searching for and installing in the Software Centre, or by running the following command.

Install PHP

To install PHP you must install the Metapackagesphp5 and libapache2-mod-php5. This can be done by searching for and installing in the Software Centre, or by running the following command.

Check Apache

Open a web browser and navigate to http://localhost/. You should see a message saying It works!

Restart Server

Your server should restart Apache automatically after the installation of both MySQL and PHP. If it doesn’t, execute this command.

Check PHP

You can check your PHP by executing any PHP file from within /var/www/. Alternatively you can execute the following command, which will make PHP run the code without the need for creating a file .

Congratulations, you have just Installed a Ubuntu LAMP Server!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>