Removing @Apache HTTP Server – How to #LAMP

Visits: 301

Here are really great instructions for removing Apache Httpd server.

Removing Apache HTTP Server

Removing Apache HTTP Server ensures that, it’s existing files or services will not create conflict when we install Apache HTTP Server from the source code.

The following procedure will completely remove Apache HTTP Server from our system.
1) Removing Apache HTTP Server Packages
2) Removing Apache User and Group
3) Removing extra files

 

1) Removing Apache HTTP Server Packages
Apache HTTP Server packages come in two variations. Packages starting with httpd in their name provides server components. While packages starting with mod_ in their name provides server modules.

Let us get a list of all installed packages with httpd in their name.
In the terminal, execute the following command.

# yum list installed *httpd*
OPTIONS EXPLAINED

list
Is used to list various information about available packages; more complete details are available in the List Options section.

installed
List the packages installed on the system specified by args. If an argument does not match the name of an available package, it is assumed to be a shell-style glob and any matches are printed.

NOTE: The escape character '' prevents our shell from parsing '*'. So that yum gets the global expression we intended, which is *httpd*.

We will get a list of all installed packages having httpd in their name.
NOTE: Repository information has been stripped from the below output.

httpd.i686          2.2.15-15.el6.centos.1
httpd-devel.i686        2.2.15-15.el6.centos.1
httpd-manual.noarch     2.2.15-15.el6.centos.1
httpd-tools.i686        2.2.15-15.el6.centos.1

 

Now, let us get a list of all installed packages with mod_ in their name.
In the terminal, execute the following command.

# yum list installed *mod_*
OPTIONS EXPLAINED

list
Is used to list various information about available packages; more complete details are available in the List Options section.

installed
List the packages installed on the system specified by args. If an argument does not match the name of an available package, it is assumed to be a shell-style glob and any matches are printed.

NOTE: The escape character '' prevents our shell from parsing '*'. So that yum gets the global expression we intended, which is *mod_*.

We will get a list of all installed packages having mod_ in their name.
NOTE: Repository information has been stripped from the below output.

mod_auth_kerb.i686      5.4-9.el6
mod_auth_mysql.i686     1:3.0.0-11.el6_0.1
mod_auth_pgsql.i686     2.0.3-10.1.el6
mod_authz_ldap.i686     0.26-15.el6
mod_dav_svn.i686        1.6.11-7.el6
mod_dnssd.i686          0.6-2.el6
mod_nss.i686            1.0.8-15.el6
mod_perl.i686           2.0.4-10.el6
mod_revocator.i686      1.0.3-9.el6
mod_ssl.i686            1:2.2.15-15.el6.centos.1
mod_wsgi.i686           3.2-1.el6

 

We can get a description of each of the above package by using the yum info command. For example, to get information on httpd.i686 package, execute the following command. The architecture spec i686 need not be specified.

# yum info httpd
OPTIONS EXPLAINED

info
Is used to list a description and summary information about available packages; takes the same arguments as in the List Options section.

Also we can get a list of all files with their locations, installed by a specific package, by using the rpm -ql command. For example, to get information on httpd.i686 package, execute the following command. The architecture spec i686 need not be specified.

# rpm -ql httpd
OPTIONS EXPLAINED

-q
query

-l
list files in package

The yum descriptions for each package is given below. It is for us to understand what each packages are, so that we can decide which of them to remove.

httpd.i686
The Apache HTTP Server is a powerful, efficient, and extensible web server.

httpd-devel.i686
The httpd-devel package contains the APXS binary and other files that you need to build Dynamic Shared Objects (DSOs) for the Apache HTTP Server.
If you are installing the Apache HTTP server and you want to be able to compile or develop additional modules for Apache, you need to install this package.

httpd-manual.noarch
The httpd-manual package contains the complete manual and reference guide for the Apache HTTP server. The information can also be found at http://httpd.apache.org/docs/2.2/.

httpd-tools.i686
The httpd-tools package contains tools which can be used with the Apache HTTP Server.

mod_auth_kerb.i686
mod_auth_kerb is module for the Apache HTTP Server designed to provide Kerberos authentication over HTTP.  The module supports the Negotiate authentication method, which performs full Kerberos authentication based on ticket exchanges.

