Tuesday, April 15, 2008

Package Management in Debian Linux

To manage packages in Debian Linux you have 3 tools: dpkg, apt-get and aptitude.
Here are some useful command to manage packages under Debian linux using those tools.


Install ftpd FTP server on Debian
---------------------------------------------
apt-get install ftpd


Remove a package from Debian
--------------------------------------------
apt-get remove ftpd


Do not install only simulate package installation on Debian
--------------------------------------------
apt-get -s ftpd


Install and remove a Debian package using dpkg
------------------------------------------------------------------
Install:
dpkg -i ftpd

Remove:
dpkg -r ftpd


2. Find files from ftpd package on Debian
--------------------------------------------------------
dpkg -L ftpd


Search for a package from Debian installed packages
----------------------------------------------------------------------------
dpkg -l | grep ftpd

To list all packages use:

dpkg -l


Resynchronize the package index file from sources
-----------------------------------------------------------------------
(index is fetched from location listed in /etc/apt/sources.list)

apt-get update


Upgrade Debian packages after you've run an update
------------------------------------------------------------------------

apt-get upgrade


Search for a package in cache
-----------------------------------------

apt-cache search net-tools


Find to which package belongs a file in Debian
------------------------------------------------------------------
Find complete path of netstat:

whereis netstat

You will get:

netstat: /bin/netstat /usr/share/man/man8/netstat.8.gz

Then type following command using complete path for file

dpkg -S /bin/netstat

You will get:
net-tools: /bin/netstat

(net-tools is the package name).


Get info about a package in Debian
--------------------------------------------------

dpkg -s net-tools


List packages from cache dir
----------------------------------------

 ls /var/cache/apt/archives/


Remove all files from packages cache
----------------------------------------------------

apt-get clean


Manage packages in Debian with aptitude
---------------------------------------------------------
aptitude install ftpd
- will install ftpd package
aptitude remove ftpd - will remove ftpd package
aptitude update - will update packages  index
aptitude seach ftpd - will search for ftpd package
aptitude download ftpd - will download ftpd package in current directory

No comments: