Page 1 of 1

Installing the LAMP Server on Ubuntu For this install we will be using Ubuntu 8.04 LTS Rate Topic: -----

#1 Nykc  Icon User is offline

  • Gentleman of Leisure
  • member icon

Reputation: 731
  • View blog
  • Posts: 8,644
  • Joined: 14-September 07

Posted 15 November 2009 - 06:56 PM

In this tutorial we are going to install the LAMP server on Ubuntu. I will be installing this on a fairly recent install of Ubuntu 8.04 LTS


The first thing we want to do is install apache2.

Open your terminal and type:

sudo apt-get install apache2



You will probably be prompted for a password to install as root, enter it and then press "y" to proceed with the install. After everything installs, the following commands will give you the ability to start and stop apache2.

 sudo /etc/init.d/apache2 start



 sudo /etc/init.d/apache2 stop



Once installed point your browser to http://localhost - there you should see a message claiming it worked.

Attached Image

The directory you will be working out of is /var/www/

Attached Image

That's it time to install PHP.

Open your terminal and type:

sudo apt-get install php5 libapache2-mod-php5



Once the process completes, restart apache by typing into the terminal:
sudo /etc/init.d/apache2 restart



To test our install of php open up gedit or your favorite text editor and create a file called test.php
<?php
	phpinfo();
?>



make sure you save it in the /var/www/ directory, open your browser and type http://localhost/test.php to ensure the phpinfo file we created appears and our install was successful.

Attached Image

*** When doing this step, my permissions weren't enabled to write/delete files because I wasn't logged in as root. So lets do a change ownership of the directory. There are lots of ways to do this step, but for now just type into your terminal.
sudo chown nykc /var/www/



be sure to change the [username] with your username...

Ok we are now 2/3 of the way there, all that is left is MySQL.

To install MySQL:

Open up the terminal and type:
sudo apt-get install mysql-server



you will be advised to create a root password for MySQL - go ahead and create that and continue with the install.

MySQL should now be installed.

Open up the terminal and type the following:
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin



this will install a program called phpMyAdmin which is a nice graphical tool used to edit your database. Make sure you select apache2 when prompted then continue with the install.

Attached Image

Now to get php working with myqsl type the following into the terminal.
gksudo gedit /etc/php5/apache2/php.ini



find the following commented line in the document.
;	 extension=mysql.so



remove the ";" so the line now reads
extension=mysql.so



now let's restart apache2 again...
sudo /etc/init.d/apache2 restart



open up your terminal type:
mysql -uname -p



replace -uname with your -u username enter your newly created password and you are ready to configure.

Attached Image

Is This A Good Question/Topic? 1
  • +

Page 1 of 1