How to Install LAMP on CentOS/RHEL 7
This guide provides step-by-step instructions for installing a full-featured LAMP stack on a CentOS 7 system.
Note: The CentOS 7 Project has elected to replace the init service management daemon with the newer, systemd daemon for this latest release. In addition, this release of CentOS ships with MariaDB repositories instead of MySQL.
Install REMI and EPEL Repositories:
REMI and EPEL repositories has the majority of updated packages. So its helpful to add these repositories before preparing to LAMP setup on CentOS/RHEL 7.
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-6.noarch.rpm # rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
Install Apache:
The Apache Web Server is an extremely prevalent decision for serving website pages. Introduce Apache web server utilizing following command:
# yum --enablerepo=remi install httpd
Presently begin httpd service and enable to start on boot using below command.
# systemctl start httpd # systemctl enable httpd
Install MySQL:
First include MySQL yum repositories in your system using following command.
# rpm -Uvh http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
Now install MySQL server and other dependency packages.
# yum install mysql-server
Now restart MySQL service and enable to start on system boot.
# systemctl start mysqld # systemctl enable mysqld
Apply security on MariaDB furthermore set root user password.
# mysql_secure_installation
Installing PHP
PHP makes it conceivable to create dynamic and intelligent pages utilizing your own particular scripts and web improvement structures. Presently introduce php packages using following command.
# yum --enablerepo=remi install php # yum install --enablerepo=remi php-mysql php-xml php-xmlrpc php-soap php-pgsql php-gd
After installing php and other php modules restart Apache service.
# systemctl restart httpd
Check Version:
# php -v
PHP 5.4.38 (cli) (built: Feb 18 2015 16:36:53) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
# httpd -v
Server version: Apache/2.4.6 (CentOS) Server built: Jan 12 2015 13:22:31
# mysql -V
mysql Ver 14.14 Distrib 5.6.23, for Linux (x86_64) using EditLine wrapper
Recommended Article: