Introduction to Linux - A Hands on Guide | Linux Bible | Linux From Scratch | A Newbie's Getting Started Guide to Linux | Linux Command Line Cheat Sheet | More Linux eBooks



Saturday, 11 May 2013

LAMP Server - Installation & Configuration in Linux

LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,


What is LAMP?

LAMP - the abbreviation of first letters of words Linux + APache + MySQL + PHP:
 

Linux - the operating system;
Apache - Web server;
MySQL - a database management system (DBMS);
PHP - scripting language used to create the server-side sites.

In fact, this is all that is needed for the local host. The only thing missing, it's phpMyAdmin, which makes working with databases MySQL. PhpMyAdmin is installed separately, and it is discussed in later part of this article.



Installing LAMP on Ubuntu

Open a terminal and type the following command:

sudo apt-get install lamp-server^

After entering the password, the administrator will check what packages are already in the operating system and which should be set.


LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,

A message will appear asking: "Do you want to continue? [Y/n]". Enter the letter "Y" and press Enter.

It will begin installing LAMP on Ubuntu .


LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,

During the installation, you will be asked to enter administrator password of MySQL only twice, the rest is done automatically.

 

Testing Apache

Once the installation is complete for LAMP, open a browser and enter the address of the local server: http://localhost. You should see the test page that says «It works!».

If you want to start, stop, and restart Apache Web server, you can enter appropriate command from the following:

sudo /etc/init.d/apache2 start
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 restart


Root directory of the local site directory will be /var/www. By default, you need to be administrator to modify the files under this directory. If desired, you can change this by setting the directory permissions to 777 using the following command:

sudo chmod -r 777 /var/www

After this, any user can do with the folder and files in it anything you like.

 

Testing PHP

To check whether PHP is working fine, create a new file using following command:

sudo nano /var/www/testing.php

Paste the following code into the file:


<?php phpinfo(); ?>

LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,

It will look like this,

LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,

Press CTRL+O to save the file, and then CTRL+X to exit.
Restart Apache using command as stated above. 

Go to following link in your web browser
http://localhost/testing.php
It will display something like this:

LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,

MySQL Bind Address

To check the bind address that your system has, enter:

sudo cat /etc/hosts | grep localhost

 LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,

It will show you your system's Bind address, which is 127.0.0.1 in my case.
 

Now, open MySQL Config file using:

sudo nano /etc/mysql/my.conf

Scroll down some line until you see "Bind Address" like this:

LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,

If this Bind address matches the one shown earlier, it's well and good. Otherwise change this field to match your band address that you found earlier.


phpMyAdmin

If you are a new to MYSQL and commands related to it, it will be troublesome to manage databases and everything. phpMyAdmin helps you in dealing with those problems by introducing a PHP interface for MySQL administration.
Enter following command to install it:

sudo apt-get install phpmyadmin

LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,

After this, another blue screen will appear before you asking which web server you want to configure to run phpMyAdmin. Confirm that you choose "Apache2" by hitting Spacebar. Selected option will be marked by an asterick, then you can press Enter.

LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,

It will ask you if phpMyAdmin should configure a default database for its own use. Select Yes and proceed.

LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,

Enter MySQL root password as we haven't added any MySQL user yet.

LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,

Enter the password that you would like to use for phpMyAdmin account and confirm it.
LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,LAMP Server,

It's now turn to restart Apache2. You have done it before too.

You can log in to your phpMyAdmin account using the URL shown below 
http://localhost/phpmyadmin/

phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,

Username will be "root" and password will be root MySQL Password.

phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,phpMyAdmin,

Remember-

  • Use strong passwords as you are allowing others to access your computer after you install this software.
  • All the files you wish to host will reside in /var/www directory. You need to change the permissions if you want access to this directory.

1 comment:

  1. Thanks you very well explained..I have tried it on my own pc and Its working...Thanks again..

    ReplyDelete