mod_auth_mysql.i686
mod_auth_mysql can be used to limit access to documents served by a web server by checking data in a MySQL database.

mod_auth_pgsql.i686
mod_auth_pgsql can be used to authenticate remote users of the Apache HTTP Server based on queries against in a PostgresQL database.

mod_authz_ldap.i686
The mod_authz_ldap package provides support for authenticating users of the Apache HTTP server against an LDAP database. mod_authz_ldap features the ability to authenticate users based on the SSL client certificate presented, and also supports password aging, and authentication based on role or by configured filters.

mod_dav_svn.i686
The mod_dav_svn package allows access to a Subversion repository using HTTP, via the Apache httpd server.

mod_dnssd.i686
mod_dnssd is an Apache HTTPD module which adds Zeroconf support via DNS-SD using Avahi.

mod_nss.i686
The mod_nss module provides strong cryptography for the Apache Web server via the Secure Sockets Layer (SSL) and Transport Layer Security (TLS) protocols using the Network Security Services (NSS) security library.

mod_perl.i686
Mod_perl incorporates a Perl interpreter into the Apache web server, so that the Apache web server can directly execute Perl code. Mod_perl links the Perl runtime library into the Apache web server and provides an object-oriented Perl interface for Apache's C language API.  The end result is a quicker CGI script turnaround process, since no external Perl interpreter has to be started.
Install mod_perl if you're installing the Apache web server and you'd like for it to directly incorporate a Perl interpreter.

mod_revocator.i686
The mod_revocator module retrieves and installs remote Certificate Revocate Lists (CRLs) into an Apache web server.

mod_ssl.i686
The mod_ssl module provides strong cryptography for the Apache Web server via the Secure Sockets Layer (SSL) and Transport Layer Security (TLS) protocols.

mod_wsgi.i686
The mod_wsgi adapter is an Apache module that provides a WSGI compliant interface for hosting Python based web applications within Apache. The adapter is written completely in C code against the Apache C runtime and for hosting WSGI applications within Apache has a lower overhead than using existing WSGI adapters for mod_python or CGI.

 

For removing Apache HTTP Server, we must remove all of the above packages.
In the terminal, execute the following command.

# yum remove httpd httpd-devel httpd-manual httpd-tools mod_auth_kerb mod_auth_mysql mod_auth_pgsql mod_authz_ldap mod_dav_svn mod_dnssd mod_nss mod_perl mod_revocator mod_ssl mod_wsgi
OPTIONS EXPLAINED

remove
Are used to remove the specified packages from the system as well as removing any packages which depend on the  package  being  removed. remove operates on groups, files, provides and filelists just like the "install" command.(See Specifying package names for more information)

We will get a detailed list of all packages along with their dependencies, ready to be removed. There will be also a [y/N] prompt, asking permission to continue.
NOTE: Repository information has been stripped from the below output.

========================================================================================
 Package            Arch        Version             Size
========================================================================================
Removing:
 httpd              i686        2.2.15-15.el6.centos.1      2.8 M
 httpd-devel            i686        2.2.15-15.el6.centos.1      525 k
 httpd-manual           noarch      2.2.15-15.el6.centos.1      3.5 M
 httpd-tools            i686        2.2.15-15.el6.centos.1      128 k
 mod_auth_kerb          i686        5.4-9.el6           61 k
 mod_auth_mysql         i686        1:3.0.0-11.el6_0.1      46 k
 mod_auth_pgsql         i686        2.0.3-10.1.el6          55 k
 mod_authz_ldap         i686        0.26-15.el6         189 k
 mod_dav_svn            i686        1.6.11-7.el6            161 k
 mod_dnssd          i686        0.6-2.el6           47 k
 mod_nss            i686        1.0.8-15.el6            218 k
 mod_perl           i686        2.0.4-10.el6            6.0 M
 mod_revocator          i686        1.0.3-9.el6         255 k
 mod_ssl            i686        1:2.2.15-15.el6.centos.1    181 k
 mod_wsgi           i686        3.2-1.el6           166 k
