How to install Apache and Mysql server in CentOS –

How to install Apache and Mysql server in CentOS –

PHP – apache server

PHPMYADMIN – Mysql server or any database

Steps 1.)

Need to install CentOS server with minimum hardware requirement 4GB RAM or Max and Hard-disk minimum 50 GB

Steps .)

Yum update or dnf update

Yum upgrade or dnf upgrade

Login to your server and use the below yum command to install yum-utils & enable epel repository

yum install epel-release yum-utils -y

Download and Install remirepo using yum command

Based on your requirement, configure the PHP 7.x repository

Here I m configuring PHP 7.4

yum-config-manager –enable remi-php7.4

yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysql -y

Verify PHP Version

I am assuming Apache web Server is installed on your system, start its service using below systemctl command

Steps .)

sudo dnf install httpd httpd-tools

sudo systemctl enable httpd

Sudo systemctl start httpd

Sudo systemctl status httpd


These things not always required

Sometime – we need to set the enforce

If we don’t enable the enforce the status will be failed

Or we need to reload the centos server firewall

sudo firewall-cmd –reload

sudo firewall-cmd –permanent –zone=public –add-service=http }

setenforce 0

Now create a info.php file under /var/www/html with following contents

cd /var/www/html/

Test you Apache running status on web browser

MYSQL installation

sudo mysql_secure_installation

Please create the mysql or enter use root password password

Once you’ve MySQL installed on CentOS 8, you can test if everything was set up correctly by checking its version. Type in the following command:

[root@web ~]# sudo systemctl status mysqld

Second method to install mysql

dnf install wget



mv phpMyAdmin-5.0.2-all-languages /usr/share/phpMyAdmin

Or use this

mv /usr/share/phpmyadmin/phpMyAdmin-5.0.2-all-languages/* /usr/share/phpmyadmin/

mkdir /usr/share/phpmyadmin/tmp

chown -R apache:apache /usr/share/phpmyadmin

chmod 777 /usr/share/phpmyadmin/tmp

If we will get the Error while starting and checking the Apache server status need to disable the Firewall.

[root@ssl ~]# firewall-cmd –state

stop frewall

[root@ssl ~]# systemctl stop firewalld

[root@ssl ~]# setenforce 0

[root@ssl ~]# systemctl start httpd.service

[root@ssl ~]# cat /etc/hosts localhost ssl

#The following lines are desirable for IPv6 capable hosts

::1 localhost ip6-localhost ip6-loopback

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters

One thought on “How to install Apache and Mysql server in CentOS –

  • August 21, 2022 at 5:59 pm

    I believe this website contains some really excellent information for everyone. “To be able to be caught up into the world of thought — that is being educated.” by Edith Hamilton.


Leave a Reply

Your email address will not be published. Required fields are marked *