• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial 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
5591

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

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

Related Tutorials in How to Completely Remove and Install Apache package on CentOS 7.6

Related Tutorials in How to Completely Remove and Install Apache package on CentOS 7.6

How To Install AnyDesk on Centos 7
How To Install AnyDesk on Centos 7
Apr 2, 2018
How to install Tiki Wiki CMS Groupware on CentOS 7
How to install Tiki Wiki CMS Groupware on CentOS 7
May 31, 2018
How to install PHP ImageMagick on CentOS 7
How to install PHP ImageMagick on CentOS 7
Nov 4, 2017
How to Upgrade and Downgrade the PHP Versions on CentOS 7.6
How to Upgrade and Downgrade the PHP Versions on CentOS 7.6
Jun 4, 2019
How to install Apache from Source Code on CentOS 7
How to install Apache from Source Code on CentOS 7
Oct 21, 2017
How to enable or disable repositories in CentOS
How to enable or disable repositories in CentOS
Mar 28, 2018
How to install AWStats on CentOS 7
How to install AWStats on CentOS 7
Dec 8, 2017
How to install Apache JMeter in CentOS 7
How to install Apache JMeter in CentOS 7
Mar 24, 2017

Related Forums in How to Completely Remove and Install Apache package on CentOS 7.6

Related Forums in How to Completely Remove and Install Apache package on CentOS 7.6

CentOS
connor class=
How To Completely Remove Apache package On CentOS 7.6
May 14, 2019
CentOS
ceriaimmaculate class=
setfacl : command not found
Jan 3, 2018
CentOS
mason class=
Error getting authority: Error initializing authority: Could not connect: No such file or directory (g-io-error-quark, 1)
Nov 20, 2018
CentOS
landon class=
Command to find SNMP Version
May 28, 2018
CentOS
arjitharon class=
cannot start minio service help
Mar 10, 2018
Apache
isaac class=
How to disable apache welcome page on Ubuntu
Dec 15, 2018
Apache tomcat
AadrikaAnshu class=
Cannot find ./catalina.sh The file is absent or does not have execute permission This file is needed to run this program
Jun 17, 2019
gitlab
caden class=
Insufficient space in download directory /var/cache/yum/x86_64/6/base/packages
Jul 22, 2019

Related News in How to Completely Remove and Install Apache package on CentOS 7.6

Related News in How to Completely Remove and Install Apache package on CentOS 7.6

Attackers take advantage of Apache Struts vulnerabilities
Attackers take advantage of Apache Struts vulnerabilities
Mar 17, 2017
An Apache Web Server Bug That Grants Root Access on  Shared Web Hosts
An Apache Web Server Bug That Grants Root Access on Shared Web Hosts
Apr 10, 2019
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 Owen ?
How to add SSH key to my Gitlab account

I need to add the SSH key in my gitlab account. How to do so ????

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.