Skip navigation

Updated:
11 January 2009

How to install LAMP on Ubuntu:
Linux + Apache2 + MySQL + PHP5

Terminal:
The following commands must be entered in the terminal.
Applications -> Accessories -> Terminal

Choose one of the following setups:

Apache2 + PHP4 + MySQL4
sudo apt-get install apache2 php4 mysql-client mysql-server phpmyadmin php4-mysql

Apache2 + PHP5 + MySQL4
sudo apt-get install apache2 php5 mysql-client mysql-server phpmyadmin php5-mysql

Apache2 + PHP5 + MySQL5
sudo apt-get install apache2 php5 mysql-client-5.0 mysql-server-5.0 phpmyadmin php5-mysql

Installation options:
You will be asked to choose a password for MySQL.
Ubuntu will not allow you to enter a blank password.
You will be asked to choose a web server for phpMyAdmin. Choose apache2.

Start Apache/MySQL:
sudo /etc/init.d/apache2 start
sudo /etc/init.d/mysql start

Restart Apache/MySQL (if necessary):
sudo /etc/init.d/apache2 restart
sudo /etc/init.d/mysql restart

Stop Apache/MySQL (if necessary):
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/mysql stop

Apache2 and MySQL will not start if XAMPP is also running. If you have both, you must stop one before starting the other:
cd /opt/lampp
sudo ./lampp stop

Publish:
LAMP uses /var/www as the root web directory, but you can publish pages in your home directory this way.
cd ~
mkdir public_html
sudo ln -s ~/public_html /var/www/$USER

Now any files and folders you place in ~/public_html will be
published to your personal webserver.

Open your new webpages at:
http://localhost/username/

Open phpmyadmin in your browser:
http://localhost/phpmyadmin/

Log into phpmyadmin with your MySQL password:
Name: root
Password: [Enter password chosen during installation.]

You can edit additional phpmyadmin options by setting an admin password:
sudo htpasswd /etc/phpmyadmin/htpasswd.setup admin

You’ll be asked for your current user password. Then you’ll be asked to enter and re-enter an admin password.

After you have an admin password, you can access phpmyadmin setup here:
http://localhost/phpmyadmin/setup/

If you want to install the latest version of LAMP with XAMPP:
https://humanlanguage.wordpress.com/install-xampp-on-ubuntu/

Install LAMP with one command:
http://www.whiteoctober.co.uk/blog/2008/10/14/ubuntu-howto-install-lamp-with-one-command/

Install PHP4 and PHP5:
http://www.ubuntugeek.com/apache2-web-server-installation-with-php4-and-php5-support-in-ubuntu.html

Install MySQL4 and MySQL5:
http://www.howtoforge.com/running-mysql4-and-mysql5-concurrently

sudo htpasswd /etc/phpmyadmin/htpasswd.setup admin
Advertisements

3 Comments

  1. Is there a way to have Apache 2, PHP4, PHP5, MySQL 4, MySQL5 installed all at once and just switching between the lot, or is do I want my bread buttered on both sides?

  2. This post is great… Everytime I need to install LAMP I come back here!


3 Trackbacks/Pingbacks

  1. By Dr-Hamza’s Space on 25 Dec 2007 at 5:32 pm

    […] of Php4 , or mysql5 instade of mysql4 , here is more variation of how to install these package . Install LAMP on Ubuntu […]

  2. […] of Php4 , or mysql5 instade of mysql4 , here is more variation of how to install these package . Install LAMP on Ubuntu .Apache control […]

  3. […] Human Language Weblog Ubuntu Discovery Project LAMPBandwidth Monitor « Install LAMP on Ubuntu […]

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: