A LAMP server is the basis for many web servers. It’s got nothing to do with the lighting around the server, LAMP stands for Linux, Apache, MySQL and PHP. If you’re reading this, I assume that you’ve already managed to install a Linux distribution on your server and that the distribution you have installed is Ubuntu 9.10. This guide will most likely be able to help you through the process of setting up a LAMP server on other versions of Ubuntu as well as Debian, but certain package names and configurations might differ.
With Ubuntu 9.10 it became even easier to set up LAMP, and it might be possible that you did it already when installing Ubuntu. This guide assumes that you have a clean installation of Ubuntu, without Apache, MySQL and PHP, but if you already have one or more of them installed, you can still go through all the steps because you won’t break anything doing so. Now, let’s get started (I assume that you are now logged in to the server you are planning to set up).
First, let’s make sure that our local package repository lists are up to date. You might get prompted for you sudo password the first time you run the sudo command. This is normally the password you used to log in to your account on the server.
$ sudo apt-get update
The next step is to install the A and the P in LAMP, Apache2 and PHP5. We only tell apt to install the PHP5 module for Apache2, but due to dependency control, apt will automatically install and configure both Apache2 and PHP5 for us as well.
$ sudo apt-get install libapache2-mod-php5
Then we install the M in LAMP, MySQL5.
$ sudo apt-get install mysql-server mysql-client php5-mysql
During the installation, you will be prompted to enter a password for the root user. It’s not recommended to leave it blank, so enter password you will remember. MySQL support for PHP5 will also be installed.
The MySQL administration web interface phpmyadmin is not part of the classic LAMP setup, but it’s extremely convenient, so we’ll install that as well.
$ sudo apt-get install phpmyadmin
If prompted for automatic configuration of a web server during the installation, select Apache2 from the lists. You also want to configure phpmyadmin with dbconfig-common, so select “Yes” when prompted. On the first screen in the dbconfig-common installation wizard, enter the root password you chose when installing MySQL5. Then you have to set a password for the phpmyadmin user, as with the MySQL5 root password, you should not leave this blank.
And that’s it for the LAMP installation. You should now have a server with a web server, Apache2, a database server, MySQL5, and a great scripting language, PHP5. This means that you can for instance use the server for your own WordPress installation. This guide, however, does not cover setting up WordPress. Please refer to the WordPress site for detailed instructions on how to download, install and configure WordPress.