LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Remove Apache (Ubuntu 12.04) (https://www.linuxquestions.org/questions/linux-newbie-8/remove-apache-ubuntu-12-04-a-4175463158/)

Juc1 05-23-2013 08:56 AM

Remove Apache (Ubuntu 12.04)
 
Hi all,

I want to remove Apache2 so I can try nginx instead. I did $ apt-get remove apache2.

$ aptitude show apache2 then says state: not installed but other things (see below) suggest that apache is still installed and most strangely the IP address still resolves in the browser with

Quote:

It works!

This is the default web page for this server.

The web server software is running but no content has been added, yet.

Any ideas please for what more I need to do to remove apache?

Thanks...


Code:

$ apt-get remove apache2

Reading package lists... 0%

Reading package lists... 100%

Reading package lists... Done


Building dependency tree... 0%

Building dependency tree... 0%

Building dependency tree... 50%

Building dependency tree... 50%

Building dependency tree     


Reading state information... 0%

Reading state information... 98%

Reading state information... Done

The following packages will be REMOVED:
  apache2
0 upgraded, 0 newly installed, 1 to remove and 43 not upgraded.
After this operation, 29.7 kB disk space will be freed.
Do you want to continue [Y/n]? y


(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 53987 files and directories currently installed.)
Removing apache2 ...
$

$ aptitude show apache2
Package: apache2
State: not installed
Version: 2.2.22-1ubuntu1.3
Priority: optional
Section: web
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Uncompressed Size: 29.7 k
Depends: apache2-mpm-worker (= 2.2.22-1ubuntu1.3) | apache2-mpm-prefork (=
        2.2.22-1ubuntu1.3) | apache2-mpm-event (= 2.2.22-1ubuntu1.3) |
        apache2-mpm-itk (= 2.2.22-1ubuntu1.3), apache2.2-common (=
        2.2.22-1ubuntu1.3)
Conflicts: apache2
Provided by: apache2-mpm-event, apache2-mpm-itk, apache2-mpm-prefork,
            apache2-mpm-worker
Description: Apache HTTP Server metapackage
 The Apache Software Foundation's goal is to build a secure, efficient and
 extensible HTTP server as standards-compliant open source software. The result
 has long been the number one web server on the Internet.

 It features support for HTTPS, virtual hosting, CGI, SSI, IPv6, easy scripting
 and database integration, request/response filtering, many flexible
 authentication schemes, and more.
Homepage: http://httpd.apache.org/

$ apache2 -v
Server version: Apache/2.2.22 (Ubuntu)
Server built:  Mar  8 2013 15:53:13
$ pwd
/

$ find . -name "apache2*"
./var/log/apache2
./var/cache/apache2
./var/lib/update-rc.d/apache2
./var/lib/dpkg/info/apache2-doc.postinst
./var/lib/dpkg/info/apache2.2-bin.list
./var/lib/dpkg/info/apache2-doc.conffiles
./var/lib/dpkg/info/apache2.2-common.postinst
./var/lib/dpkg/info/apache2-mpm-prefork.prerm
./var/lib/dpkg/info/apache2.2-common.list
./var/lib/dpkg/info/apache2-doc.list
./var/lib/dpkg/info/apache2-utils.md5sums
./var/lib/dpkg/info/apache2-mpm-prefork.postinst
./var/lib/dpkg/info/apache2.2-common.preinst
./var/lib/dpkg/info/apache2-mpm-prefork.preinst
./var/lib/dpkg/info/apache2.2-common.md5sums
./var/lib/dpkg/info/apache2.2-common.postrm
./var/lib/dpkg/info/apache2-doc.md5sums
./var/lib/dpkg/info/apache2-mpm-prefork.md5sums
./var/lib/dpkg/info/apache2.2-common.conffiles
./var/lib/dpkg/info/apache2-mpm-prefork.list
./var/lib/dpkg/info/apache2.2-bin.md5sums
./var/lib/dpkg/info/apache2-utils.list
./etc/apache2
./etc/apache2/conf.d/apache2-doc
./etc/apache2/apache2.conf
./etc/logrotate.d/apache2
./etc/init.d/apache2
./etc/bash_completion.d/apache2.2-common
./etc/php5/apache2
./etc/default/apache2
./etc/ufw/applications.d/apache2.2-common
./run/apache2.pid
./run/apache2
./run/lock/apache2
./usr/share/lintian/overrides/apache2-mpm-prefork
./usr/share/lintian/overrides/apache2.2-common
./usr/share/doc/apache2.2-bin
./usr/share/doc/apache2-utils
./usr/share/doc/apache2-doc
./usr/share/doc/apache2-mpm-prefork
./usr/share/doc/apache2.2-common
./usr/share/doc/apache2.2-common/examples/apache2.monit
./usr/share/doc/apache2.2-common/examples/apache2
./usr/share/doc/apache2.2-common/examples/apache2/apache2.conf.gz
./usr/share/doc-base/apache2-manual
./usr/share/apache2
./usr/share/man/man8/apache2.8.gz
./usr/share/man/man8/apache2ctl.8.gz
./usr/share/apport/package-hooks/apache2.py
./usr/share/bug/apache2-mpm-prefork
./usr/share/bug/apache2.2-common
./usr/lib/apache2
./usr/lib/apache2/mpm-prefork/apache2
./usr/lib/apache2/mpm-worker/apache2
./usr/lib/apache2/mpm-event/apache2
./usr/lib/apache2/mpm-itk/apache2
./usr/sbin/apache2
./usr/sbin/apache2ctl
$


273 05-23-2013 09:01 AM

Have you stopped the running Apache instance on the machine? I would expect removing it to stop the daemon but it's possible it's still running for some reason. Also, if you want to remove everything related to apache2 you should probably run apt-get purge apache2 which will remove config files and the example page.
There's also the possibility that the browser you're looking at the test page in has it cached, so it's worth refreshing the page just in case.

Juc1 05-23-2013 09:24 AM

Quote:

Originally Posted by 273 (Post 4957238)
Have you stopped the running Apache instance on the machine? I would expect removing it to stop the daemon but it's possible it's still running for some reason. Also, if you want to remove everything related to apache2 you should probably run apt-get purge apache2 which will remove config files and the example page.
There's also the possibility that the browser you're looking at the test page in has it cached, so it's worth refreshing the page just in case.

I don't think it is cache thing because I have tried different browsers. Is there a command to display what daemons are running?

Thanks...

273 05-23-2013 09:31 AM

If you run the following it will tell you whether there is an apache instance still running:
Code:

ps -A |grep apache

Juc1 05-23-2013 09:43 AM

Quote:

Originally Posted by 273 (Post 4957262)
If you run the following it will tell you whether there is an apache instance still running:
Code:

ps -A |grep apache

I get some output from this in Debian but in my two Ubuntus there is no output and one of these Ubuntus I know for sure is running Apache. So this command does not seem to work with Ubuntu. :(

Thanks...

tux111 05-23-2013 12:19 PM

Are any other apache packages still installed?

dpkg -l | grep apache

Juc1 05-23-2013 12:24 PM

Quote:

Originally Posted by tux111 (Post 4957390)
Are any other apache packages still installed?

dpkg -l | grep apache

Code:

$ dpkg -l | grep apache
ii  apache2-doc                          2.2.22-1ubuntu1.3            Apache HTTP Server documentation
ii  apache2-mpm-prefork                  2.2.22-1ubuntu1.3            Apache HTTP Server - traditional non-threaded model
ii  apache2-utils                        2.2.22-1ubuntu1.3            utility programs for webservers
ii  apache2.2-bin                        2.2.22-1ubuntu1.3            Apache HTTP Server common binary files
ii  apache2.2-common                    2.2.22-1ubuntu1.3            Apache HTTP Server common files
ii  libapache2-mod-perl2                2.0.5-5ubuntu1              Integration of perl with the Apache2 web server
ii  libapache2-mod-php5                  5.3.10-1ubuntu3.6            server-side, HTML-embedded scripting language (Apache 2 module)
$

Does that help? Thanks...

TobiSGD 05-23-2013 01:07 PM

The package apache2 is a metapackage that is used to install the bunch of packages you see installed on your machine. Removing it will not remove those dependencies, you have to either remove them manually or use the autoremove function of apt-get. Be careful with that function and check twice which packages it want to remove.

Juc1 05-23-2013 01:13 PM

Quote:

Originally Posted by TobiSGD (Post 4957421)
The package apache2 is a metapackage that is used to install the bunch of packages you see installed on your machine. Removing it will not remove those dependencies, you have to either remove them manually or use the autoremove function of apt-get. Be careful with that function and check twice which packages it want to remove.

Just to back up I want to install nginx so I want to remove anything that might interfere with nginx so then what do I need to remove?

Thanks...

TobiSGD 05-23-2013 02:41 PM

I would delete all packages that are shown by the command in post 7, if one of them is necessary for nginx (which I doubt, but don't know) installing nginx will just reinstall it.

bloodstreetboy 05-24-2013 01:57 AM

As TobiSGD said
Quote:

Originally Posted by TobiSGD (Post 4957421)
The package apache2 is a metapackage that is used to install the bunch of packages you see installed on your machine. Removing it will not remove those dependencies,

That exactly happens.

If you want to remove it completely, run
Code:

$ sudo apt-get remove --purge apache2 apache2-utils
$ sudo apt-get remove --purge apache2 apache2-utils apache2.2-bin apache2-common
$ sudo apt-get autoremove

If you still see apache2 directory in /etc, it doesn't mean apache2 is still there, you can see inside there is no conf file of apache2.
You can remove this directory too. It will not harm your system.
Code:

$ sudo rm -Rf /etc/apache2 /usr/lib/apache2 /usr/include/apache2
When you will install apache2 again, it will be created automatically.

Juc1 05-24-2013 04:01 AM

Quote:

Originally Posted by bloodstreetboy (Post 4957816)

If you want to remove it completely...

Sorry for being dumb but I know that in my Windows desktop there is a difference between an installer file such as exampleprogram.exe and the program itself - so I can download the installer file exampleprogram.exe but I think this file just sits there and does nothing until I execute the installation. Then if later I want to uninstall this program I don't need to remove exampleprogram.exe because exampleprogram.exe in itself does nothing (until I execute it). So is there a similar distinction with my Apache package files?

Thanks...

bloodstreetboy 05-24-2013 04:11 AM

Ok,I think I understand what you want.
If you do not want to remove using command line and want uninstaller.exe option.
use synaptic package manager.

Open synaptic package manager.
or you can open it through command line, just run
Quote:

$ synaptic
If you do not have, install it
Quote:

$ sudo apt-get install synaptic
Now open it,
search apache2. right click on the packages and select "removal" option.
Now click on apply.
Now packages will be removed.

273 05-24-2013 04:19 AM

Quote:

Originally Posted by Juc1 (Post 4957922)
Sorry for being dumb but I know that in my Windows desktop there is a difference between an installer file such as exampleprogram.exe and the program itself - so I can download the installer file exampleprogram.exe but I think this file just sits there and does nothing until I execute the installation. Then if later I want to uninstall this program I don't need to remove exampleprogram.exe because exampleprogram.exe in itself does nothing (until I execute it). So is there a similar distinction with my Apache package files?

Thanks...

Not exactly.
With Debian-based Linux (and some others) there is a package manager which allows you to install a program and all its dependencies in one go just by selecting the program you want (either in the GUI or using something like apt-get). This is done by making one package depend upon another so when you install package A the package manager knows that package B is required for the functioning of package A so package B is installed also.
To aid with package installation there are also metapackages -- these are packages which are themselves empty but they depend upon several other packages which contain programs and libraries. A good example of this is kubuntu-desktop which installs all the necessary programs and libraries for the KDE desktop on Ubuntu so you don't have to work out which packages are needed. In some circumstances you may want to install the individual packages though, and you can do this. More on metapackages here:
https://help.ubuntu.com/community/MetaPackages


All times are GMT -5. The time now is 08:36 PM.