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:

Step 1:

step 1 clean install of ubuntu open terminal

step 1 clean install of ubuntu open terminal (click to enlarge)

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.

Step 2:

First thing we type into the terminal is as follows:

sudo apt-get update

sudo apt-get update

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.

Step 3:

Next thing we type into the terminal is:

sudo apt-get install php5 mysql-server apache2

install php5 mysql-server apache2

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.

password for mysql root user

password for mysql root user

Step 4:

The next step involves typing the following:

sudo apt-get install php5-mysql

apt-get install php5-mysql

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!

Step 5:

Now we have to type the following into the terminal:

sudo chmod 777 /var/www

sudo chmod 777 /var/www

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.

Step 6:

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.

Step 7:

Once downloaded you need to extract and re-name the folder

phpmyadmin extract here

phpmyadmin extract here

Clicking “Extract Here” will extract the “.zip” file’s contents into a folder. Rename the resulting folder “phpmyadmin”.

Step 8:

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.

var-www-phpmyadmin

Move phpmyadmin to /var/www

Once it is here you can view it with your web browser

Step 9:

Test that everything works.

localhost-it-works

localhost-it-works

Go to http://localhost/  to verify that your site is indeed working

The go to:

localhost-phpmyadmin-login

localhost-phpmyadmin-login

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??!?

Share

22 Responses to The EASIEST way to install a LAMP server in UBUNTU 10.04 Lucid Lynx

  • Thomas Rendleman says:

    I liked the solution but then at the last command I entered
    http://localhost/phpmyadmin/
    and it gave an error. Thinking I did not really follow instructions I did a completely new installation.
    Redid everything and same error.

    phpMyAdmin – Error

    Cannot load mysql extension. Please check your PHP configuration. – Documentation

    It looked like iut was going to work right out of the box. Can you help. My email is down and website as I am trying to redo a server at the same time. I am somewhat new to the terminal/linux.

    Thank you,

    Thomas Rendleman

  • Thomas Rendleman says:

    I figured it out. If anyone has the same problem. Please don’t kill yourself.
    Here is what to do.

    Top left of the screen.
    Applications > Ubuntu Software Center >
    Search for a package called PHP-MySQL
    It will show MySQL module for php5
    This will show a checkmark on the far left side – this means you have installed it.
    Now remove button
    Password again
    and now reinstall it.

    The reinstall made everything work.
    I have a few hairs left. LOL

  • Chris says:

    Amazing guide. Simple, clear and very informative. 10/10

  • Abera says:

    This all came up good until I tried to go to phpmyadmin.Cannot load mysql extension. Please check your php configuration. mysql.so, or php_mysql.dll. Cant see any of the php files.
    Thanks

  • Abera says:

    Whoops.. Sorry I didn’t read the first post.

  • Abera says:

    But I don’t see that it was installed in the Installed software. The Terminal said it was and tried to do it again, but said it was the newest version and no new install. Can I uninstall it from the Terminal?
    Thanks

  • Jits says:

    How about just…

    $ sudo aptitude install tasksel (should usually be installed anyways)
    $ sudo tasksel install lamp-server
    $ sudo aptitude install phpmyadmin

    …. voila! :-)

    • admin says:

      That doesn’t cover the CHMOD to make it easy to manipulate the WWW directory, nor does it have an option to tick the “php5-mysql” package which is necessary for phpmyadmin to function in 10.04.

  • Shiva says:

    I followed the instructions and everything worked smoooooooooooothly
    Thanks

  • Dan says:

    what privileges do you recommend for a production server? 755? Also, what to use for FTP?

  • Michael says:

    Maybe this would help I had the same problem but I found that I use caps example phpMyAdmin when it should be phpmyadmin. after I change this I was able to access the php

  • Hussain says:

    Awesome tutorial! Just need some help. when i open this link : http://localhost/phpmyadmin/
    i get the following error after that page is opened.

    Cannot load mcrypt extension. Please check your PHP configuration.
    Cannot load mysql extension. Please check your PHP configuration. – Documentation

    Does that mean that my installation hasn’t gone perfectly? Please help!!

    Regards
    Hussain

  • SABUNI says:

    This tutorials is amazing.This is fantastic because its now working;
    for a person with the problem mentioned by “Thomas Rendleman” probably should also try restart the apache server before doing any thing else i use the command “sudo /etc/init.d/apache2 restart
    ” but i have another problem that i can’t access my working folder from phpmyadmin interface.

  • MrGrump says:

    Hey Top tutorial

    Just remeber chmod 777 is extremely unsecured and should NEVER be used for a production website. This would alow anyone on the internet ability to access, change, delete, add and run programs on your server!!

    google permisions for webservers for more info.

    Cheers and have fun :razz:

  • MrWadada says:

    You are great man! Thank you very much for this!
    Very helpful, and all works fine!
    This is the second try installing lamp, the first time it take me many hours to configure hows&to and got lamp work.
    Thanks to you, it takes too litlle time now!!

  • Rajkumar says:

    Wow! thanks for your tutorials

  • caesar says:

    hey thanks all of u

  • Caio Formiga says:

    Nice job man, thank you very much.

    I just tried this tutorial and till step 8 from 9 was all fine, however when i tried to access http://localhost/phphmyadmin I got this error:

    “phpMyAdmin – Error: The mysqli extension is missing. Please check your PHP configuration.

    After googled for 20min I got the issue dome through this tips http://php.net/manual/en/mysqli.installation.php.

    Anyway if you access http://localhost/phphmyadmin and click on the mysqli link you will be redirect to http://localhost/phphmyadmin/index.php which work as a glove.

    Thanks again.

  • zoran says:

    Had same trouble with step 8 but followed the third post by Thomas Rendleman and it worked after that.
    However the following two errors still apear although login is possible and hopefully no changes need to be made for website development. (fingers crossed :)
    “The mcrypt extension is missing. Please check your PHP configuration.”
    “The mysqli extension is missing. Please check your PHP configuration.”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>