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 -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 - 

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. 

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!

Was this answer helpful?

 Print this Article

Also Read

Basic exim commands

1. REMOVE MAILS BY ID - /usr/sbin/exim -v -Mrm (MAIL ID HERE) 2. LIST QUEUED MAILS -...

Daily Useful Linux Commands

Finding the username from provided hosting service name - /script/whoowns domain_name Finding...

Disk Usage Useful Command

Note - You can replace /home with correct '/' drive on your server. 1. Checking the disk usage -...

How to backup and restore large MySQL databases using mysqldump?

1. Backup database:#mysqldump -u username -p[username_password] databasename >...

How to change the port number of Apache Web Server?

Default port to access the Apache is 80. Secure port for communicating with world for Apache is...