Linux Package Management

Source: Internet
Author: User
Tags gpg yum repolist

This article mainly introduces the Linux software package rpm, yum and source package installation, uninstallation, configuration commands and parameters.

One, RPM package management mechanism

RPM is a recursive abbreviation for RPM Package Manager and is a software management mechanism commonly used for systems such as Redhat, CentOS, and S.US.E. In order to facilitate the user to install the configuration, some third-party agencies or program source code developers will be the source code program related functions into the RPM package format. A source code program generally develops a master package and several sub-packages, and may have dependencies on each other.

1, the RPM package naming format

Common: Package name-source code release Number-RPM package issue number. For hardware platforms. rpm

Example: httpd-2.2.15-39.el6.centos.x86_64.rpm

Package Name: httpd

Source code Release Number: 2.2.15

RPM Package issue number: 39

Suitable hardware platform: el6.centos.x86_64

2. Ways to get RPM packages

Installation CD: The system installation CD will carry a large number of RPM installer packages

Site Server: http://mirrors.163.com

Http://mirrors.sohu.com

http://mirrors.opencas.cn

Project official website: The program's official website may provide the source code and the RPM package two kinds of formats

Third party: Some third party organizations or individuals will release many RPM packages

Http://rpmfind.net

Http://rpm.pbone.net

3. The legality of RPM package

In order to guarantee the validity and completeness of the source of RPM package, the package author will attach the digital signature on the package after the completion of the production, and the security mechanism of public key decryption is widely adopted.

4. RPM Package Installation Command

-I: Install the package with the full package format file name

-H: Show installation progress

-V: Show more information

-VV: Show more details

-VVV: Show very detailed information

--test: Test installation, but not really installed

--nodeps: Ignoring dependencies

--replacepkgs: Reinstall, and does not necessarily replace the original installation configuration file

Combination options, example: Rpm-ivh httpd-2.2.15-39.el6.centos.x86_64.rpm

5, RPM package Uninstall and upgrade

-E: Uninstall, only parking name is required. example, Rpm-e httpd

--nodeps: Ignore dependencies, and after uninstallation, some programs that depend on this package may run unhealthy

-U: Upgrade or install, install if package is not installed, upgrade package version installed

-F: Upgrade the installation package and do not install if the package is not loaded

--force: Forced upgrade, ignoring version conflict issues that can result from an upgrade

6, RPM packet query operation

-Q: Follow the installation package name to inquire whether this package is installed. example, Rpm-q httpd

-QA: Querying all installed Packages

-qi: Querying the package for more information

-QL: See which files are generated by the installation package

-QC: View which configuration files the installation package generated

-QD: See which help files are generated by the installation package

-Q--scripts: Querying related scripts for installation packages

-V: Check that the file properties generated by the installation package have changed

-QF: Follow the file path, query which package the file is installed to build

Example: rpm-qf/etc/httpd/conf/httpd.conf

-QPI: Query This package details with the full package name under the full path

Example: rpm-qpi/dev/cdrom/packages/httpd-2.2.15-39.el6.centos.x86_64.rpm

-QPL: Follow the full package name under the full path to query what files will be generated after this package is installed

-QPC: Follow the full package name under the full path to query which configuration files will be generated after this package is installed

-QPD: Follow the full package name under the full path to query which help files will be generated after this package is installed

7. RPM Package Database

In CentOS6, the RPM package is saved to the/VAR/LIB/RPM database directory after installation

RPM--INITDB: Initializes the database. If there is no library, create a new library;

RPM--REBUILDDB: Rebuilding the database and overwriting the original database

Second, Yum Package Manager

The Yum full name Yellow Dog updater,modified for Redhat and CentOS systems. Rely on the software warehouse, based on the RPM package management mechanism, can solve the RPM package installation process of complex dependencies, and install all dependent packages at once.

1. Yum installation process

After performing the installation operation, Yum will first analyze the cached local metadata warehouse (/var/cache/yum/), combine the packages already installed in the Local system environment, contact the Yum repository, download the packages that need to be installed locally, and install them once the download is complete.

2. Common Yum warehouses

Base library: A package library typically provided for the system release

Updates Library: Upgrade library for packages provided by the system release

Extra Library: Additional package libraries provided by the system release

Epel Library: Typically consistent with the Yum Warehouse project in Fedora, is a high-quality add-on package project

Each Yum warehouse must have a repodata directory and related RPM packages

3. Yum Client configuration file

Master profile: Default is/etc/yum.conf file

Warehouse configuration files: Files in the/etc/yum.repos.d/directory that end with. Repo

[Base] #yum仓库的serverid, used to differentiate other Yum repositories, must be unique name=centos-$releasever-base#yum warehouse name, used to describe the warehouse baseurl=http:// mirrors.163.com/centos/$releasever/os/$basearch/ftp://192.168.1.20/centos/6/os/x86_64 nfs://192.168.1.21/ce ntos/6/os/x86_64 File:///media/cdrom #yum仓库地址, supports warehouse addresses such as HTTP, FTP, NFS, and local enabled=1# enable the Yum repository, 0 is not enabled for gpgcheck=1# GPG checksum to determine the source of RPM packets is valid and secure, 0 is not enabled GPGKEY=FILE:///ETC/PKI/RPM-GPG/RPM-GPG-KEY-CENTOS-6#GPG verify address

4. Yum Command

Yum repolist {Enabled|disabled|all}: List all {enabled | unused | All}REPO, default is list enabled

Yum list {all|installed|available}: List {all | installed | installable} packages, default to list all

Yum Info Package Name: View description information for a package

Yum grouplist: List all package groups

Yum GroupInfo Package Group name: Displays the package group information and the list of packages it contains

Yum Clean all: Clear Yum Cache

Yum Install package Name: installation package

-Y Install package name: Installs the package directly without prompting

Yum Reinstall Package Name: Reinstall package

Yum check-update Package Name: Check if the package has an upgradeable package

Yum Update package Name: Upgrade Package

Yum Remove|erase Package Name: Uninstall Package

Yum Groupinstall Package Group name: Install software package Group

Yum Groupremove Package group name: Unload Package Group

5. Create a yum repository

The creation of the Yum repository relies on the Createrepo package, which executes the Createrepo command directly against the package directory after Createrepo is installed, generating the repodata purpose of creating the Yum repository successfully

Example: createrepo/var/www/pub/

Three, the source package installation method

Either the rpm command or the Yum command installed RPM package, which is limited to the production of RPM package author ideas, resulting in a feature selection is not as flexible as the source package, even in the RPM package is missing some of the features we need, and RPM package because the production is more difficult, its update speed is much slower than the update of the source package. and the source code compilation installation, you can define the functions we need in the compilation process, more suitable for their own system, but also more stable and efficient.

1. Build and install dependent development package

The source installation needs to compile the program, so depends on the system development environment GCC, gcc-c++ and other packages, these packages are commonly found in the "Development tools" and "Server Platform development" package Group

2. Source Package Acquisition Method

The program's official website usually provides the program's source code package, or in some code hosting agencies, such as SourceForge, github.com and code.google.com and other downloads

3. The source program compiles the installation steps

Decompression: Download the source package is generally the TAR package of compressed files, extracted into the installation package directory

Configuration:./configure

./configure--help Get help information to get the option parameters you need to configure

More general parameters such as the--prefix= installation path, you can specify the software installation path

Compiling: Make

Install: Make install

4, example installation Nginx

See my other blog: http://princepar.blog.51cto.com/1448665/1636026







This article is from "Xiao Yang" blog, please be sure to keep this source http://princepar.blog.51cto.com/1448665/1658511

Linux 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.