25th Anniversary Savings | 25% Off Dedicated Servers*Shop Now
25th Anniversary Savings | 25% Off VPS Hosting* †††Shop Now
Limited Inventory: High-Performance AMD-Powered Servers Now Available.* Shop Now >
Dedicated Hosting Deals | From $99/moShop Now
Earn hosting credits and a chance to win an Amazon gift card when you refer friends to Liquid Web!Read our promo rules

How to Install Apache on CentOS 7

Posted on by J. Mays | Updated:
Reading Time: 2 minutes

The Apache web server is one of the most popular and powerful web servers in the world, due to its ease of administration and flexibility. In this tutorial, we will install Apache on a server that doesn’t have a web server or database server already installed.

How to Install Apache on CentOS 7

Pre-Flight Check
  • These instructions are intended for installing Apache on a single CentOS 7 node.
  • I’ll be working from a Liquid Web Self Managed CentOS 7 server, and I’ll be logged in as non-root user. If you need more information then visit our tutorial on How to Add a User and Grant Root Privileges on CentOS 7.

  1. Install Apache:
    1. First, clean-up yum:
      sudo yum clean all
    2. As a matter of best practice we’ll update our packages:
      sudo yum -y update
    3. Installing Apache is as simple as running just one command:
      sudo yum -y install httpd
  2. Allow Apache Through the Firewall
    1. Allow the default HTTP and HTTPS port, ports 80 and 443, through firewalld:
      sudo firewall-cmd --permanent --add-port=80/tcpsudo firewall-cmd --permanent --add-port=443/tcp
    2. And reload the firewall:
      sudo firewall-cmd --reload

Here's 75% off a New VPS! Find out why 30,000 customers have chosen our Best-in-Class Performance & 24x7 Heroic Support

  1. Configure Apache to Start on Boot
    1. And then start Apache:
      sudo systemctl start httpd
    2. Be sure that Apache starts at boot:
      sudo systemctl enable httpd
  2. Other useful commands for Apache
    1. To check the status of Apache:
      sudo systemctl status httpd
    2. To stop Apache:
      sudo systemctl stop httpd

Video Update By Jake Wright

About the Author: J. Mays

As a previous contributor, JMays shares his insight with our Knowledge Base center. In our Knowledge Base, you'll be able to find how-to articles on Ubuntu, CentOS, Fedora and much more!

Latest Articles

How to Edit the PHP Memory for Your WordPress Site via WP Toolkit

Read Article

What is CGI-Bin and What Does it Do?

Read Article

Top 10 Password Security Standards

Read Article

Top 10 Password Security Standards

Read Article

How to Use the WP Toolkit to Secure and Update WordPress

Read Article