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
To Completely Remove And Install the Apache Package On Centos 7.6
Procedure:
-
Query and list all the Apache rpm packages.
-
list the installed httpd and mod packages
-
Remove the installed httpd and mod packages
-
Remove the Document root Directory
-
Check the Apache user in /etc/passwd and remove the user
-
Remove the Configuration files Of Apache
-
Remove the Supported files and modules of Apache
-
Check the service of Apache
-
Install Apache
-
Enable And Start the service Of Apache.
-
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.
Comments ( 0 )
No comments available