How to perform LAMP installation on CentOS?

LAMP stands for Linux, Apache, MySQL, and PHP. It is nothing but Linux operating system with Apache web service. It allows to run the websites and web apps on server. 

Pre-requisite for LAMP installation -

1. Root access -  You should have root access.

2. Check the hostname - 
hostname
OR
hostname -f

3. Update your system -
yum update

Apache Web Install and Configure

1. Install Apache - 
yum install httpd

2. Start Apache running on your server - 
service httpd start

MySQL Install and Configure

1. Install the MySQL package -
yum install mysql-server

2. You will need to set up a root password - 
/usr/bin/mysql_secure_installation

i. When asked for a current root password, leave the field blank and hit Enter.
Type "y" and hit the Enter button again if it asks you if you would like to set a Root Password.

ii. When asked for your current root password, leave the field blank and hit Enter.
Type “y” and hit Enter again when it asks if you would like to set the root password.

iii. Set the password and be sure to store the password somewhere safe.

iv. Next you will be asked a series of questions.  Read through them and  determine what you want your answers to be.

It’s easiest just to say Yes to all the options.  At the end, MySQL will reload and implement the new changes. The output will as follows -

All done!  If you've completed all of the above steps, your MySQL installation should now be secure.
Thanks for using MySQL!

Install PHP

PHP is necessary for developing the dynamic pages on webserver.
yum install php php-mysql
Once you answer yes to the PHP prompt, PHP will be installed. Smile

PHP Modules

PHP supports various modules which you can install it along with PHP. You can search PHP modules using below modules -
yum search php-

If you would like to install the modules then you can fire below commands - 
yum install name of the module

All done! Smile

Was this answer helpful?

 Print this Article

Also Read

How to perform the Linux Sever Hardening?

1. Check the hostname is setup or not - hostname 2. Check the IP address is assigned to hostname...

What is Node.js Exactly? - A beginners introduction to Nodejs

Node means Server and JS means Java Script so in simple words Node.js is a Server Side Java...

How to install AVG Antivirus scanner on Ubuntu?

AVG free is antivirus which protects from spyware as well malware. It is free to use for private...

How to setup the email alert for low disk space?

If you don't want to setup to a full monitoring solution such as Nagios you can create your own...

How to update MySQL password?

Steps to update the MySQL Password - 1. First stop MySQL service by following command....

Powered by WHMCompleteSolution