How to uninstall apache2 in ubuntu

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

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
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,480 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,770 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,094 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,220 points
2,832 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,220 points
1,227 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 in Linux Administration by Omkar
• 69,220 points
1,342 views
+1 vote
1 answer
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,202 views
0 votes
1 answer

How to extract file base name without path and extension in bash?

You don't actually have to call the ...READ MORE

answered May 31, 2019 in Linux Administration by Shubham
• 13,490 points
6,017 views
0 votes
2 answers

How to change IP address of an Ubuntu VM?

The easiest method is through network manager: 1- ...READ MORE

answered Aug 25, 2020 in Linux Administration by Pistle
• 300 points
14,802 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP