INSTALLING Apache,MySQL,PHP ON UBUNTU

 

                                              Install Apache

1. Open up the Terminal ( Ctrl + Alt + T ).
 2. Copy/Paste the following line of code into Terminal and then press enter:

                         sudo apt-get install apache2

 3. The Terminal will then ask you for you’re password, type it and then press enter.

                                              Testing Apache

To make sure everything installed correctly we will now test Apache to ensure it is working properly.
  1. Open up any web browser and then enter the following into the web address:

You should see a folder entitled apache2-default/. Open it and you will see a message saying “It works!” 

 

                                  Install PHP

  1. Again open up the Terminal ( Ctrl + Alt + T ).
  2. Copy/Paste the following line into Terminal and press enter:

                      sudo apt-get install php5 libapache2-mod-php5
3. In order for PHP to work and be compatible with Apache we must restart it. Type the following code in Terminal to do this:
                                sudo /etc/init.d/apache2 restart

 

                                                     Test PHP

To ensure there are no issues with PHP let’s give it a quick test run.
  1. In the terminal copy/paste the following line:

                                         sudo gedit /var/www/testphp.php

      This will open up a file called phptest.php.

2. Copy/Paste this line into the phptest file:

                       <?php phpinfo(); ?>

3. Save and close the file.
4. Now open you’re web browser and type the following into the web address:

                                      http://localhost/testphp.php
now both Apache and PHP installed
 

                                  Install MySQL

1.Once again open Terminal and then copy/paste this command

                         sudo apt-get install mysql-server

2. (optional) If you are running a server you should probably bind your address by editing bind-address in /etc/mysql/my.cnf and replacing its value (127.0.0.1) by your IP address.

3. set your root password (although mysql should ask you about that when installing)

mysql> SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘xxxxxx’);

4. Try running it

               mysql -uroot -pxxx

where xxx is your password.
  Note: You can install PHPMyAdmin for a graphical user interface of MySQL by executing

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

5. restart apache for the last time

                                sudo /etc/init.d/apache2 restart
 
                                             Congratulations
                                       ( Your LAMP system is working ) 
Advertisements

About Talwinder

Believe in god and hardwork

Posted on June 9, 2013, in Ubuntu. Bookmark the permalink. Leave a comment.

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

%d bloggers like this: