So lets say you have a fresh install of Ubuntu 10.04 Lucid Lynx and you want know how to install a LAMP server (Linux, Apache, Mysql, PHP, (and phpmyadmin)) to develop a website locally… Well it can be a PITA if you don’t know what you are doing, much more if you are unfamiliar with Linux.
Well I have outlined here an easy step by step process, with pictures of exactly what you need to do to get a perfectly working LAMP server without any issues or problems. Remember, this will work flawlessly with a clean install of Ubuntu 10.04, if you have installed other things first it should work fine however something else may cause a conflict (but shouldn’t!).
Ok so lets get started:
So first thing you need to do it fire up the terminal. Go to Applications > Accessories > Terminal and it will start up. All you need to do now is follow the next few steps and your LAMP server will be installed perfectly. Remember, these commands listed include “sudo” at the beginning because that is the way to telling the computer you are an administrator and are allowed to perform these actions. If you leave out “sudo” it may not work.
First thing we type into the terminal is as follows:
sudo apt-get update
This updates your Ubuntu 10.04 Lucid Lynx with current package information so when we type the next commands, it gets the most recent data.
Next thing we type into the terminal is:
sudo apt-get install php5 mysql-server apache2
This literally tells the computer to install the software for PHP5, MYSQL server, and Apache2 all at the same time. You will be asked to enter “Y” to confirm that you do want to download and install the software. You will be asked to enter a password for the mysql root user.
The next step involves typing the following:
sudo apt-get install php5-mysql
In older versions of Linux, or with older versions of PHP, you used to have to go into php.ini and add the mysql extension to make php work with mysql… NOT ANY MORE! Now you have to install this module through the terminal and this automatically enables your PHP5 installation to work with mysql. Without this step, phpmyadmin would not work. You do not need to edit the php.ini file!
Now we have to type the following into the terminal:
sudo chmod 777 /var/www
Warning: This is not the most secure way to hold your files and on a production LAMP server, more care needs to be taken for security, that said, this is PERFECTLY FINE for an at home development server.
The files that are served to the internet (or your browser) are contained in the “www” folder, found in location /var/www. Files in this folder are the ones that are served to the internet (or your browser when you go to http://localhost/). When the LAMP server is initially installed this “www” folder is locked to everyone except the administrator. The command entered above unlocks this folder to be editable and viewable by everyone... Meaning you can easily open it to add / change files once you perform this chmod command.
The next step in the process is to download and install phpmyadmin. PHPmyadmin has a very easy to use interface for creating and modifying mysql databases. It’s a tool I would never go without.
You can Download PHPMYADMIN here. Choose the one that ends in “.zip” for simplicity sake.
Once downloaded you need to extract and re-name the folder
Clicking “Extract Here” will extract the “.zip” file’s contents into a folder. Rename the resulting folder “phpmyadmin”.
Now that you’ve extracted and renamed the folder, its time to move it to /var/www so what we can use phpmyadmin through our web browser.
Once it is here you can view it with your web browser
Test that everything works.
Go to http://localhost/ to verify that your site is indeed working
The go to:
http://localhost/phpmyadmin/ and you can use the username “root” and the password you selected in step 3 to login and start creating databases.
And there you have it, a fully functioning lamp server setup in minutes with no hassle!!! Aren’t you happy??!?