• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to Completely Remove and Install Apache package on CentOS 7.6

  • 00:47 rpm -qa "httpd"
  • 00:58 yum list installed "httpd*"
  • 01:08 yum list installed "mod_*"
  • 01:20 yum remove "httpd*" -y
  • 01:31 rm -rfv /var/www
  • 01:44 grep "apache" /etc/passwd
  • 01:53 userdel -r "apache"
  • 02:08 rm -rfv /etc/httpd
  • 02:18 rm -rf /usr/lib64/httpd
  • 02:26 systemctl status httpd
  • 02:36 yum install httpd -y
  • 02:48 systemctl enable httpd
  • 02:54 systemctl start httpd
{{postValue.id}}

To Completely Remove And Install the Apache Package On Centos 7.6

Procedure:

  1. Query and list all the Apache rpm packages.

  2. list the installed httpd and mod packages

  3. Remove the installed httpd and mod packages

  4. Remove the Document root Directory

  5. Check the Apache user in /etc/passwd and remove the user

  6. Remove the Configuration files Of Apache

  7. Remove the Supported files and modules of Apache

  8. Check the service of Apache

  9. Install Apache

  10. Enable And Start the service Of Apache.

  11. Check the service Of Apache

Remove the Apache server:

Before you begin, list all the installed httpd rpm packages.

[root@linuxhelp ~]# rpm -qa "httpd"
httpd-2.4.6-88.el7.centos.x86_64

List the installed httpd packages

[root@linuxhelp ~]# yum list installed "httpd*"
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.dhakacom.com
 * epel: www.ftp.ne.jp
 * extras: mirror.dhakacom.com
 * remi-php72: remi.schlundtech.de
 * remi-safe: remi.schlundtech.de
 * updates: mirror.nbrc.ac.in
base                                                 | 3.6 kB     00:00     
extras                                               | 3.4 kB     00:00     
extras/7/x86_64/primary_db                             | 201 kB   00:01     
Installed Packages
httpd.x86_64                       2.4.6-88.el7.centos                 @base
httpd-tools.x86_64                 2.4.6-88.el7.centos                 @base

List the installed mod packages.

[root@linuxhelp ~]# yum list installed "mod_*"
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.dhakacom.com
 * epel: www.ftp.ne.jp
 * extras: mirror.dhakacom.com
 * remi-php72: remi.schlundtech.de
 * remi-safe: remi.schlundtech.de
 * updates: mirror.nbrc.ac.in
Error: No matching Packages to list

Remove the httpd packages by executing the following command.

[root@linuxhelp ~]# yum remove httpd
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-88.el7.centos will be erased
--> Processing Dependency: httpd-mmn = 20120211x8664 for package: php-7.2.17-1.el7.remi.x86_64
---> Package httpd-tools.x86_64 0:2.4.6-88.el7.centos will be erased
--> Running transaction check
---> Package php.x86_64 0:7.2.17-1.el7.remi will be erased
--> Finished Dependency Resolution
.
.
.
.
Removed:
  httpd.x86_64 0:2.4.6-88.el7.centos                                        
  httpd-tools.x86_64 0:2.4.6-88.el7.centos                                  

Dependency Removed:
  php.x86_64 0:7.2.17-1.el7.remi                                            

Complete!

Remove the Document root directory.

[root@linuxhelp ~]# rm -rfv /var/www

Delete the Apache user with the series of following commands.

[root@linuxhelp ~]# grep "apache" /etc/passwd
apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin

[root@linuxhelp ~]# userdel -r "apache"
userdel: apache mail spool (/var/spool/mail/apache) not found
userdel: apache home directory (/usr/share/httpd) not found

[root@linuxhelp ~]# grep "apache" /etc/passwd

Remove the configuration files of httpd.

[root@linuxhelp ~]# rm -rfv /etc/httpd

Remove the supporting files and httpd modules.

[root@linuxhelp ~]# rm -rf /usr/lib64/httpd

Check the status of httpd.

[root@linuxhelp ~]# systemctl status httpd
Unit httpd.service could not be found.

Installation Of Apache server:

Install the httpd package.

[root@linuxhelp ~]# yum install httpd -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.dhakacom.com
 * epel: www.ftp.ne.jp
 * extras: mirror.dhakacom.com
 * remi-php72: remi.schlundtech.de
 * remi-safe: remi.schlundtech.de
 * updates: mirror.nbrc.ac.in
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-89.el7.centos will be installed
--> Processing Dependency: httpd-tools = 2.4.6-89.el7.centos for package: httpd-2.4.6-89.el7.centos.x86_64
--> Running transaction check
---> Package httpd-tools.x86_64 0:2.4.6-89.el7.centos will be installed
--> Finished Dependency Resolution
.
.
..
.
.


Installed:
  httpd.x86_64 0:2.4.6-89.el7.centos                                                                                                                                                                               

Dependency Installed:
  httpd-tools.x86_64 0:2.4.6-89.el7.centos                                                                                                                                                                         

Complete!

Enable the service of Apache server.

[root@linuxhelp ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

Start the service Of Apache server.

[root@linuxhelp ~]# systemctl start httpd

**Check the status of Apache server. **

[root@linuxhelp ~]# 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 Wed 2019-05-08 17:23:08 IST; 9s ago

Thus the procedure of completely remove and install the Apache package on Centos 7.6 comes to end.

Tags:
charlesmartin
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

Where could the Apache user be viewed On CentOS 7.6?

A

Under /etc/passwd file, you could find the apache user On CentOS 7.6

Q

How to delete the Apache user completely On CentOS 7.6?

A

userdel -r apache is the command to delete the user completely On CentOS 7.6

Q

How could I check an Apache user On CentOS 7.6?

A

grep apache /etc/passwd to check a particular user On CentOS 7.6

Q

WHat is the location of the configuration file of Apache On CentOS 7.6?

A

/etc/httpd/conf and /etc/httpd/conf.d are the configuration files location of Apache On CentOS 7.6

Q

What is the document root directory of Apache server On CentOS 7.6?

A

/var/www/html is the document root directory of Apache server On CentOs 7.6

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Luke ?
workbench for debian

I am using workbench in CentOS whereas now I need to use Debian Operating system so could you please help to install and use in Debian?

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.