Apt HowTo
Chapter III Package Management
3.1 Update the available package list
======================
The package management system uses a private database trace list current status: installed, not installed or installed. The APT-GET uses this database to determine how the software package you want to use and other associated packs that must be in the normal running package.
You can use the APT-GET Update to update the database list. This command will scan the list of software package in the path to the /etc/apt/sources.list file. For more information on this list file, please check the /etc/apt/source.list file.
Timing this program is a good idea, which will make you and your system get the latest package update and security update.
3.2 Installing the package
==============
Now, I finally arrived at the stage that I have been looking forward to! Prepare Sources.List and the latest version of the available packages, what you need to do is to run the APT-GET to install your long-awaited software. For example, you can do this:
Apt-get install xchat
The APT scans its database to find the latest version of the package and download it from the area referred to in Sources.List to the local. If the package requires other packages to run normally - as this example -APT will do the associated package and automatically install the associated package. As follows:
[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 continche? [Y / n]
The Nautilus package needs to reference the shared function library, so the APT downloads the related shared log library from the mirror source. If you manually specify the name of these shared functions libraries in the Apt-Get command line, the APT will default to you to install all these Package.
That is to say, the APT will only be confirmed when installing the packages not specified in the command line.
The following APT-GET options may be useful to you
--h this help text.
-d Download Only - DO NOT Install or Unpack Archives
-f Attempt to Continue If Attempt to Continue If Attempt To Continue If Attempt To Continue IFRITY CHECK FAILS
-S no-act. Perform Ordering Simulation
-y Assume Yes to All queries and do not prompt
-u show a list of upgraded packages as well
Multiple packages can be installed with a command. The package file is downloaded from the network to the local / var / cache / Apt / Archives directory, and then install later.
You can use the same command line to delete the specified package, just follow one "-" after the package name, as shown below: [root] @ [/] # Apt-get install nautilus gnome-panel-
Reading package lists ... DONE
Building Dependency Tree ... DONE
The Following Extra Packages Will Be Installed:
Bonobo libmedusa0 libnautilus0
The Following Packages Will Be Removed:
GNOME-Applets gnome-panel gnome-panel-data gnome-session
The Following New Packages Will Be Installed:
Bonobo Libmedusa0 Libnautilus0 Nautilus
0 Packages Upgraded, 4 Newly Installed, 4 To Remove and 1 Not Upgraded.
NEED TO GET 8329KB of Archives. After unpacking 2594kb Will be used.
Do you want to continche? [Y / n]
See 3.3 Removing Packages for more details on deleting packages.
If you accidentally damage the installed package and want to fix it, or just want to install the latest version of some files in the package, this is what you can do, you can use - Reinstall options:
[root] @ [/] # apt-get - Reinstall Install GDM
Reading package lists ... DONE
Building Dependency Tree ... DONE
0 Packages Upgraded, 0 Newly Installed, 1 Reinstalled, 0 To Remove and 1 Not Upgraded.
NEED TO GET 0B / 182KB of Archives. After unpacking 0b will be used.
Do you want to continche? [Y / n]
The APT version referred to when writing this document is 0.5.3, which is also a "unsteable" phase. If you installed this version, you can use new features in the system configuration: You can use the APT-GET Install Package / Distribution to install the package in the specified release, or use the APT-GET Install Package = Version, as follows Down:
Apt-get install nautilus / unsteable
It will install the Nautilus package in the "Unstable" release, even if you are currently running the "stable" version. The available parameter values for the "Distribution" option in the command are: Stable, Testing, Unstable.
When dealing with the association problem, you may be more happy to use the -T switch to select the target release, let the APT-GET help you consider which release.
Important: The latest version of the debian package first uploaded to the "Unstable" release, this release contains all the changes in the package, whether it is minor modification that is small repair, which affects numerous packages and even the entire system. So, users who emphasize system stability will not use this release.
The "Testing" release is more than the "unsteable" release, with some system stability, but the officially running system should use the "Stable" release. 3.3 Removing the package
==============
If you no longer use some packages, you can use the APT to remove it from the system. To delete a package simply enter: APT-GET Remove Package. As follows:
[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 continche? [Y / n]
From the above example, the APT will pay attention to the package that has dependencies with the deleted package. Deleting a package using the APT will be connected to a package that is dependent on the package.
In the above example, run the APT-GET will delete the specified package and the software package with dependencies, but their configuration files, if any, will keep it in the system in intact. If you want to completely remove these packages and their configuration files, run:
[root] @ [/] # apt-get --purge 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 continche? [Y / n]
Note: The following * indicates that all profiles of the package will also be deleted.
Like the installation software, you can specify a package with a symbol in the delete command. When you delete a package, if you follow a " " behind the package name, the package will be installed instead of deletion.
[root] @ [/] # Apt-get --purge remove gnome-panel nautilus
Reading package lists ... DONE
Building Dependency Tree ... DONE
The Following Extra Packages Will Be Installed:
Bonobo Libmedusa0 Libnautilus0 Nautilus
The Following Packages Will Be Removed:
GNOME-Applets * gnome-panel * gnome-panel-data * gnome-session *
The Following New Packages Will Be Installed:
Bonobo Libmedusa0 Libnautilus0 Nautilus0 Packages Upgrade, 4 Newly Installed, 4 to Remove and 1 Not Upgraded.
NEED TO GET 8329KB of Archives. After unpacking 2594kb Will be used.
Do you want to continche? [Y / n]
Note that the APT-GET lists those associated packages that will be installed (that is, other packages that ensure the normal running of the package) and will be deleted the associated package, then listen to the package that will be installed.
3.4 Update Package
==============
The software package update is the most successful feature of the APT. You can complete the update with a command: APT-GET UPGRADE. You can update the package from the same version number, you can update the package from the same version number, or update the package from the release of the new version number, although the latter updated preferred command is APT-Get Dist-Upgrade; 3.5 Upgrade to the new version.
Plus -u option is useful when running this command. This option allows the APT to display a full updateable package list. Without this option, you can only update blindly. The APT downloads the latest update versions of each package, and then install them in a reasonable order. Note You should run the APT-GET Update update the database before running the command. See 3.1 Update Software Package List for details. Take a look at this example:
[root] @ [/] # apt-get-u Upgrade
Reading package lists ... DONE
Building Dependency Tree ... DONE
The Following package has been Been Kept Back
CPP GCC LILO
The Following Packages Will BE Upgraded
AddUser AE APT AutoConf Debhelper DPKG-Dev Esound Esound-Common FTP Indent
Ipchains Isapnptools Libaudiofile-Dev Libaudiofile0 Libesd0 Libesd0-Dev
Libgtk1.2 Libgtk1.2-dev liblockfile1 libnewt0 liborbit-dev liborbit0
LibSTDC 2.10-glibc2.2 libtiff3g libtiff3g-dev modconf Orbit ProCPS PSMISC
29 Packages Upgraded, 0 Newly Installed, 0 to remove and 3 not upgraded.
NEED TO GET 5055B / 5055KB of Archives. After unpacking 1161kb Will be used.
Do you want to continche? [Y / n]
The entire update process is very simple. Note that in this case, the APT-GET reports some packages of some packages are blocked (Kept Back), which indicates that the update version of these packages cannot be installed, and there may be associated asgens (currently not available for download) New version association package) or association extension (need to install a new associated package to match the new version of the package).
There is no good solution for the first reason. For the second reason, the new associative package required to run the APT-GET Intall installation can be. Another better solution is to use Dist-Upgrade. See 3.5 Upgrade to the new version for details.
3.5 Upgrade to the new version
================
The APT is to let you complete the entire system update, whether through the Internet or through a disc file (purchased disc or downloaded ISO image).
It can also be used to update some software packages that have changed relationships. That is, the software package of the Kept Back is blocked when using APT-GET UPGRADE as previously described.
For example, suppose you currently use Debian as Stable Revision 0 (such as Woody 3.0 R0, Translator Note), and you bought a new version of Revision 3 (such as Woody 3.0 R3, Translator Note), you can use APT from the new CD Upgrade your system. Using APT-CDROM (see 2.4 Add a CD-ROM to the Source.list file) Load the disc to the /etc/apt/sources.list and run the APT-GET DIT-UPGRADE.
Note that the APT is always searching for the latest version of the package, so if a package is new in your /etc/apt/sources.list, the APT will follow Sources The address referred to by .List file Download this package instead of using a package on the CD.
In the 3.4 update package, we got an example. We see some packages that are blocked by key, now we use the dist-upgrade method to solve this problem:
[root] @ [/] # apt-get-u dist-upgrade
Reading package lists ... DONE
Building Dependency Tree ... DONE
Calculating Upgrade ... DONE
The Following New Packages Will Be Installed:
CPP-2.95 Cron EXIM GCC-2.95 LIBIDENT LIBOPENLDAP-Runtime LibopenLDAP1
Libpcre2 logrotate mailx
The Following package has been Been Kept Back
LILO
The Following Packages Will BE Upgraded
AddUser AE APT AutoConf CPP Debhelper DPKG-Dev Esound Esound-Common FTP GCC
Indent Ipchains Isapnptools Libaudiofile-Dev Libaudiofile0 Libesd0
Libesd0-dev libgtk1.2 libgtk1.2-dev liblockfile1 libnewt0 liborbit-dev
LiborBit0 LibSTDC 2.10-glibc2.2 LibTIFF3G LIBTIFF3G-DEV MODCONF Orbit
Procps PSMISC
31 Packages Upgraded, 10 Newly Installed, 0 to remove and 1 not upgraded.
NEED TO GET 0B / 7098KB of Archives. After unpacking 3118kb Will be used.
Do you want to continche? [Y / n]
Note that those packages will be updated, and those new associated packages are also installed. However, LILO is still prevented, there may be some more difficult issues than the establishment of a new association, we determine the problem with the following method: [root] @ [/] # Apt-get -u install lilo
Reading package lists ... DONE
Building Dependency Tree ... DONE
The Following Extra Packages Will Be Installed:
Cron debconf evIbident libopenldap-runtime liboPENLDAP1 LIBPCRE2
Logrotate Mailx
The Following Packages Will Be Removed:
Debconf-tiny
The Following New Packages Will Be Installed:
Cron debconf evIbident libopenldap-runtime liboPENLDAP1 LIBPCRE2
Logrotate Mailx
The Following Packages Will BE Upgraded
LILO
1 Packages Upgraded, 9 Newly Installed, 1 To Remove and 31 Not Upgraded.
NEED TO GET 225KB / 1179KB of Archives. After unpacking 2659kb will be used.
Do you want to continche? [Y / n]
To view the above prompt information, LILO has a new conflict with the debconf-tiny package, which indicates that LILO will not be updated unless DebConf-Tiny is deleted.
Want to know which packages should be reserved or deleted, you can use:
# apt-get -o debug :: pkgprobemresolver = yes dist-upgrade
Reading package lists ... DONE
Building Dependency Tree ... DONE
Calculating Upgrade ... starting
STARTING 2
Investigating Python1.5
Package Python1.5 Has Broken Dep On Python1.5-Base
Considering Python1.5-Base 0 as a solution to python1.5 0
Holding Back Python1.5 Rather Than Change Python1.5-Base
Investigating Python1.5-Dev
Package Python1.5-Dev Has Broken Dep On Python1.5
Considering Python 1.5 0 as a solution to python1.5-dev 0
Holding Back Python1.5-Dev Rather Than Change Python1.5
Try to re-instate python1.5-dev
DONE
DONE
The Following package has been Been Kept Back
GS Python1.5-Dev
0 Packages Upgraded, 0 Newly Installed, 0 To Remove and 2 Not Upgraded.
Now, you can easily know that you can't install the Python1.5-DEV package because you can't meet the association requirements of another package Python1.5.
3.6 Remove the useless package file: Apt-get clean and autoclean ==================================== ================
When you need to install a package, the APT downloads the required files from the host listed in /etc/apt/sources.list, saving them to the native software library (/ var / cache / Apt / Archives /) , Then start installing, see 3.2 Installing the package.
The local software library will constantly expand a large number of hard disk space, fortunately, the APT provides tools to manage local software libraries: APT-GET Clean methods and Autoclean methods.
Apt-Get Clean will delete / var / cache / apt / archives directory and / var / cache / apt / archives / partial directory, except for the locked file. Since this, the APT will re-download it when you need to install a package again.
Apt-get AutoClean only deletes files that do not need to download again.
The following example shows how Apt-Get AutoClean works:
# ls / var / cache / Apt / Archives / logrotate * / var / cache / apt / archives / gpm *
Logrotate_3.5.9-7_i386.deb
Logrotate_3.5.9-8_i386.deb
GPM_1.19.6-11_i386.deb
There are two different versions of the Logrotate package file and a GPM package file in the / var / cache / apt / archives directory.
# APT-Show-Versions -p logrotate
Logrotate / Stable Uptodate 3.5.9-8
# APT-Show-Versions -p GPM
GPM / Stable Upgradeable from 1.19.6-11 to 1.19.6-12
Apt-show-version is displayed logrotate_3.5.9-8_i386.deb provides the upgrade version of Logrotate, so logrotate_3.5.9-7_i386.deb is useless. The same GPM_1.19.6-11_i386.deb is also useless because the update version of the package can be downloaded.
# APT-GET AutoClean
Reading package lists ... DONE
Building Dependency Tree ... DONE
Del GPM 1.19.6-11 [145KB]
Del logrotate 3.5.9-7 [26.5kb]
In summary, Apt-Get AutoClean only deletes those outdated files. See 3.9 How to upgrade the package from Debian's private version to get more APT-Show-Versions related information.
3.7 Operation APT in DSELECT
======================
DSELECT tool helps users choose the Debian package you want to install. It is a bit complicated and even boring, but after practicing you can master the horrible terminal interface.
One of the advanced features of DSELECT is that it knows "recommendation" and "recommended" capabilities that use Debian packages. (Debian software package has a capability: recommendation or suggesting that the system installs yourself, installing other packages to cooperate with its own work, of course, these recommended software packs are not necessarily necessary; and DSELECT tools can identify and use this capability When you use DSELECT, you can experience. Translator Note) Run DSELECT as root, select APT as a connection method after entering the program. This step is not necessary, but if you don't have a drive and want to download and install the package via the Internet, this is the best way to use DSELECT. For more use of DSELECT, please go to the DSELECT document page to the Debian website
http://www.debian.org/doc/ddp
After the package is selected in DSELEC, run:
Apt-get -u dselect-upgrade
As shown in the following example:
[root] @ [/] # apt-get-u dselect-upgrade
Reading package lists ... DONE
Building Dependency Tree ... DONE
The Following Packages Will Be Removed:
lbxproxy
The Following New Packages Will Be Installed:
Bonobo Console-Tools-Libs CPP-3.0 Enscript Expat Fingerd GCC-3.0
GCC-3.0-Base IcePref Klogd Libdigest-MD5-Perl Libfnlib0 Libft-Perl
Libgc5-dev libgcc300 limited c c-perl libltdl0-dev libsasl-modules
LibSTDC 3.0 Metamail Nethack Proftpd-Doc Psfontmgr Python-Newt Talk Tidy
Util-Linux-Locales Vacation Xbill XPlanet-Images
The Following Packages Will BE Upgraded
Debian-Policy
1 Packages Upgraded, 30 Newly Installed, 1 to remove and 0 not upgraded.
NEED TO GET 7140KB of Archives. After Unpacking 16.3MB Will BE..
Do you want to continche? [Y / n]
Compare us when we run apt-get dist-upgrade on the same system:
[root] @ [/] # apt-get-u dist-upgrade
Reading package lists ... DONE
Building Dependency Tree ... DONE
Calculating Upgrade ... DONE
The Following Packages Will BE Upgraded
Debian-Policy
1 Packages Upgraded, 0 Newly Installed, 0 to Remove and 0 Not Upgraded.
NEED TO GET 421KB of Archives. After Unpacking 25.6kb Will Be Freed.
Do you want to continche? [Y / n]
We see that many packages in the precedent are installed are the results of other packages "recommended" or "suggestions". Other packages are installed or deleted (eg, the LBXProxy package) is the decision we made through the DSELECT tool. This shows that DSELECT combines with the APT will be a powerful tool. 3.8 How to build a hybrid system
=========================
People often use the Testing release, because it is stable than the unsteable and is fashionable than Stable. However, there is another option for those who want to run certain packages, and don't want to migrate the entire system to the unsteable release version: Run a Testing / UnStable hybrid system. For another part of the conservative user, they may want to run the Stable / Testing hybrid system.
To implement a hybrid system, add the following statement in /etc/apt/apt.conf:
Apt :: Default-release "testing";
In the future, use the -T switch when installing the package from the unsteable release version:
# apt-get -t unsteable install packagename
Don't forget, when using a package of Debian, you should add the mirror source to the /etc/apt/sources.list file. In this example, in addition to joining the Testing publishing mirroring source, we also need to join the unsteable publishing mirror source.
3.9 How to upgrade the package from Debian's dedicated version
=======================================
Apt-Show-Versions provides a safe way to secure users who use a hybrid system to upgrade their systems, don't have to worry about the upgrade will upgrade the package that is the Stable package into a unsteable package. For example, this command will only upgrade your unsteable package:
# APT-GET Install `Apt-show-versions-u -b | grep unsteable`
3.10 How to Maintain multiple versions of the installed package (complex)
=================================================================================================================================================================================
You may encounter this situation, change some of the files in a package, but you don't want to introduce these changes in the new version without time or at all. Or, you upgrade the system to 3.0, but still want to continue using a package under Debian 2.2. You can "pin" (pin) this version so that it will not be updated.
It is very simple to operate, you only need to edit the / etc / apt / preferences file.
The file format is simple:
Package:
PIN:
Priority:
Package: sylpheed
PIN: VERSION 0.4.99 *
Note I used a * (asterisk). This is a "wildcard"; it indicates that I want "pin" all the version of the 0.4.99 head (to prevent them to be downloaded and installed on my machine. PIN control is the server-side update software package rather than the local Install the package. Translator's note). Because Debian uses the "Debian version number" to set the version for its software, I don't want to upgrade all of these versions. If you don't have tolerate, then 0.4.99-1 or 0.4.99-10 version is only available, you will install them. . If you modify the package, you must do this.
Priority is an optional domain; if it is not specified, its default is 989.
Let's take a look at how PIN reflects the difference between priority (PRIORTY). A priority of less than 0 indicates that the package is disabled; priority is between 0 and 100: The package is not installed and there is no available version, which does not appear in the list of selected versions; The priority is 100 indicates that the package has been installed - for this installed package, if there is a different version to replace it, then the replacement must be greater than 100.
The priority is more than 100 indicates that the package should be installed. Typical examples, such as the upgrade patch package of a package, any priority between 100 and 1000 (including 1000), representing the above situation. However, if a package is set to this priority, it does not degrade the installed version. For example, if I have installed Sylpheed 0.5.3 and specified a PIN of 999 for Sylpheed 0.4.99, the 0.4.99 package will not be installed because the PIN is required to meet the priority of the PIN. If you want to implement the package "Down", you need to set the priority of the PIN to be greater than 1000. (100
PIN can be used to control the revision of the package (Version), a release version, or version source (Origin).
In the front we have seen, use wildcards when nailing a revision, replacing the version number, which specifies multiple versions at a time.
The Release option is based on the release file, this file is on the local APT software library or on the disc. If you install a software package from your local software library and there is no file in the software library, then this option will be invalid. To see the contents of the / var / lib / Apt / LISTS / directory, the publishing includes these parameters: A (Archive), C (Version), O (Origin), L (Lable) .
Let's take an example:
Package: *
PIN: Release V = 2.2 *, A = Stable, C = Main, O = Debian, L = DebianPriority: 1001
In this example, we chose the version of the version of 2.2 * (it can be 2.2R2, 2.2R3 - these versions contain "Point Releases", security updates, and other very elevated updates), Stable Software Library, Main Class software package (non-Contrib or Non-Free), version sources and tags are Debian. Version Source (o =) Description Who makes this release file, the label (l =) indicates the name of the release: Debian means debian himself, Progeny is a descendener, the following is a release file. example:
$ CAT /VAR/LIB/APT/LISTS/FTP.DEBIAN.ORG.BR_DEBIAN_DISTS_POTATO_MAIN_BINARY-I386_RELEASE
Archive: Stable
Version: 2.2R3
Component: main
Origin: Debian
Label: Debian
Architecture: i386