3/14/2008
In the beginning there was the .tar.gz. Users had to compile each program that they wanted to use on their GNU/Linux systems. When Debian was created, it was deemed necessary that the system include a method of managing the packages installed on the machine. The name dpkg was given to this system. Thus the famous 'package' first came into being on GNU/Linux, a while before Red Hat decided to create their own 'rpm' system. A new dilemma quickly took hold of the minds of the makers of GNU/Linux. They needed a rapid, practical, and efficient way to install packages that would manage dependencies automatically and take care of their configuration files while upgrading. Here again, Debian led the way and gave birth to APT, the Advanced Packaging Tool, which has since been ported by Conectiva for use with rpm and has been adopted by some other distributions."
Package management Advanced package management
Linux
Packages
Linux strengths allowed this operating system to gain a central place in the IT market Package management played an important role in this process The Linux system’s coherency is assured maintaining databases of installed files. In this way installing or removing programs gets an easy task Nowadays only few programs are installed using source files
In more widespread linux distributions, programs are distributed in binary RPM, DEB or modified TGZ formats RPM (RedHat Package Management) packages are used on RedHat, Mandrake, Suse, Conectiva DEB are used on the open source distribution Debian and its forks Modified TGZ are used on SlackWare
3
Dependencies
4
What is apt?
Dependencies management is a very useful feature of package management software They keep systems in a consistent state and guarantee the applications to run in the expected way
apt is a Debian tool used to manage packages in such a way that when the user asks for a package to be installed the system also installs (or upgrades) all the necessary packages to make the package work.
rpm or dpkg commands have limited dependencies management features
They can report which library a package relies on, but the library can itself relies on other packages…
5
6
1
3/14/2008
APT
APT is a system created in the Debian community to automatically manage the packages dependencies APT can install, remove and upgrade packages, managing dependencies and downloading the packages It’s a frontend to other tools, and it uses the underlying package management system, like the rpm or dpkg commands It’s able to fetch packages from several media (cdrom, ftp, http, nfs), and it can be used to create ad-hoc software repositories
Command-line package management with APT If you are comfortable using the Terminal, you can use apt (Advanced Packaging Tool) to install or remove software. You need administrative access to use apt.
7
8
Some solutions
RPM– RedHat
RedCarpet – Ximian
To update the local list of packages, enter in a Terminal: sudo apt-get update
YOU (YaST Online Update) – Suse YUP (YellowDog Updater) – YellowDog PPC
Urpmi – Mandrake
YUM (YellowDog Updater Modified)
APT (Advanced Packaging Tool) – Debian (and rpm...)
9
To install all available updates: sudo apt-get upgrade
10
To search for a package: apt-cache search package
11
12
2
3/14/2008
APT – Using
(1/3) Examples
[root]@[/] # apt-get install nautilus Reading Package Lists... Done Building Dependency Tree... Done The following extra packages will be installed: bonobo libmedusa0 libnautilus0 The following NEW packages will be installed: bonobo libmedusa0 libnautilus0 nautilus 0 packages upgraded, 4 newly installed, 0 to remove and 1 not upgraded. Need to get 8329kB of archives. After unpacking 17.2MB will be used. Do you want to continue? [Y/n]
To install a package: sudo apt-get install package
13
14
Removal •apt-get remove packagename - removes a installed package (configfiles remain)
To remove a package:
sudo apt-get remove package
•apt-get --purge remove packagename - removes a installed package (configfiles will also be removed) •A special trick: if you want to remove package “foo” and install package “bar” in one step: apt-get --purge remove foo bar+. •apt-get autoremove packagename - removes a installed package and dependencies 15
APT – Using
16
APT – Using
(2/3)
[root]@[/] # apt-get remove gnome-panel Reading Package Lists... Done Building Dependency Tree... Done The following packages will be REMOVED: gnome-applets gnome-panel gnome-panel-data gnome-session 0 packages upgraded, 0 newly installed, 4 to remove and 1 not upgraded. Need to get 0B of archives. After unpacking 14.6MB will be freed. Do you want to continue? [Y/n]
(3/3)
[root]@[/] # apt-cache search pdf kghostview - PostScript viewer for KDE tetex - The TeX text formatting system. xpdf - A PDF file viewer for the X Window System … [root]@[/] # apt-cache show xpdf … Filename: xpdf-1.00-3.i386.rpm Description: A PDF file viewer for the X Window System. Xpdf is an X Window System based viewer for Portable Document Format (PDF) files. Xpdf is a small and efficient program which uses standard X fonts. 17
18
3
3/14/2008
APT – repository source.list
The /etc/apt/sources.list file
As part of its operation, APT uses a file that lists the 'sources' from which packages can be obtained. This file is /etc/apt/sources.list.
he entries in this file normally follow this format: deb http://host/debian distribution section1 section2 section3 deb-src http://host/debian distribution section1 section2 section3 Of course, the above entries are fictitious and should not be used. The first word on each line, deb or deb-src, indicates the type of archive: whether it contains binary packages (deb), that is, the pre-compiled packages that we normally use, or source packages (deb-src), which are the original program sources plus the Debian control file (.dsc) and the diff.gz containing the changes needed for `debianizing' the program.
19
The two last lines are commented out (with a `#' in front), so apt-get will ignore them. These are deb-src lines, that is, they point to Debian source packages. If you often download program sources for testing or recompiling, uncomment them.
21
20
Do not forget to run apt-get update after modifying the /etc/apt/sources.list file You must do this to let APT obtain the package lists from the sources you specified.
22
APT - Benefits
Apt simplifies package management on rpm based distributions, even on RedHat, most used distribution in HEP environments Systems update is possible with only two commands: # apt-get update; apt-get -y upgrade
Using a local repository is possible to upgrade machines using no external links It is possible to include non standard packages in local repositories... 23
4