How to install Apache on a CentOS 7 server

In this tutorial we will install Apache on a single server that does NOT have a web server or database server already installed.

Before you begin:

1. Clean-up yum:

sudo yum clean all

2. Update your system:

sudo yum update

Let’s start

Step 1 : we can get started by typing these commands:

sudo yum install httpd

Step 2 : Allow the default HTTP and HTTPS port, ports 80 and 443, through firewalld:

sudo firewall-cmd --permanent --zone=public --add-service=http 
sudo firewall-cmd --permanent --zone=public --add-service=https

Step 3 : And reload the firewall:

sudo firewall-cmd --reload

Step 4 : Once it installs, you can start Apache on your VPS:

sudo systemctl start httpd

Step 5 : To configure Apache to Start on Boot:

sudo systemctl enable httpd

Apache web server has been completely installed. You can check it by going to the address :

http://your_server_IP_address/

Some other useful commands for Apache

To check the status of Apache:

sudo systemctl status httpd

To stop Apache:

sudo systemctl stop httpd

To restart Apache:

sudo systemctl restart httpd

To check Apache version

httpd -v
Leave a reply

Sharing is caring!

Back to Top