Datasheet

89
Chapter 4 Software Management
Removing and Purging Packages
In Debian, great pains are taken to ensure that configuration data is kept intact.
When a package is simply removed, its configuration files and data are left in place
in case you ever want to reinstall the package. To tell the packaging system to
remove the configuration files too (so that the next time you install the package you
get the default configuration), you need to purge the package.
Removing and purging packages using apt-get
Once again, apt-get is a quite simple way to solve this problem. Simply run apt-
get remove packagename
, and it will remove the package. Remove vim, as seen in
the following session:
hostname:~# apt-get remove vim
Reading Package Lists... Done
Building Dependency Tree... Done
The following packages will be REMOVED:
vim
0 packages upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0B of archives. After unpacking 12.2MB will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 7567 files and directories currently installed.)
Removing vim ...
dpkg - warning: while removing vim, directory `/etc/vim’ not empty so not
removed.
hostname:~#
apt-get will always ask you before it removes a package. You’ll note that dpkg
issued a warning saying that it wasn’t able to remove a directory /etc/vim/
because it wasn’t empty. That’s not surprising, since you just removed the package
instead of purging it thus
vims configuration files remain. To purge a package,
pass
apt-get the --purge option:
hostname:~# ls /etc/vim/
vimrc
hostname:~# apt-get --purge remove vim
Reading Package Lists... Done
Building Dependency Tree... Done
The following packages will be REMOVED:
vim*
0 upgraded, 0 newly installed, 1 to remove and 61 not upgraded.
Need to get 0B of archives.
After unpacking 1700kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 17629 files and directories currently installed.)
Removing vim ...
09_576445 ch04.qxd 7/5/05 3:10 PM Page 89