How to completely remove an application as well as the configuration files?

Jason Wilson jwilson at noosaj.com
Sun Sep 7 23:30:53 UTC 2008



On Sun, 7 Sep 2008, Ashley Benton wrote:

> On Sun, Sep 7, 2008 at 6:12 PM, Jason Wilson <jwilson at noosaj.com> wrote:
>
>>
>>
>> On Sun, 7 Sep 2008, Ashley Benton wrote:
>>
>>> On Sun, Sep 7, 2008 at 5:44 PM, Leonard Chatagnier
>>> <lenc5570 at sbcglobal.net>wrote:
>>>
>>>>
>>>> --- Ashley Benton <chuaukantli at gmail.com> wrote:
>>>>
>>>>> Hi,
>>>>> I am trying to install apache2, php5, and my sql and
>>>>> I messed up somewhere.
>>>>> Apache was working but stopped when I tried to use
>>>>> ssl. After hours of
>>>>> trying to find where I messed up I wanted to remove
>>>>> apache2 and reinstall
>>>>> it. My problem is sudo apt-get remove apache2 then
>>>>> sudo apt-get install
>>>>> apache2 reinstall apache 2 like it was and doesn't
>>>>> delete my configuration
>>>>> files. I tried sudo apt-get purge apache 2 but
>>>>> apache 2 is still here the
>>>>> way I configured it. What could I do to completely
>>>>> uninstall apache2 and
>>>>> reinstall it with its original configuration files?
>>>>> By doing ls -l I found some file like that :"books~"
>>>>> I am guessing that some
>>>>> files that were saved after a crash but I don't know
>>>>> how to open them. They
>>>>> should be in my home directory but are not (or at
>>>>> least I can't see them)
>>>>> How can I open them and delete them? I tried
>>>>> lost+found but it wasn't there
>>>>> neither.
>>>>> Your help would be appreciated
>>>>> Thank you
>>>>> Meg
>>>> sudo aptitude purge <pkgname> should do it. I don't
>>>> know for sure about apt-get but I think it's something
>>>> like sudo apt-get remove --purge <pkgname>.  Either
>>>> should remove the conf files but if not for some
>>>> unknown reason you could do locate apache and remove
>>>> any related files manually using the rm command or
>>>> better still use the mv command so you could retrieve
>>>> them if needed.
>>>> HTH,
>>>>
>>>> Leonard Chatagnier
>>>> lenc5570 at sbcglobal.net
>>>
>>>
>>> Thank you for your answer. I tried apt-get remove --purge and it told me
>>> 'Package apache2 is not installed', so not removed' Now I am completely
>> lost
>>> because ls -l /etc/apache2 list me:
>>> -apache2.conf, -conf.d, -envars, -httpd.conf, -mods-available,
>>> -mods-enabled, -ports.conf, -sites-available, -sites-enabled, -ssl
>>> Why can I see the files and directories with ls -l /etc/apache2 if it is
>> not
>>> installed? I thought that ls -l would show me only what is installed, am
>> I
>>> wrong?
>>> Thanks
>>> Meg
>>
>> Obviously you tried the --purge option _after_ you uninstalled it. Am I
>> not correct? Any time you would like to completely remove software, you
>> can either use your package manager to completely remove it, or you can
>> use the --purge option with your apt command. The ls -l command lists
>> contents in the directory you are currently working in or the directory in
>> which you specify for ls to look in. ls -l doesn't _show_ you everything,
>> ls -a does; however, the uninstallation didn't completely remove
>> everything. Perhaps you could try reinstalling apache, then use the purge
>> option to completely remove it, then reinstall it, _or_ you could just
>> sudo rm everything.
>>
>> Jason
>
>
> It is possible that you are right. So I tried sudo apt-get install apache2
> then apt-get remove --purge apache2 as well as aptitude purge apache2 (after
> reinstalling between the two operations) then well as dpkg -P.
> Each time sudo /etc/init.d/apache2 restart apache 2 which is not installed
> is working!
> Is there a reason why it is working when it should have been removed (Did it
> installed twice or more times and removed one of them?)
> Now it seems that apache 2 is working with my configuration files as I
> modified  them but I'd like to understand why I can't uninstall it from the
> command line! Oh I forgot it is working but not installed! How is it
> possible?
>
> Meg
>

How this happened, I'm not quite sure. I don't *think* Linux installs more 
than one installation of a program, in the way that Windows does. However, 
I also don't understand why apt-get --purge didn't completely remove 
everything, including configuration files and others. Can somebody 
enlighten us as to how/why this happened? Perhaps you do have two 
instances of apache2 installed and only one was removed. You could always 
test-drive this theory and see if it is, in fact, right or wrong.

Jason




More information about the ubuntu-users mailing list