Linux Learning Note 10: Package Management

Source: Internet
Author: User

In many versions of Linux, it can be roughly divided into two series, namely: Redhat system Linux,debian system Linux. In the two different systems of Linux, the management of the package is also a certain difference, but their principles are roughly the same. This note will focus on the management of the software package in Redhat Linux, and briefly on the management of the Debian System Linux package. Its approximate structure is as follows:

· Redhat System Linux Package management

-1. Binary package management (RPM based)

-2. Binary package management (yum based)

-3. Source Code Package Management

-4. Script Installation

· Debian System Linux Package management

-5. APT Package management

1. Binary package Management (RPM-based, yum package management tools)

RPM, Yum is the most commonly used binary package management tool under the Redhat series Linux. The difference between Yum and RPM is that Yum solves dependency problems when installing binary packages and software upgrade issues.

-Uninstall

Format: rpm-e [parameter] [software name]

Example: #rpm-e sudo uninstalling software named sudo

Note: the "--nodeps" parameter can forcibly uninstall the software without checking the dependencies of other software.

-Installation

Format: RPM [parameter] [software file name]

Parameter:-I indicates installation (must)-V indicates installation details (optional)-H displays installation progress (optional)

Example: #rpm-IVH sudo-1.7.2p1-5.e15.i386.rpm

In addition, there are additional parameters to choose from:

--excludedocs do not install the documentation files in the package

Example: #rpm-ivh--excludedocs sudo-1.7.2p1-5.e15.i386.rpm

--prefix Path installs the package to the path specified by path

Example: #rpm-IVH--prefix=/usr/local/sudo sudo-1.7.2p1-5.e15.i386.rpm Installing the sudo software into the/usr/local/sudo directory

--test only tests the installation and does not actually install

Example: #rpm-ivh--test sudo-1.7.2p1-5.e15.i386.rpm Test install sudo software

--replacepkgs when the package has been installed, overwrite the package installation.

Example: #rpm-IVH--replacepkgs sudo-1.7.2p1-5.e15.i386.rpm Overlay install sudo software

--replacefiles

A file in the package to be installed has been installed when installing other packages, there will be a conflict of files error, use this parameter can let RPM ignore the error

Example: #rpm-ivh--replacefiles sudo-1.7.2p1-5.e15.i386.rpm ignoring file conflict errors

--nodeps Ignore unresolved dependencies

Example: #rpm-ivh--nodeps sudo-1.7.2p1-5.e15.i386.rpm

-Query whether a software is installed

Format: rpm-q [software name]

Example: rpm-q sudo query whether sudo is installed with this software

-Query is known as an installed package

Format: Rpm-qa (a = All)

Example: Rpm-qa

You can check with grep for software that has a keyword in all of the installed software, such as:

Rpm-qa | grep Samba queries all installed packages that have the keyword samba.

-Upgrade Package

Example: #rpm-UVH sudo-1.7.2p1-5.e15.i386.rpm

Where-U represents the upgrade package (required parameter)-V to display installation details (optional)-H displays installation progress (optional)

-RPM Package Query

Option:-A queries all installed packages

-F Query file belongs to package

-P Query Package

-I display package information

-L display the list of files in the package

-D displays a list of files that are annotated as documents

-C Displays a list of files that are annotated as profiles

Common combinations:

RPM-QF Query File Script package (father)

Rpm-qi or RPM-QIP query package information (the package is not installed.) Query for non-installed software to add the P parameter, the same as) (info)

RPM-QL or RPM-QLP Query package installation file (list)

RPM-QD or RPM-QDP query package Help documentation (document)

RPM-QC or RPM-QCP Query package configuration file (config)

Example:

#rpm-qf/etc/services Query Services File script package

#rpm-qi Samba for information on samba packages

#rpm-ql sudo query sudo package how many files are installed

#rpm-qd vsftpd Query the location of the VSFTPD software Help documentation

#rpm-qc sudo query sudo software configuration file location

-Package Check

Format: rpm-v [software name]

Example: #rpm-v sudo queries whether the installation file for sudo software has been changed

Output: S.5 ... T c/etc/sudoers

The output string has the following meanings:

MD5 checksum value of 5 files (content change)

S File size L link file T file creation or modification time

D Device file U file user G file user group M file permissions

The output string for the example above indicates that the file size is changed, the contents of the file are changed, and the file creation or modification time is changed.

-Package file Extraction

Example: Unzip all files to the current directory

#rpm2cpio initscripts-8.45.30-2.e15.centos.i386.rpm | Cpio-idv

Unzip the specified file into the Etc/inittab directory under the current directory

#rpm2cpio initscripts-8.45.30-2.e15.centos.i386.rpm | Cpio-idv./etc/inittab

where v indicates the details are displayed, D indicates that the directory structure is preserved while extracting, and I is the decompression

2. Binary package management (yum based)

-Installing Yum Install

Example: Yum install sudo installation sudo software (automatically download from the Internet and resolve dependencies)

-Detect and Upgrade Yum Check-update

Example: Yum check-update sudo

-Upgrade Yum Update

Example: Yum update sudo upgrade sudo software

-Query Package information Yum List

Example: Yum list queries all packages on Yum source

-Package Information Yum Info

Example: Yum info sudo queries sudo for package information

-Uninstall Yum Remove

Example: Yum remove sudo delete sudo package

3. Source Code Package Management

The following is an example of the installation of the PROFTD source code package, which describes the installation steps for the source code package:

#tar-XZVF proftpd-1.3.3d.tar.gz  //Unpack Package #cd proftpd-1.3.3d#.configure--PREFIX=/USR/LOCAL/PROFTD//configuration information, Prefix parameter specifies the source code package installation Location #make        //compile #make Install  //Installation

The configuration is to let the software to collect information about the system, so that the subsequent compilation operations.

4. Script Installation

Script installation is the software writer writes a shell script or Java script, you just need to enter some simple information can be installed directly. This is easy to install, similar to how WINS is installed.

The following is an example of how to install a script using Webmin installation:

#tar-XZVF webmin-1.530.tar.gz  //decompression #cd Webmin-1.530#vi README//By viewing the documentation, you can see which script is installed (or the Install Help file) #./ setup.sh  //Execute installation script (find out via Readme Help file)

5. Apt Package Management method

APT package management is a binary package management method for the Debian system Linux series.

The command is similar to the ARP packet management, except that the RPM prefix is replaced with Apt-cache.

The commands for the APT package management method are as follows:

Apt-cache Search Package

Apt-cache Show Package Information

Apt-get Install installation (-f parameter can be forced to install)

Apt-get Reinstall Overlay Installation (-f parameter can be forced to reinstall)

Apt-get Remove

Apt-get autoremove Automatic deletion (MARK--purge)

Apt-get Update Software source

Apt-get Upgrade Update installed packages

Linux Learning Note 10: Package Management

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.