Linux

Tutorial To Install Apache On CentOS 8 [How To]

Tutorial To Install Apache On CentOS 8 [How To]
Written by itsubuntu

Insight: Tutorial To Install Apache On CentOS 8 [How To]

In this article, we’ll show you methods to install and manage the Apache webserver on CentOS 8 operating system.

Tutorial To Install Apache On CentOS 8 [How To]

Apache is already available in the default CentOS repositories. The Apache package and service are called httpd. To install the Apache run the following command:

sudo yum install httpd

Now, you need to enable and start the Apache service:

sudo systemctl enable httpdsudo systemctl start httpd

To verify that the service is running, check its status by running the following command:

sudo systemctl status httpd

The output will be similar to this:

httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2020-03-08 15:54:58 UTC; 9s ago
  ...

Adjusting Firewall setting in CentOS:

The following commands will permanently open the necessary ports:

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

Now, you are ready to go and you can use Apache webserver in CentOS 8 Linux operating system.

 

Note:

Apache Web Server Configuration Files ( Important):

  1. All Apache configuration files are located in the /etc/httpd directory.
  2. Main configuration file is /etc/httpd/conf/httpd.conf.
  3. You can set your domain document root directory to your desired location.
    • /home/<user_name>/<site_name>
    • /var/www/<site_name>
    • /var/www/html/<site_name>
    • /opt/<site_name>

About the author

itsubuntu

Leave a Comment