HOW TO INSTALL LAMP ( LINUX APACHE, MYSQL AND PHP ) ?

 


ABOUT LAMP

LAMP is a group of open source software used to get web servers up and running. The acronym stands for Linux, Apache, MySQL, and PHP. Since the
virtual private server is already running Ubuntu, the linux part is taken care of. Here is how to install the rest. In windows we can call XAMPP.


INSTALL LAMP

1. Install Apache

To install Apache you must install the Metapackage apache2. This can be done by searching for and installing in the Software Centre, or by running the following command.

sudo apt-get install apache2


2. Install MySQL

To install MySQL you must install the Metapackage mysql-server. This can be done by searching for and installing in the Software Centre, or by running the following command.

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


During the installation, MySQL will ask you to set a root password. If you miss the chance to set the password while the program is installing, it is very easy to set the password later from within the MySQL shell.


Once you have installed MySQL, we should activate it with this command:

sudo mysql_install_db

Finish up by running the MySQL set up script:

sudo /usr/bin/mysql_secure_installation

The prompt will ask you for your current root password.

Type it in.

Enter current password for root (enter for none):
OK, successfully used password, moving on... 

Then the prompt will ask you if you want to change the root password. Go ahead and choose N and move on to the next steps.

It’s easiest just to say Yes to all the options. At the end, MySQL will reload and implement the new changes.
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for   
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a       
production environment.                                               
                                                                      
Remove anonymous users? [Y/n] y                                       
 ... Success!                                                         
                                                                      
Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.
                                                                      
Disallow root login remotely? [Y/n] y                                 
... Success!                                                          
                                                                      
By default, MySQL comes with a database named 'test' that anyone can  
access.  This is also intended only for testing, and should be removed
before moving into a production environment.                          
                                                                      
Remove test database and access to it? [Y/n] y                        
 - Dropping test database...                                          
 ... Success!                                                         
 - Removing privileges on test database...                            
 ... Success!                                                         
                                                                      
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.                                         
                                                                      
Reload privilege tables now? [Y/n] y                                  
 ... Success!                                                         
                                                                      
Cleaning up...                                                          

 

3. Install PHP

To install PHP you must install the Metapackages php5 and libapache2-mod-php5. This can be done by searching for and installing in the Software Centre, or by running the following command.

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt


4. Restart Server

Your server should restart Apache automatically after the installation of both MySQL and PHP. If it doesn't, execute this command.

sudo service apache2 restart

 

5. Check Apache

Open a web browser and navigate to http://localhost/. You should see a message saying It works! or like this picture.




Congratulation, you have done to install LAMP in your linux. Enjoy it and Thanks for coming :).

No comments:

Post a Comment