LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-23-2013, 09:56 AM   #1
Juc1
Member
 
Registered: Sep 2011
Location: UK
Posts: 78

Rep: Reputation: 0
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
$
 
Old 05-23-2013, 10:01 AM   #2
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 6,300

Rep: Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720
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.
 
Old 05-23-2013, 10:24 AM   #3
Juc1
Member
 
Registered: Sep 2011
Location: UK
Posts: 78

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by 273 View Post
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...
 
Old 05-23-2013, 10:31 AM   #4
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 6,300

Rep: Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720
If you run the following it will tell you whether there is an apache instance still running:
Code:
ps -A |grep apache
 
Old 05-23-2013, 10:43 AM   #5
Juc1
Member
 
Registered: Sep 2011
Location: UK
Posts: 78

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by 273 View Post
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...

Last edited by Juc1; 05-23-2013 at 10:48 AM.
 
Old 05-23-2013, 01:19 PM   #6
tux111
Member
 
Registered: Oct 2012
Location: Germany
Distribution: Xubuntu
Posts: 64

Rep: Reputation: Disabled
Are any other apache packages still installed?

dpkg -l | grep apache
 
Old 05-23-2013, 01:24 PM   #7
Juc1
Member
 
Registered: Sep 2011
Location: UK
Posts: 78

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by tux111 View Post
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...

Last edited by Juc1; 05-23-2013 at 01:46 PM.
 
Old 05-23-2013, 02:07 PM   #8
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,131
Blog Entries: 2

Rep: Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833
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.
 
Old 05-23-2013, 02:13 PM   #9
Juc1
Member
 
Registered: Sep 2011
Location: UK
Posts: 78

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by TobiSGD View Post
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...
 
Old 05-23-2013, 03:41 PM   #10
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,131
Blog Entries: 2

Rep: Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833
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.
 
Old 05-24-2013, 02:57 AM   #11
bloodstreetboy
Member
 
Registered: May 2012
Posts: 198
Blog Entries: 3

Rep: Reputation: 37
As TobiSGD said
Quote:
Originally Posted by TobiSGD View Post
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.
 
Old 05-24-2013, 05:01 AM   #12
Juc1
Member
 
Registered: Sep 2011
Location: UK
Posts: 78

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bloodstreetboy View Post

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...
 
Old 05-24-2013, 05:11 AM   #13
bloodstreetboy
Member
 
Registered: May 2012
Posts: 198
Blog Entries: 3

Rep: Reputation: 37
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.

Last edited by bloodstreetboy; 05-24-2013 at 05:13 AM.
 
Old 05-24-2013, 05:19 AM   #14
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 6,300

Rep: Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720Reputation: 1720
Quote:
Originally Posted by Juc1 View Post
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to remove GRUB2 & Ubuntu from MacBook Pro with Windows 7, Ubuntu and OS X? lupusarcanus Linux - Newbie 8 07-18-2010 07:38 PM
remove gnome-desktop ubuntu and strictly use lxde ubuntu 9.04 Jaunty Polanski Linux - Software 1 05-07-2009 02:53 PM
remove apache second install wisdom Linux - Software 2 11-21-2006 05:30 PM
Anyone know how to remove Apache from Mandrake 9.1 ? RIOMX Linux - Software 1 11-06-2003 10:10 AM
Remove apache2, keep apache 1.3 jermo5 Linux - Software 0 08-05-2003 10:37 AM


All times are GMT -5. The time now is 10:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration