Friday, March 23, 2012

Linux 7 - Debian Package Management

  • dpkg
  • dpkg-reconfigure
  • APT
    • apt-get, apt-cache
    • configuration
  • aptitude

dpkg

-i, –-install install packagename.deb
-l, –-list list all of the packages or specified
-L, -–listfiles show files that are installed by a package
-P, --purge will remove the program and configurations
-p, --print detailed information
-r, --remove only removes program
-S, --search displays package supplying file
  • - stands for “depackager”
  • - was designed for installing debian (*.deb) install files in Debian based operatiing systems
  • - not as used now but still around
dpkg –l (lists information about a package)
root@debian:~# dpkg -l bluefish
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name            Version         Description
+++-===============-===============-============================================
ii  bluefish        2.0.1-1         advanced Gtk+ HTML editor
root@debian:~# 
ii – installed
version
short description
dpkg –p ( Display details about package-name, as found in /var/lib/dpkg/available.  )
root@debian:~# dpkg -p bluefish
Package: bluefish
Priority: optional
Section: web
Installed-Size: 644
Maintainer: Daniel Leidert (dale) 
Architecture: amd64
Version: 2.0.1-1
Depends: bluefish-data (= 2.0.1-1), bluefish-plugins (= 2.0.1-1), libc6 \\
(>= 2.3.4), libcairo2 (>= 1.2.4), libenchant1c2a (>= 1.6), libglib2.0-0 \\
(>= 2.24.0), libgtk2.0-0 (>= 2.16.0), libpango1.0-0 (>= 1.14.0), libxml2 \\
(>= 2.7.4), gvfs-backends
Suggests: bluefish-dbg, galeon | iceweasel | firefox | abrowser | seamonkey-browser \\ 
| mozilla-browser | www-browser, weblint-perl | weblint, libxml2-utils, php5-cli, tidy
Size: 245182
Description: advanced Gtk+ HTML editor
 Bluefish is a GTK+ HTML editor for the experienced web designer.
 Its features include nice wizards for startup, tables and frames; a
 fully featured image insert dialog; thumbnail creation and automatically
 linking of the thumbnail with the original image; and configurable HTML
 syntax highlighting.
 .
 For validation to work you need weblint and xmllint. For preview to work,
 you need a web browser that can view local files given to it
 on the command line.
Homepage: http://bluefish.openoffice.nl
root@debian:~# 
dpkg –i  ( Install  the  package )
Debian 6 64-bit-2012-03-11-01-11-05
ovidiucs@debian:~$ sudo dpkg -i webmin_1.580_all.deb 
[sudo] password for ovidiucs: 
Selecting previously deselected package webmin.
(Reading database ... 130597 files and directories currently installed.)
Unpacking webmin (from webmin_1.580_all.deb) ...
dpkg: dependency problems prevent configuration of webmin:
 webmin depends on libnet-ssleay-perl; however:
  Package libnet-ssleay-perl is not installed.
 webmin depends on libauthen-pam-perl; however:
  Package libauthen-pam-perl is not installed.
 webmin depends on libio-pty-perl; however:
  Package libio-pty-perl is not installed.
 webmin depends on apt-show-versions; however:
  Package apt-show-versions is not installed.
dpkg: error processing webmin (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 webmin
ovidiucs@debian:~$ 
dpkg does not take care of dependencies, these have to be installed first then install this package last, also when uninstalling the dependencies must be uninstalled first before the main package
It did not installed it properly but it still installed it in the database

dpkg -r, --remove
ovidiucs@debian:~$ sudo dpkg -r webmin
[sudo] password for ovidiucs: 
(Reading database ... 148015 files and directories currently installed.)
Removing webmin ...
ovidiucs@debian:~$ 
dpkg -L, --list
ovidiucs@debian:~$ dpkg -L bluefish
/.
/usr
/usr/share
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/bluefish.1.gz
/usr/share/pixmaps
/usr/share/pixmaps/bluefish.xpm
/usr/share/doc
/usr/share/doc/bluefish
/usr/share/doc/bluefish/copyright
/usr/share/doc/bluefish/AUTHORS
/usr/share/doc/bluefish/changelog.gz
/usr/share/doc/bluefish/changelog.Debian.gz
/usr/share/doc/bluefish/NEWS.Debian.gz
/usr/share/doc/bluefish/README
/usr/share/applications
/usr/share/applications/bluefish.desktop
/usr/share/menu
/usr/share/menu/bluefish
/usr/bin
/usr/bin/bluefish
ovidiucs@debian:~$ 
dpkg -S --search
ovidiucs@debian:~$ dpkg -S /sbin/ping
dpkg: /sbin/ping not found.
ovidiucs@debian:~$ dpkg -S /bin/ping
iputils-ping: /bin/ping
ovidiucs@debian:~$ dpkg -S /bin/ls
coreutils: /bin/ls
ovidiucs@debian:~$ dpkg -S /bin/cat
coreutils: /bin/cat
ovidiucs@debian:~$ dpkg -S /bin/bash
bash: /bin/bash
ovidiucs@debian:~$ 
dpkg-reconfigure
To  reconfigure  a  package which has already been configured, try the dpkg-reconfigure command instead.
              Configuring consists of the following steps:
              1. Unpack the conffiles, and at the same time back up  the  old  conf‐
              files, so that they can be restored if something goes wrong.
              2. Run postinst script, if provided by the package.
You must know package name
It can walk you back to the original configuration process

apt

apt-get dist-upgrade upgrades versions from an OS to another one
apt-get upgrade install system upgrades
apt-get install like dpkg -i but retreives files from local repository
apt-get remove remoe packages
apt-get update updates from repository ( to local file cache)
apt-get autoremove also remove installed dependencies
apt-get install
install is followed by one or more packages desired for installation or upgrading.
Each package is a package name, not a fully qualified filename.
All packages required by the package(s) specified for installation will also be retrieved and installed.
The /etc/apt/sources.list file is used to locate the desired packages.
If a hyphen (-) is appended to the package name (with no intervening space), the identified package will be removed if it is installed.
Similarly a plus (+) sign can be used to designate a package to install. These latter features  may be used to override decisions made by apt-get's conflict resolution system.
root@debian:/dev/input#apt-get install gmailnotifyReading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
pythoneggtrayicon
The following NEW packages will be installed:gmailnotify pythoneggtrayicon
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 67.5 kB of archives.
After this operation, 401 kB of additional disk space will be used.
Do you want to continue [Y/n]?
Get:1 http://ftp.ro.debian.org/debian/ squeeze/main pythoneggtrayicon amd64
2.25.37 [37.3 kB]
Get:2 http://ftp.ro.debian.org/debian/ squeeze/main gmailnotify all 1.6.1.11
[30.3 kB]
Fetched 67.5 kB in 0s (214 kB/s)
Selecting previously deselected package pythoneggtrayicon.
(Reading database ... 127629 files and directories currently installed.)
Unpacking pythoneggtrayicon (from .../pythoneggtrayicon_2.25.37_amd64.deb) ...
Selecting previously deselected package gmailnotify.
Unpacking gmailnotify (from .../gmailnotify_1.6.1.11_all.deb) ...
Processing triggers for desktopfileutils ...
Processing triggers for gnomemenus ...
Processing triggers for menu ...
Processing triggers for mandb ...
Setting up pythoneggtrayicon (2.25.37) ...
Setting up gmailnotify (1.6.1.11) ...
Processing triggers for pythonsupport ...
Processing triggers for menu ...
Processing triggers for pythoncentral ...
root@debian:/dev/input#
apt-get remove
remove is identical to install except that packages are removed instead of installed.
Note the removing a package leaves its configuration files in system.
If a plus (+) sign is appended to the package name (with no intervening space), the identified package will be installed instead of removed.
root@debian:/dev/input#apt-get remove gmailnotifyReading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is
no longer required:
pythoneggtrayicon
Use 'aptget autoremove' to remove them.
The following packages will be REMOVED:
gmailnotify
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 229 kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 127668 files and directories currently installed.)
Removing gmailnotify ...
Processing triggers for mandb ...
Processing triggers for menu ...
Processing triggers for desktopfileutils ...
Processing triggers for gnomemenus ...
apt-get autoremove
autoremove is used to remove packages that were automatically installed
to satisfy dependencies for some package and that are no more needed.
root@debian:~# apt-get autoremoveReading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
pythoneggtrayicon
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 172 kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 127642 files and directories currently installed.)
Removing pythoneggtrayicon ...
Processing triggers for pythonsupport ...
root@debian:~#
apt-get update
update is used to resynchronize the package index files from their sources.
The indexes of available packages are fetched from the location(s) specified in /etc/apt/sources.list. For example, when using a Debian archive, this command retrieves and scans the Packages.gz files, so that information about new and updated packages is available. An update should always be performed before an upgrade or dist-upgrade. 
root@debian:~# apt-get update
Hit http://ftp.ro.debian.org squeeze Release.gpg
Ign http://ftp.ro.debian.org/debian/ squeeze/main Translationen
Ign http://ftp.ro.debian.org/debian/ squeeze/main Translationen_US
Get:1 http://ftp.ro.debian.org squeezeupdates Release.gpg [836 B]
Ign http://ftp.ro.debian.org/debian/ squeezeupdates/main Translationen
Ign http://ftp.ro.debian.org/debian/ squeezeupdates/main Translationen_US
Hit http://ftp.ro.debian.org squeeze Release
Get:2 http://ftp.ro.debian.org squeezeupdates Release [113 kB]
Hit http://ftp.ro.debian.org squeeze/main Sources
Hit http://ftp.ro.debian.org squeeze/main amd64 Packages
Hit http://ftp.ro.debian.org squeezeupdates/main Sources/DiffIndex
Hit http://ftp.ro.debian.org squeezeupdates/main amd64 Packages/DiffIndex
Get:3 http://ftp.ro.debian.org squeezeupdates/main amd64 Packages [13.4 kB]
Get:4 http://security.debian.org squeeze/updates Release.gpg [836 B]
Ign http://security.debian.org/ squeeze/updates/main Translationen
Ign http://security.debian.org/ squeeze/updates/main Translationen_US
Get:5 http://security.debian.org squeeze/updates Release [86.9 kB]
Get:6 http://security.debian.org squeeze/updates/main Sources [65.3 kB]
Get:7 http://security.debian.org squeeze/updates/main amd64 Packages [201 kB]
Fetched 482 kB in 2s (192 kB/s)
Reading package lists... Done
root@debian:~#
apt-get upgrade
upgrade is used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list. Packages currently installed with new versions available are retrieved and upgraded; under no circumstances are currently installed packages removed, or packages not already installed retrieved and installed.
New versions of currently installed packages that cannot be upgraded without changing the install status of another package will be left at their current version.
An update must be performed first so that apt-get knows that new versions of packages are available.
root@debian:~# apt-get upgradeReading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:libxml2 libxml2utils pythonlibxml2
3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,308 kB of archives.
After this operation, 98.3 kB of additional disk space will be used. 
Do you want to continue [Y/n]? y
Get:1 http://security.debian.org/ squeeze/updates/main \\
libxml2 amd64 2.7.8.dfsg2+squeeze3 [874 kB]
Get:2 http://security.debian.org/ squeeze/updates/main \\
libxml2utils amd64 2.7.8.dfsg2+squeeze3 [94.0 kB]
Get:3 http://security.debian.org/ squeeze/updates/main \\
pythonlibxml2 amd64
2.7.8.dfsg2+squeeze3 [340 kB]
Fetched 1,308 kB in 4s (305 kB/s)
Reading changelogs... Done
(Reading database ... 127629 files and directories currently installed.)
Preparing to replace libxml2 2.7.8.dfsg2+squeeze2 (using .../\\
libxml2_2.7.8.dfsg2+squeeze3_amd64.deb) ...
Unpacking replacement libxml2 ...
Preparing to replace libxml2utils 2.7.8.dfsg2+squeeze2 (using .../\\
libxml2utils_2.7.8.dfsg2+squeeze3_amd64.deb) ...
Unpacking replacement libxml2utils ...
Preparing to replace pythonlibxml2 2.7.8.dfsg2+squeeze2 (using .../\\
pythonlibxml2_2.7.8.dfsg2+squeeze3_amd64.deb) ...
Unpacking replacement pythonlibxml2 ...
Processing triggers for mandb ...
Processing triggers for pythonsupport ...
Setting up libxml2 (2.7.8.dfsg2+squeeze3) ...
Setting up libxml2utils (2.7.8.dfsg2+squeeze3) ...
Setting up pythonlibxml2 (2.7.8.dfsg2+squeeze3) ...
Processing triggers for pythonsupport ...
root@debian:~#
apt-cache
apt-cache search search for keyword
apt-cache show show info on package
apt-cache depends package dependencies
apt-cache rdepends what package depends on it
apt-cache search
search regex [ regex ... ]
search performs a full text search on all available package lists. It searches the package names
Separate arguments can be used to specify multiple search patterns that are and'ed together.
root@debian:~# apt-cache search gmailcairodockmailplugin Cairodock Mail plugin
cgmail mail checker for the GNOME desktop
checkgmail alternative Gmail Notifier for Linux via Atom feeds
conduit synchronization tool for GNOME
conkeror keyboard focused web browser with Emacs look and feel
enigmail GPG support for Thunderbird and Debian Icedove
xulextfiregpg Iceweasel/Firefox extension to use GnuPG on the web
icedovegcontactsync synchronizes contacts from Gmail into IceDove
gmailnotify A Gmail Notifier
imaprowl IMAP new mail notification utility for iPhone using Prowl Public API
imsniff Simple program to log Instant Messaging activity on the network
kcheckgmail A Gmail notifierlike notifier for KDE
libemailsendertransportsmtptlsperl Email::Sender with L (Eg. Gmail)
mailnotification mail notification in system tray
xfce4mailwatchplugin mail watcher plugin for the Xfce4 panel
icedove mail/news client with RSS and integrated spam filter support
icedovedbg Debug Symbols for Icedove
icedovedev Development files for Icedove
root@debian:~#
apt-cache show
show performs a function similar to dpkg --print-avail; it displays the package records for the named packages.
root@debian:~# apt-cache show gmailnotify
Package: gmailnotify
Priority: optional
Section: mail
InstalledSize: 224
Maintainer: Python Applications Packaging Team 
Architecture: all
Version: 1.6.1.11
Depends: python, pythoncentral (>= 0.6.11), pythongtk2, pythoneggtrayicon
Recommends: wwwbrowser
Filename: pool/main/g/gmailnotify/gmailnotify_1.6.1.11_all.deb
Size: 30260
MD5sum: f6441b72614299c7efbde242d3e79be5
SHA1: dacd0c9935c0e50cc846e3b6438cf8d4bafeb2af
SHA256: 5d67b397757998f3dcf72c873554136d4f754d73f859da3ca2869c7117d2fbb9
Description: A Gmail Notifier
Gmail Notifier is a Linux alternative for the notifier program released
by Google, it is written in Python and provides an attractive and
simple way to check for new mail messages.
PythonVersion: all
Tag: implementedin::python, interface::x11, mail::notification, \\
network::client, protocol::http, role::program, scope::utility, \\
uitoolkit::gtk, use::monitor, workswith::mail, x11::applet
apt-cache depends
depends shows a listing of each dependency a package has and all the possible other packages that can fulfill that dependency.
root@debian:~# apt-cache depends gmailnotifygmailnotify
Depends: python
Depends: pythoncentral
Depends: pythongtk2
Depends: pythoneggtrayicon
Recommends: 
conkeror
edbrowse
elinkslite
elvisconsole
lynxcur
uzbl
chimera2
chromiumbrowser
elinks
elvis
epiphanybrowser
galeon
iceapebrowser
iceweasel
kazehakase
konqueror
links
links2
midori
netrik
rekonq
xemacs21mule
xemacs21mulecannawnn
xemacs21nomule
w3m
root@debian:~#
apt-cache rdepends
rdepends shows a listing of each reverse dependency a package has.
root@debian:~# apt-cache rdepends geditgedit
Reverse Depends:
rabbitvcsgedit
gnomecore
geditdev
geditdev
geditcommon
geditrplugin
geditplugins
geditlatexplugin
ezgoaccessories
debgview
|clawsmail

aptitude

image
Text mode GUI
pressing U updates the local apt cache just like apt-get update

repository

image
location:
/etc/apt/sources.list


No comments:

Post a Comment