APT User Guide

Source: Internet
Author: User
I. Preface
1.1 What is apt
Installing new software is essential after the new operating system is installed. However, in Linux, the installation of application software is somewhat different from that in windows. For Linux beginners, installing software is a headache. Many Linux applications are released in the form of source code, which requires you to configure and compile the source program based on the actual situation of your system and your own needs before using the software. The traditional installation of Linux Through source code is too complex and difficult for most Linux beginners. To reduce the complexity of software installation, RedHat has launched the famous software package management tool RPM (RedHat packet manager) in its released version. Although rpm is marked with the RedHat, however, the original design concept is open, including OpenLinux and S. u. s. e. as well as distribution versions of linux such as Turbo Linux have been adopted, it can be regarded as an industry standard.
Although the software management function provided by rpm makes software installation and deletion highly automated, it simplifies software installation and management in Linux. However, the administrator needs to solve the software package dependency problem of RPM to maintain system consistency. It may be cumbersome for administrators to install and uninstall programs. For example, when software a finds that the software depends on another software B, B needs to be downloaded, and B dependency and C are discovered. This causes dependency nesting for multiple times. The Administrator has to download them one by one and then install them again.
The software management system released by Debian invented apt (Advanced package tool), which is easier to use in system software installation and maintenance. APT can automatically download and install corresponding software packages while detecting software package dependencies. APT enables administrators to upgrade system software without any faults. Many times, when your software installation has a negative impact on other methods, an apt improvement will keep everything right. APT makes zero downtime upgrade a reality.
Although APT is a Debian-based software package management tool, the good news is that APT has been transplanted to rpm-based systems by conectiva, a Brazilian company. See Changle
1.2 comparison between apt and other software management tools
On the rpm-based Linux platform, there are many other software package management tools, such as autorpm, rpmfind, up2date/rhun, urpmi/rpmdrake/manrake update, and so on. We will compare these tools below.
1. Dependency discovery is only valid in some cases.
2. Generally, all tools require a special software package index file on the server. This package contains the software package information. However, they are common files and can be downloaded from other image servers.
3. The software package verification is used to verify the correctness of the downloaded software package. The image server verification is used to verify whether the content of the image server is consistent with that of the formal server.
4. These features are unique to ATP-RPM, while Debian apt does not.
5. The reason for the upgrade is displayed when the software package is upgraded. In this way, the administrator can understand that the software package is upgraded for security reasons or functions.
From the above table, we can see that ATP has better functional advantages than other tools. Therefore, APT is an excellent software management tool for rpm-based software packages, such as RedHat, turbolinux, Suse, and Mandrake.
1.3 install Apt
Download the RPM package for the ATP of red hat7.3 from rpmfind.net and install it:
[Root @ www src] # rpm-IVH apt-0.5.4cnc9-fr0.1.rh73.i386.rpm
You can install apt on redhat7.3.
Ii. Main configuration file
1./etc/APT/sources. List
This is the most important configuration file of APT, which records the address of the software warehouse server and other information. There is software repository path information for all versions from redhat6.2 to 8.0. Here we only need to open the path information corresponding to Version 7.3, and the path information of other versions can be closed.
# Red Hat Linux 7.3
Rpm http://apt.freshrpms.net/RedHat/7.3/en/i386 OS updates freshrpms
Rpm-Src http://apt.freshrpms.net/RedHat/7.3/en/i386 OS updates freshrpms
2. The following other configuration files are available in the/etc/apt Directory: APT. conf rpmpriorities vendors. List. Use the default configuration. For more information, see man.
3. Preparations before Apt
After installing the apt package, the administrator needs to run the following first job:
[Root @ www src] # apt-Get update
Download the software package database from the default server.
[Root @ www src] # apt-Get check
ATP to verify the integrity and consistency of the local system and determine whether the software package dependency of the local system is consistent.
Note: If the local system consistency is seriously damaged, you can use the apt-get-F install command to manually fix the damaged dependency before using apt.
If you want to regularly upgrade the system to ensure that the system is upgraded immediately and make up for security vulnerabilities, you only need apt-Get update and apt-Get dist-upgrade or apt-Get upgrade.
Iv. Main commands
APT mainly includes four commands: APT-Cache apt-CDROM apt-config apt-Get. The most commonly used apt-GET command is used. For more information about these commands, see the man manual.
4.1 apt-Get
1. APT-Get update
Update the local apt-Get database to synchronize it with the pkglist file on the server. Before the upgrade, you generally need to execute this command to achieve consistency with the server.
2. APT-Get check
Verify the integrity of the local system.
3. APT-Get dist-Upgrade
Similar to Apt-get, but all basic software packages will be installed, and all software packages will be upgraded as much as possible, and new software packages will be installed as needed.
4. APT-Get install package_name
Install a software package and related software packages
For example, Apt-Get install OpenSSH
OpenSSH is installed and OpenSSL is upgraded.
5. APT-Get remove package_name
Delete the software package. The software package dependent on the software package is also deleted.
6. APT-Get source package_name
Download the source RPM of the software package
Example: APT-Get source -- compile zhcon
Capture the source rpm and compile it as a binary rpm. -- The compile Parameter Function is equivalent to rpm-ba.
7. APT-Get clean
Delete the downloaded software package stored in the cache directory (/var/Cache/APT/archives)
8. APT-Get upgrade package_name
Upgrade the specified software package and the dependent software package.
4.2 apt-CDROM
After installing the system, you can use apt-CDROM to add three installation discs to the sources. List of apt.
The usage is as follows:
# Apt-CDROM add
Using CD-ROM mount point/mnt/CDROM/
Unmounting CD-ROM
Please insert a disc in the drive and press ENTER
Mounting CD-ROM
Identifying... [af0e7c988f7ae057a4a3bccc8008134d-2]
Scanning disc for index files .. found 1 package indexes and 0 source indexes.
Please provide a name for this disc, such as 'mydistro 6.0 disk 1 ':
Gaga V1.1 disc1
This disc is called:
'Gaga V1.1 disc1'
Reading indexes... Done
Writing new source list
Source list entries for this disc are:
Rpm CDROM: [Gaga V1.1 disc1]/RedHat gaga
Repeat this process for the rest of the CDs in your set.
Run the apt-CDROM add command three times to load three installation discs. The/etc/APT/sources. list should contain the following content:
Rpm CDROM: [Gaga V1.1 disc3]/RedHat gaga
Rpm CDROM: [Gaga V1.1 disc2]/RedHat gaga
Rpm CDROM: [Gaga V1.1 disc1]/RedHat gaga
In this way, you can use apt-get to install software on the previously installed CD.
For example, if your server is not connected to the Internet, modify/etc/APT/sources. list to include the following three lines:
Rpm CDROM: [Gaga V1.1 disc3]/RedHat gaga
Rpm CDROM: [Gaga V1.1 disc2]/RedHat gaga
Rpm CDROM: [Gaga V1.1 disc1]/RedHat gaga
# Apt-Get update
# Apt-Get install IMAP
Then, add the second disc according to the instructions, without the trouble of searching left and right because you do not know which disc the software package is on.
4.3 apt-Cache
1. APT-Cache showpkg
Displays some general information about the software package.
For example, Apt-Cache showpkg OpenSSH
2. APT-Cache stats
Displays relevant statistical information to show the related statistics
3. APT-Cache dump
Displays brief descriptions of each software package in the cache
4. APT-Cache unmet
Displays inconsistent Dependencies
5. APT-Cache show
Displays the record information of the specified software package. Similar to rpm-Qi
6. APT-cache search
Search for a software package, similar to rpm-Qa | grep package_name
Example: APT-cache search OpenSSH
7. APT-Cache depends
Displays the dependency of a software package.
8. APT-Cache pkgnames
List all software packages
Example: $ apt-Cache pkgnames openss
4.4 apt-config
1. APT-config dump
Displays the current configuration information.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.