A brief tutorial explaining how to install LAMP server under CentOS 7. All steps mentioned below require from the user to have root privileges to be able to install packages on CentOS.

LAMP Server Installation

1. Apache Setup

Apache is easily installed via this command:

sudo yum install httpd

Start Apache with this command:

sudo service httpd start

Open your server's IP address or use localhost (http://localhost/) to check whether Apache is running or not. If you don't know your server IP address, try to find it using this command:

hostname -i


ip addr show

If Apache is well started you will see this page (for CentOS with GUI):

2. MySQL Setup

To install MySQL on CentOS 7, run these commands:

sudo yum install http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm 
sudo yum install mysql-server

Start MySQL with this command:

sudo service mysqld start

If you haven't set a root password before, use this command:

sudo /usr/bin/mysql_secure_installation

3. PHP Setup

To install PHP on CentOS, run this command:

sudo yum install php php-mysql

After you finish, let's create a test PHP file using this command:

echo "" | sudo tee /var/www/html/test.php

Restart Apache with this command:

sudo service httpd restart

Then open test.php (replace localhost with your server's IP address):


If PHP is installed you will see this page:

That's it :)
Newer Post
This is the last post.

Post a Comment