How to install Apache, MySQL and PHP in Ubuntu

By | April 9, 2012

Need to know how to install Apache, MySQL and PHP on linux for an in-house development requirement? This support page is ideal for those using Ubuntu or Xubuntu, as the guide was written with those development systems in mind. However we are not providing security advice below, so please bare that in mind.

Note: This is only a guide for an in-house server setup, not a live server for supporting a website accessible outside of a local network. These instructions are ideal for novices to learn LAMP server setup, else web developers and designers. To perform the web server installations below, you need to have administrator access on the linux system.

Also please note this support page doesn’t cover security issue, which you should review and make changes to strengthen your server, even if used in-house only.

Step 1 – How to install Apache, PHP and MySQL.

We are not going to use the command line at this stage?! Shock horror! Instead opting to use the ‘Ubuntu Software Centre’, which should be accessible from your application menus. The first application to install is ‘Apache2’, do not search for ‘Apache’, as it won’t be displayed without the numeral 2 attached to the name.

Ubuntu Software Centre

Ubuntu Software Centre


Next we want to install php so in this instance using the ‘Ubuntu Software Centre’, you search for ‘php5’ and install the package. A dialogue box could pop up wishing to uninstall apache2-mpm-worker, which you can select ‘Install Anyway’.

Now third step is to install the MySQL server, so this time you need to search for ‘mysql-server’, and then install the package. During the installation of the MySQL it will prompt you for a new password for the root user, please give this password serious consideration.

mysql server configuration

mysql server configuration


The next package to search for and install is ‘php5-mysql’, which only short take a minute or two to install.

Step 2 – Verify the Apache server is running.

On the server in a web browser type in http://localhost/ else on another computer http:// followed by the ip address of the server, to test whether Apache is successfully running.

Note: Your files are located in /var/www/

So what is next?

You probably will want to install a FTP server such as VSFTPD, setup MySQL management, perhaps using phpMyAdmin, learn how to start, stop and restart services, plus many more related tasks. Don’t forget to strengthen your security, as we didn’t provide security advice. We hope this post helped you on your way.