Learn dpkg, the package manager for Debian – Part One
Dear linux geek,
In this tutorial I will try to teach you how to use the the dpkg package manager for Debian, a tool that is used to install, build, remove and manage packages in debian or debian based systems.
This tutorial is for people that like to work from the command line because dpkg itself is controlled entirely via command line parameters.
For people that don’t know, a command line parameter consists of exactly one action and zero or more options. By learning the command line parameters of dpkg you can control the Debian package manager, tell it what to do and control the behaviour of its actions.
I use the dpkg tool to install .deb files in my Ubuntu machine, but unlike apt it does not automatically download packages and install their dependencies.
For me, dpkg is very useful when I need to install standalone deb files in my machine. But, what command is used to install .deb files with the dpkg Debian package manager?
Use the -i or –install long option to install the package in your Debian based system. You can also specify a directory with the –recursive option.
sudo dpkg -i package-name
The following command does the same thing.
sudo dpkg --install package-name
The dpkg utility can be used to list the installed packages on your system. The -l option can help you with that. Run the following command and watch the output displayed in your terminal.
The following command lists all packages installed on your system.
Make sure to run every command shown in this article with superuser privilege. The above command will not work and the output shown below will be printed on your terminal screen.
dpkg: error: requested operation requires superuser privilege
But the following works.
sudo dpkg -l
I have so many packages installed on my Ubuntu 12.04 LTS machine that the amount of output generated by the dpkg -l command is so big it will take one hour to read.
If you want to get information if a specific package installed on your system or not you can use piping which is used to combine command together in order to create more complex and useful commands.
The following combination is used to send the output of the dpkg -l command to the grep command. The grep utility is used to print lines matching a pattern.
sudo dpkg -l | grep zip
After running the above command I get the output shown below.
ii bzip2 1.0.6-1 high-quality block-sorting file compressor - utilities ii gzip 1.4-1ubuntu2 GNU compression utilities ii libzip2 0.10-1ubuntu1 library for reading, creating, and modifying zip archives (runtime) ii p7zip-full 9.20.1~dfsg.1-4 7z and 7za file archivers with high compression ratio ii unzip 6.0-4ubuntu2 De-archiver for .zip files ii zip 3.0-4 Archiver for .zip files
How can you uninstall a package by using the dpkg tool? The following command is used to uninstall a package, but it is not recommended.
sudo dpkg -r package-name
If you want to uninstall packages by using the dpkg command line utility you risk to damage your system because dpkg does not handle dependencies.
I have alot of experience with this tool. I have broken many installed packages on my system by using the debian package manager.
For example, if you uninstall python on your machine packages that depend on it will be broken. Use the apt-get command line for uninstalling packages on your own system.
The following command will take care of dependencies.
sudo apt-get remove package-name
The apt-get remove command will create a dependency tree and will warn you about the packages that will be removed. In the next part we will take a deep journey into dpkg and learn more complex stuff.
Like us on Facebook
We need your assistance to stay live
This week Top Posts
- Top Things To Do After Installing Ubuntu 13.10 'Saucy Salamander' : Ubuntu 13.10 Saucy Salamander will be released on coming October 17th with many new salient featur...0 comments |
- How To Upgrade From Ubuntu 13.04 Raring To Ubuntu 13.10 Saucy Salamander : Ubuntu 13.10 Saucy will be released on October 17th. Hope it will come with lot of improvements and ...0 comments |
- Install LAMP Server (Apache, MySQL or MariaDB, PHP) On Ubuntu 13.10 : Updated January 12, 2014 LAMP is a combination of operating system and open-source software stack. ...0 comments |
- Install lamp with 1 command in Ubuntu 12.10, 13.04 Raring Ringtail & LinuxMint13 : Updated: 10/09/2012 :LAMP (Linux, Apache, MySQL and PHP) is an open source Web development platform ...0 comments |
- DNS Server Installation Step by Step Using CentOS 6.5/6.4/6.3 : DNS, Domain Name System, translates hostnames or URLs into IP addresses. For example if we type www....0 comments |
- How to Install uTorrent Client on Ubuntu/Debian/Linux Mint : uTorrent is a lightweight and efficient BitTorrent client for Linux, Windows OS and Mac OS. The inst...0 comments |
- Fedora 21 Scheduled For Release In October
- Install Uget Download Manager In Ubuntu, Fedora, Debian
- Download Elementary OS ‘Luna’ Official Wallpapers
- Install Power Commands 0.1.5 On Ubuntu 14.04/13.10/12.10/12.04
- 5 Android Apps that’s Going to Make Running Your Business Less Stressful
- Puppet agent Install Using Script
- Install Corosync and Pacemaker On CentOS 6.5
- Install Fail2Ban On Ubuntu Server 13.04/13.10
- How To Install Google Chrome in Fedora 20, 19, 18
- How to surf using Tor Browser Bundle
This work by unixmen.com is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Copyright © 2008-2013 Unixmen.com .