Removing for dependencies:
 gnome-user-share       i686        2.28.2-3.el6            1.1 M
 ipa-server         i686        2.2.0-16.el6            3.6 M
 ipa-server-selinux         i686        2.2.0-16.el6            55 k
 mailman            i686        3:2.1.12-17.el6         34 M
 perl-Frontier-RPC      noarch      0.07b4p1-9.el6          62 k
 webalizer          i686        2.21_02-3.3.el6         329 k

Transaction Summary
=========================================================================================
Remove       21 Package(s)

Installed size: 54 M
Is this ok [y/N]:

 

If we remove Apache HTTP Server packages, the dependency packages will also be removed. That is a loss we have to take. The yum descriptions for dependency packages are given below.

gnome-user-share.i686
gnome-user-share is a small package that binds together various free software projects to bring easy to use user-level file sharing to the masses.
The program is meant to run in the background when the user is logged in, and when file sharing is enabled a webdav server is started that shares the $HOME/Public folder. The share is then published to all computers on the local network using mDNS/rendezvous, so that it shows up in the Network location in GNOME.
The program also allows to share files using ObexFTP over Bluetooth.

ipa-server.i686
IPA is an integrated solution to provide centrally managed Identity (machine, user, virtual machines, groups, authentication credentials), Policy (configuration settings, access control information) and Audit (events, logs, analysis thereof). If you are installing an IPA server you need to install this package (in other words, most people should NOT install this package).

ipa-server-selinux.i686
IPA is an integrated solution to provide centrally managed Identity (machine, user, virtual machines, groups, authentication credentials), Policy (configuration settings, access control information) and Audit (events, logs, analysis thereof). This package provides SELinux rules for the daemons included in ipa-server

mailman.i686
Mailman is software to help manage email discussion lists, much like Majordomo and Smartmail. Unlike most similar products, Mailman gives each mailing list a webpage, and allows users to subscribe, unsubscribe, etc. over the Web. Even the list manager can administer his or her list entirely from the Web. Mailman also integrates most things people want to do with mailing lists, including archiving, mail <-> news gateways, and so on.
Documentation can be found in: /usr/share/doc/mailman-2.1.12
When the package has finished installing, you will need to perform some additional installation steps, these are described in: /usr/share/doc/mailman-2.1.12/INSTALL.REDHAT

perl-Frontier-RPC.noarch
Frontier::RPC implements UserLand Software's XML RPC (Remote Procedure Calls using Extensible Markup Language).  Frontier::RPC includes both a client module for making requests to a server and several server modules for implementing servers using CGI, Apache, and standalone with HTTP::Daemon.

webalizer.i686
The Webalizer is a Web server log analysis program. It is designed to scan Web server log files in various formats and produce usage statistics in HTML format for viewing through a browser. It produces professional looking graphs which make analyzing when and where your Web traffic is coming from easy.

 

Type y and press Enter to continue. All the Apache HTTP Server packages along with their dependencies will be removed from the system.

 

2) Removing Apache User and Group
Apache HTTP Server runs under the user and group, both named apache. The default home directory of user apache is /var/www/. It is provided by the package httpd.i686. Despite the package being removed, the directory is still there. Let us remove the user and group along with the home directory.
In the terminal, execute the following command.

# userdel -r apache
OPTIONS EXPLAINED

-r
Files in the user's home directory will be removed along with the home directory itself and the user's mail spool. Files located in other file systems will have to be searched for and deleted manually.

We will get the following error.

ERROR: userdel: /var/www not owned by apache, not removing

The user and group has been removed. Only thing remaining is the directory /var/www/. Let us remove it manually.
In the terminal, execute the following command.

# rm -rfv /var/www
OPTIONS EXPLAINED

-r
remove directories and their contents recursively

-f
ignore nonexistent files, never prompt

-v
explain what is being done

 

3) Removing extra files
We had removed the package httpd.i686. But the directories /etc/httpd/ and /usr/lib/httpd/ provided by it still exists. Let us remove them manually.
In the terminal, execute the following commands.

# rm -rfv /etc/httpd
# rm -rfv /usr/lib/httpd
OPTIONS EXPLAINED

-r
remove directories and their contents recursively

-f
ignore nonexistent files, never prompt

-v
explain what is being done

 

 

 

rm -rfv /var/www

Source: Removing Apache HTTP Server – How to LAMP

Leave a Reply