Install LAMP on centOS

What is LAMP?

LAMP stands for Linux, Apache, MySQL and PHP.

Once installed you will be able to host your website on the sever you have installed LAMP on.


Step 1: Start by going to your terminal and type the below command.

sudo yum install httpd

You should see the download processing before it asks you if you want to install:
Type “y” and hit Enter.


Step 2: Start your Apache server by typing:

sudo service httpd start

Apache should be installed properly now. To check it, navigate to your IP address in the address bar of your browser. You should see some form of a test page letting you know that Apache has installed properly.


Step 3: Installing MySQL

MySQL is an open source database management system often used to store user data on a web server.
With your terminal still open, type in the following command:

sudo yum install mysql-server

If you are running CentOS 7+, then you’ll need to install MySQL using the following commands:

yum install
yum install mysql-community-server

Once MySQL is installed, start the service using:

sudo service mysqld start

Next you’ll need to set up a root password:

sudo /usr/bin/mysql_secure_installation

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.

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

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


Step 4: Installing PHP

PHP is a server-side scripting language designed for web development.
Type the command below to install PHP

sudo yum install php php-mysql

Then follow the prompts to install PHP.

You have now installed LAMP