How to install Apache2 webserver on CentOS 7?

This tutorial explains how to install Apache2 (httpd) webserver on CentOS 6, 7 systems.

 

1. Install Apache2 webserver on your system by using the following command:
sudo yum install httpd -y

 

2. Start Apache2 webserver on your system by using the following command:
sudo systemctl start httpd.service

 

3. Enable Apache2 webserver to start on boot by using the following command:
sudo systemctl enable httpd.service

 

You can check what Apache2 webserver related software packages and dependencies are installed by using the following command:

sudo yum list installed *httpd*

 

Output:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.beyondhosting.net
* epel: mirror.steadfast.net
* extras: mirror.beyondhosting.net
* updates: mirror.beyondhosting.net
Installed Packages
httpd.x86_64 2.4.6-45.el7.centos @base
httpd-tools.x86_64

 

4. Uninstall the Apache2 (httpd) webserver by using the following command:

sudo yum remove httpd

 

However, this will only remove the httpd service. Dependencies (related packages to the httpd service) will not be removed.

 You can remove multiple httpd related dependencies, which have “httpd” in their name by using the following command:

sudo yum remove *httpd*

 

NOTE: However, be careful while removing multiple packages and/or dependencies. You might remove more packages than you actually wish to remove by mistake. Furthermore, be aware that some dependencies may still be used by other software packages. If such dependencies were removed, other software, which require these dependencies, would undoubtedly experience problems or stop functioning entirely.

 

5 Comments

  1. Pingback: How to install Wordpress on your CentOS or Ubuntu server? - Tiny Tumbleweed

  2. Pingback: How to change the default Apache2 webroot directory? - Tiny Tumbleweed

  3. Pingback: How to fix WordPress permalink problem with mod_rewrite? - Tiny Tumbleweed

  4. Pingback: How to change PHP memory limit in php.ini file? - Tiny Tumbleweed

  5. Pingback: How to setup phpMyAdmin on Centos 7? - Tiny Tumbleweed

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.