Install Apache, php7, mysql on Redhat 7 server

Apache is a popular webserver and our previous post explains on how to install on ubuntu, centos server. In this article, we will explain on how to install apache, php, mysql on redhat 7 server.

Prerequisites:

  1. Server Root access

Implementation:

Login to the server and execute the below command.

yum install httpd

This will install apache 2.4 version on redhat server.

Enable the service on system boot.

systemctl enable httpd.service

Enable the epel repository.

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

Install php 7 version of php version and default required package.

yum install php70w php70w-mysql php70w-gd php70w-pear php70w-xml php70w-soap php70w-xmlrpc php70w-mbstring php70w-json php70w-gd php70w-mcrypt

Restart the httpd service

systemctl restart httpd.service

The default installation location will beĀ /var/www/html

Install mysql using the below command.

yum install mysql mysql-server

Add the service to reboot safe

systemctl enable mysql.service

Start the mysql service.

systemctl start mysql.service

Create a info page with the following content

vi /var/www/html/info.php

<?php

phpinfo();

?>

Access the file using IP address or domain name

http://IPaddress/info.php

 

Leave a Reply