How to uninstall apache2 in ubuntu

+1 vote
How do I uninstall Apache2 on ubuntu?
May 13, 2019 in Linux Administration by Laksha
284,138 views
How do I uninstall Apache2 on ubuntu?

3 answers to this question.

+1 vote

Hey @Laksha, execute the following commands:

$ sudo service apache2 stop
$ sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
$ sudo apt-get autoremove
$ whereis apache2
apache2: /etc/apache2
$ sudo rm -rf /etc/apache2

answered May 14, 2019 by Hemant
Help. Uninstall service the apache 2,0
its nice and help full for me

Thanking you
0 votes

Follow these steps to remove the apache2 service using Terminal:

  1. First stop the apache2 service if it is running with: sudo service apache2 stop
  2. Now remove and clean up all the apache2 packages with:

    sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
    //or 
    sudo apt-get purge apache2 apache2-utils apache2-bin apache2.2-common
    
  3. Finally, run sudo apt-get autoremove just in case any other cleanup in needed

You can do the following two tests to confirm apache has been removed:

  1. which apache2 - should return a blank line
  2. sudo service apache2 start - should return apache2: unrecognized service
answered Dec 14, 2020 by Roshni
• 10,440 points
0 votes

apache2 is a meta package that just selects other packages. If you installed apache by installing that package, you just need to run this to clean up the automatically selected packages:

sudo apt autoremove

If that doesn't work, you might have installed one of the dependents manually. You can target all the apache2- packages from space and nuke the lot:

sudo apt remove apache2.*

For future reference, to find out which package a binary is from, you can run this:

dpkg -S `which apache2`

I'd expect that to come back with apache2.2-bin (at the time of writing).

answered Dec 14, 2020 by Gitika
• 65,730 points

Related Questions In Linux Administration

0 votes
1 answer

How to increase Swap Memory in CentOS 7?

Follow the below steps and procedures: Prerequisites Must have ...READ MORE

answered Oct 5, 2018 in Linux Administration by Frankie
• 9,830 points
16,621 views
–1 vote
1 answer

How to get octal file permission in linux?

You can use this: stat -c "%a %n" ...READ MORE

answered Jan 3, 2019 in Linux Administration by Omkar
• 69,180 points
3,472 views
0 votes
1 answer

How to take input from user in bash script?

You can use if-else branch to check ...READ MORE

answered Jan 31, 2019 in Linux Administration by Omkar
• 69,180 points
1,554 views
0 votes
1 answer

How to create a symlink in Linux?

To create a symbolic link, you can ...READ MORE

answered Feb 1, 2019