Google Cloud Compute Engine

How to Install Apache on CentOS 8 – Google Cloud

Disclosure: This post may contain affiliate links, which means we may receive a commission if you click a link and purchase something that we recommended.

Pinterest LinkedIn Tumblr

How to Install Apache on CentOS 8 – Google Cloud. In this tutorial you are going to learn how install Apache on CentOS 8

Apache is the most widely used HTTP web server which provides dynamic loading modules, easily integrating with other applications.

This guide helps you to install Apache on CentOS 7 on Google Compute Engine.


  1. Your Compute Engine Instance running.
  2. For setting up Compute Engine, see the Setting up Compute Engine Instance with CentOS 8

Install Apache

Installing Apache in CentOS is pretty straight forward which is known as httpd. Run the following command to install.

sudo yum install httpd

Once the installation is completed, enable and start the Apache service.

sudo systemctl enable httpd
sudo systemctl start httpd

Configure Firewall

If your server is protected by the firewall and you haven’t opened the HTTP and HTTPS ports. Enable them with the following command.

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

Verify Apache Installation

Every process in Apache is managed with the systemctl command. Verify the installation of Apache with the following command.

sudo systemctl status httpd
● httpd.service - The Apache HTTP Server
    Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
    Active: active (running) since Fri 2019-11-08 04:26:01 UTC; 3s ago
      Docs: man:httpd.service(8)
  Main PID: 3483 (httpd)
    Status: "Processing requests…"
    CGroup: /system.slice/httpd.service
            ├─3483 /usr/sbin/httpd -DFOREGROUND
            ├─3484 /usr/sbin/httpd -DFOREGROUND
            ├─3485 /usr/sbin/httpd -DFOREGROUND
            ├─3486 /usr/sbin/httpd -DFOREGROUND
            ├─3487 /usr/sbin/httpd -DFOREGROUND
            └─3488 /usr/sbin/httpd -DFOREGROUND
 Feb 14 04:26:01 instance-1 systemd[1]: Starting The Apache HTTP Server…
 Feb 14 04:26:01 instance-1 systemd[1]: Started The Apache HTTP Server.

Now visit the External IP address of your VM instance (http://VM_INSTANCE_IP_ADDRESS), you will see the default Apache welcome page.

Apache Commands

To start Apache web server.

sudo systemctl start httpd

To stop Apache webserver.

sudo systemctl stop httpd

To restart Apache web server.

sudo systemctl restart httpd

To reload Apache without dropping connections.

sudo systemctl reload httpd

To disable Apache.

sudo systemctl disable httpd

To enable Apache.

sudo systemctl enable httpd

Prepare yourself for a role working as an Information Technology Professional with Linux operating system

Now Apache is installed on CentOS 8 – Google Cloud and configured with Firewall.

Write A Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.