Google Cloud Compute Engine

Install Apache on CentOS 7 – 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

Install Apache on CentOS 7 – Google Cloud.

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

Not using CentOS 7? Choose a different OS:

CentOS 7

Debian 9

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 7
  3. CentOS 7 server setup on Google Cloud.

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 ufw allow http
sudo ufw allow https

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 Thu 2019-02-14 04:26:01 UTC; 3s ago
Docs: man:httpd(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.

Verify Apache Installation

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

Now Apache is installed on CentOS 7 – 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.