Installing LAMP in Ubuntu

Following are the steps to get Apache, MySQL and PHP installed on a Ubuntu system.

Installing Apache:

In the terminal window issue the following command

sudo apt-get install apache2

To test if Apache has installed successfully, open a browser and browse to http://localhost. A message “It works” will be displayed.

Installing PHP

In the terminal window issue the following command

sudo apt-get install php5 libapache2-mod-php5

Once the installation is complete, to get php working, restart apache server by issuing the following command

sudo /etc/init.d/apache2 restart

To test that PHP has been successfully installed, quickly create a test PHP script

sudo gedit /var/www/test.php

In the gedit window, type a script and save the file

Open up a browser window and open the test.php file created. The PHP application environment information will be displayed.

Installing MySQL

In the terminal, run the following command

sudo apt-get install mysql-server

That should get mysql installed. You will be prompted for a ‘root’ db user password. Enter it.
To test mysql, in the terminal issue,

mysql -u root -p

Enter the root user password for mysql server. You will be launched into the mysql prompt.

Installing phpMyAdmin

To install phpMyAdmin, issue the following command at the terminal

sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

To test phpmyadmin, open a browser and navigate to http://localhost/phpmyadmin.
Thats it!

Advertisements

2 thoughts on “Installing LAMP in Ubuntu

Leave a Reply

Fill in your details below or click an icon to log in:

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