Install Apache, PHP and MySQL on Ubuntu 16.04 in one command

Ubuntu is one of the most user friendly distributions of Linux operating system. If you want to do PHP and MySQL development on an Ubuntu based machine or want to host an application developed in these technologies on a virtual server that runs Ubuntu, then you will first need to install the LAMP stack on that system.

Fortunately, it is very easy and simple to do so. First of all, update your repositories:

Now, install  tasksel . It is a helper program that provides easy installations for a number of related software packages, one of which is LAMP stack.

It might be already installed on your Ubuntu distro, as was the case on my DigitalOcean droplet. Now, run tasksel.

Scroll down to LAMP server and press spacebar to select it. An asterisk will appear besides it.

LAMP server - tasksel - ubuntu
Install apache, php and mysql on ubuntu in one command.

Hit Enter and the installation will begin. It will prompt you to set a password for MySQL database server. Enter a strong password of your choice twice and the installation will continue. Once the installation is complete, open  http://localhost or  http://ip.addresss.of.your.server in your browser and you should see a default page telling you that Apache is successfully installed on this system and ready to use. This page contains a lot of useful information such as paths of important configuration files, commands to perform some basic administrative tasks on Apache server, and links to further documentation. I am sure you will be able to take it from there and run whatever website or web application you wanted to run on that machine.

Leave a Reply