Install LAMP Server on Centos 7

admin/ April 8, 2016/ Linux/ 0 comments

There are few steps to install LAMP server on Centos 7.

First of you need to add EPEL Repository of mysql

 rpm -iUvh http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

Add the EPEL Repository for phpmyadmin

 rpm -iUvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
 yum -y update

Step 1-:
To install LAMP on Centos server needs to install the below packages.

yum install -y httpd php phpmyadmin mysql-server

Step 2-:
To allow the phpmyadmin in apache 2.4 add the line

Require all granted

vi /etc/httpd/conf.d/phpMyAdmin.conf

<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8

<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
Require all granted
</RequireAny>

To add the apache application on start up

systemctl enable httpd

Restart the apache server

 systemctl restart httpd

Step 3-:
Set the mysql root password.

$ mysql
 mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('root');
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye

Step 4-:
Allow port 80 and 443 in iptables public zone

firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=443/tcp --permanent

Then remember to reload the firewall for changes to take effect.

firewall-cmd --reload

Step 5-:
LAMP server is ready to use.
Visit to phpmyadmin
http://localhost/phpmyadmin/
To check the phpinfo

 $ echo "" > /var/www/html/index.php

http://localhost

or

http://<server ip >

Leave a Reply