Setting up LAMP Stack on your UBUNTU System

This is to help people set up LAMP on their desktops. Ubuntu server edition comes with LAMP but desktop users must download all the necessary files. This tutorial owes its credits to Ubuntu Community Docs and lots of people around the world who enlightened me about LAMP and Ubuntu. Let’s start.We first need some important packages. These are:

apache2 php5-mysql libapache2-mod-php5 mysql-server

You can get these via apt-get or from your Synaptics Package Manager. For getting via apt-get you must have an active internet connection. Type this command in the terminal:

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

If you are in the Packages Manager, just search the packages and select them. This is the easiest method.

You may want to configure your LAMP, but before starting it is advisable to change the installation defaults. The default root user of MySQL has no password or a blank string as password. This should be changed. It is always advisable to create another user with full privileges as that as root. Use this alternate user instead as root. Root is the superuser.

Go to terminal: Type

mysql -u root

At MySQL console type

SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘yourpassword’);

Just put your password instead of yourpassword within single quotes as shown above.

After setting the password if you want to login as root,just enter this at the terminal:

mysql -u root -p

Create a new user and give all the privliges to it as explained above:

grant all privileges on *.* to ‘yourusername’@’localhost’

identified by ‘yourpassword’ with grant option;

Replace yourusername with the username you want and yourpassword with a proper password. If you want this user to deny Grant Option just remove WITH GRANT OPTION from the above statement.

Run, Stop, Test, And Restart Apache:

Start: sudo /usr/sbin/apache2ctl start

Stop: sudo /usr/sbin/apache2ctl stop

Test: sudo /usr/sbin/apache2ctl test

Retart: sudo /usr/sbin/apache2ctl restart

Advertisements

One thought on “Setting up LAMP Stack on your UBUNTU System

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