Installing Apache, PHP and MySQL on Ubuntu

2007 December 31
by George

 

This tutorial is designed to help you install the LAMP (Linux,Apache,MySQL,PHP) combo on your Ubuntu machine.

What You Need

Ubuntu (Obviously)
Root Access Password
About 7gigs HDD space (ish)

Step 1
You firstly need to install Apache 2 onto your machine. Fire up the terminal, and enter:
sudo apt-get install apache2
It should then install automatically.
To start Apache, use the following command:
sudo /etc/init.d/apache2 start
And to stop it;
sudo /etc/init.d/apache2 stop

You should then be able to goto http://localhost , and see some default text, something like “It works!”

Step 2
Next up is PHP, enter the following code in terminal:
sudo apt-get install php5 libapache2-mod-php5
Then restart Apache;
sudo /etc/init.d/apache2 restart ;
and PHP is done. You can change PHP5 to any version you like , but PHP5 is recommended.

Step 3
Next, we install MySQL. It’s also very simple, run the following in terminal:
sudo apt-get install mysql-server
And then you need to set the root password for MySQL (important)
mysql> SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(’password!’);
And that’s MySQL In. Restart Apache again;
sudo /etc/init.d/apache2 restart ;
And it should all work nicely!

An excellent tool for PHP is PhpMyAdmin, which can be installed with the following:
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

And that’s it! All done. If you have any problems with PhpMyAdmin, try rebooting apache.

Have fun with LAMP!

–George

No Comments

Leave A Comment

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS