how to install LAMP on CentOS 7 ! quick process

Posted by

Consists in “Apache Server” an open source web server for Linux distributions. Today it is very common for its robustness, ease of use and safety.

“MySQL”, one of the most common database manager, & “PHP” open source programming language with special emphasis on web development.


Note: It is important to perform the installation using an account with administrative rights on the selected host. Known as “root” account.


Apache installation is very simple,

# yum install httpd

Once installed, it is necessary to start the service.

# service httpd start


1. Verify the IP address

# ifconfig

2. In the browser of your choice, type the corresponding IP address and press the enter key.

If everything was successfull, you will see the apache home page!

Note: If you do not have access, you may have to work with your firewall/iptables to establish the necessary rules to successfully fix that and configure your scenario to work as expected.

If you want you can disable the firewall for testing purposes, while the necessary configuration is done, just run,

# service iptables stop


The installation of MySQL is similar to Apache, to do that just run the following command,

# yum install mysql-server

Once installed, it is necessary to start the services.

# service mysqld start


It is necessary to define a “root” password to access the MySQL database manager, to do that enter the following command: / usr / bin / mysql_secure_installation

Once the process has started, it will ask for your current password, as it is a recent installation and we are on the process of defining it, it is empty for now, so that you simply press the enter key and continue.

It is necessary to follow the instructions that will be presented, READ ALL AND EACH OF THEM! PLEASE ! In any case they are simple steps, questions [y / n] and in each of the options you must enter Y, which indicates “yes“.



The installation of PHP is done with the following command,

# yum install php php-mysql

Once installed, you must perform the necessary verification, for this it is necessary to edit the following file, “info.php”, if it does not exist, please create it, you can do that in two ways, with the “touch” command or with the text editor of your choice.

Option 1 # touch info.php
Option 2 # nano info.php, edit and save.

File content and file path

Path: / var / www / html /


<? php

phpinfo ();


Save and exit.

Please restart the apache services, with the following command:

# service httpd restart

once the service is up and running, please go to your default browser and enter the following information:

http: // [IP address] /info.php

if you see the informative page of PHP, the installation of php has been correct, if not, double check the services, firewall rules, the URL, etc.

Once the installation and verification of Apache, MySQL and PHP have been completed, we have completed the package known as LAMP for its correct use over the CentOS 7 distribution.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s