Saturday, December 13, 2008

Debian Linux apt-get package management

Package management tools:
[1] apt-get: advanced package tool.
[2] dpkg: Debian packaging tool.
[3] GUI tools: aptitude(a text-based interface) & synaptic(GUI front end)

# apt-get remove {package-name}
apt-get remove the package but keep the configuration files
# apt-get --purge remove {package-name}
apt-get remove the package and configuration file
# dpkg --info {package-name.deb}
get package information such as description of package, version etc.
# dpkg -l {package-name}
list all installed packages or individual package
# dpkg -L {package-name}
list files provided (or owned) by the installed package
# dpkg --contents {package-name.deb}
list files provided (or owned) by the package
# dpkg -S {/path/to/file}
find what package owns the file
# dpkg -s {package-name} | grep Status
find out if package is installed or not (status)
# apt-cache depends {package-name}
display a listing of each dependency a package has and all the possible other packages that can fulfill that dependency.
# apt-get source {package-name}
downloads the source code to the stated package
# apt-get build-dep {package-name}
to build a package from a source file


To configure your system, you need to setup your source.list file which is located in /etc/apt/sources.list. You can add any repository that you like, a good list of third-party sources is available on http://www.apt-get.org.

When you install a package APT retrieves the needed files from the hosts listed in /etc/apt/sources.list, stores them in a local repository(/var/cache/apt/archives/), and then proceeds with installation. apt-get clean removes everything except lock files from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/. Thus, if you need to reinstall a package APT should retrieve it again. apt-get autoclean removes only package files that can no longer be downloaded.

No comments: