How to quickly install the LAMP Stack on an Ubuntu Server Tips, Tricks and Tutorials 24 AUG 2013

ubuntu-10-logoIf you are running an Ubuntu server then chances are pretty good that you are using it as a web server. That in turn means you probably want to run it as a LAMP stack, i.e. Linux, Apache, MySQL, and PHP, or at least that’s what I need 90% of the time.

Of course the fact that you are running Ubuntu means that the Linux part of the stack is already taken care of meaning that the next thing to sort out is the installation of the Apache webserver, MySQL database server, and of course the web scripting workhorse that is PHP.

Now while you can install these things one by one, but if defaults are fine for you and time is of the essence, then thanks to the nifty tasksel Ubuntu command installing all three at once is a snap.

Basically tasksel groups software packages by tasks and offers an easy way to install all packages needed for that particular task. In other words, basically it does the same as a conventional meta-package.

If it isn’t installed by default, run:

sudo apt-get install tasksel

Once installed, you can run the application like so:

sudo tasksel

From there it is a matter of scrolling through the menu to locate the LAMP server option, press space to select it (an asterisk will appear next to the menu option) and then a final click on OK to begin the installation process (you can tab to the OK button if you don’t have a mouse available). Answer the MySQL root password prompt accordingly and once done, you should have a nice and shiny new installation of Apache, MySQL and PHP at your fingertips, verified by the standard “It Works!” message returned when hitting http://localhost

Note: I’m quite fond of following this up by installing the web-based database management tool PHPMyAdmin, which can be done via a call to:

sudo apt-get install phpmyadmin

Again, you’ll be asked for the root MySQL password to complete this installation, so it is probably worth having jotted this down somewhere! :)

Related Posts:

About Craig Lotter

South African software architect and developer at Touchwork. Husband to a cupcake baker and father to two little girls. I don't have time for myself any more.