Ubuntu: Install LAMP: Linux Apache2 MySQL PHP5

August 27, 2009 by: Allen Sanford

linux-apache-mysql-phpFirst off, this one will be quick and painless, and only applies to those who are installing Apache2, MySQL, and PHP5 after the fact. The major step that stumps most people is getting PHP5 to work, more on this in a moment. If you are doing any kind of PHP development at all, most will want to have there own sandbox to develop in. Here’s the quickest and easiest way to get a LAMP Installation up and running on your Ubuntu box.

We are going to be working in a terminal on the command line, so be comfortable with how to use it before going on any further (As if this statement even needs to be made, we are working with Linux here). You will want to make sure that you have the extra repositories below added to Ubuntu’s sources.list file, if they don’t exists already, as you can tell we are using Jaunty Jackalope (Ubuntu 9.04) here.

    sudo vim /etc/apt/sources.list
?Download sources.list
    ## main & restricted repositories
    deb http://us.archive.ubuntu.com/ubuntu/ jaunty main restricted
    deb-src http://us.archive.ubuntu.com/ubuntu/ jaunty main restricted
 
    deb http://security.ubuntu.com/ubuntu jaunty-security main restricted
    deb-src http://security.ubuntu.com/ubuntu jaunty-security main restricted
 
    ## universe repositories
    deb http://us.archive.ubuntu.com/ubuntu/ jaunty universe
    deb-src http://us.archive.ubuntu.com/ubuntu/ jaunty universe
    deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates universe
    deb-src http://us.archive.ubuntu.com/ubuntu/ jaunty-updates universe
 
    deb http://security.ubuntu.com/ubuntu jaunty-security universe
    deb-src http://security.ubuntu.com/ubuntu jaunty-security universe

Real quick here update apt-get!

    sudo apt-get update

Now we install the needed packages for our LAMP installation.

    sudo apt-get install apache2 php5 libapache2-mod-php5 mysql-server

Now the default location for your files will be located in /var/www/. If you were to put a file named index.php in the root folder /var/www/ it should render and display the rendered content, for some us however it will prompt us to download this file, or worse show the actual contents of the file, both cases not good. If you are one the later here, running the next set of commands will fix you right up.

    cd /etc/apache2/mods-available/
    sudo ln -s php5.conf ../mods-enabled
    sudo ln -s php5.load ../mods-enabled
    sudo /etc/init.d/apache2 force-reload

You should now have your LAMP installation running. Now you should read up on configuring each of the components but I will save that for another day.

Enjoy and Have a Good’n!

Filed under: Ubuntu
Tags: , , , ,

Comments

8 Responses to “Ubuntu: Install LAMP: Linux Apache2 MySQL PHP5”
  1. Thank You for outlining this so clearly. I truly enjoyed reading it and it gave me some great ideas.

  2. navatux says:

    Thanks :-) works fine :-)

  3. you can be wrong on this one i’ve found a vid about it see for yourself http://www.youtube.com/watch?v=1NVuUAr4MMs

  4. Dave Fetty says:

    Möchte mir eine neue Couch kaufen, weils meine alte einfach nicht mehr lange macht. Meine 2 Katzen machen immer das Wohnzimmer und natürlich auch die Couch unsicher, das hinterlässt leider deutliche Spuren. Nun möchte ich das meine neue Couch nicht nach 1 Monat aussieht, als wär sie schon 1 Jahr alt und bin auf der suche nach einer Couch mit einem strapazierfähigen Stoffbezug. Hat jemand von Euch Erfahrung mit Haustieren und kann mir einen bestimmten Stoff empfehlen?

Leave a Reply