Study Notes (10)--Package management: RPM + Yum

Source: Internet
Author: User

1.rpm :

RPM(RedHat Package Manager) is RedHat 's software packages management tool, because CentOS is based on RedHat Linux , so rpm is also useful for CentOS. Some common parameters for RPM are listed below:

[[email protected] ~]# RPM-IVH packagename.rpm// installation package

[[email protected] ~]# rpm-e packagename.rpm// Uninstall Package

If you want to uninstall the vim-enhanced package, use the following command:

[Email protected] ~]# rpm-e vim-enhanced

See if the deletion was successful with the following command:

[[email protected] ~]# echo $?

This command is very common, if $? A value of 0, the previous command succeeds; value is not 0, the command execution fails.

When installing / Uninstalling packages, there are often a variety of interdependent relationships, using --nodeps to ignore dependencies and install / unload packages separately:

[Email protected] ~]# rpm-e vim-enhanced--nodeps

[[email protected] ~]# RPM-UVH packagename.rpm// update package

To query all packages installed by the system:

[Email protected] ~]# RPM-QA

Query, if the full name of a package is as follows:

yum-plugin-versionlock-1.1.30-30.el6.noarch.rpm

theYum-plugin-versionlockis the package name,1.1.30-30is the version number,El6represent it asRedHat 6System,Noarckrepresents the package in32-and64bit operating system, if only applicable to32-bit operating system, this location is typicallyI386,i586,i686and so on, if only applicable to64-bit operating system, this location is typicallyIx86_x64(of course, due to the backward compatibility of the operating system, applicable to32bit ofRpmpackages can also be installed in64operating system, or vice versa). Rpmto beRpmthe usual suffix name of the package.

The query system installs all packages in the name containing the VIM package:

[Email protected] ~]# Rpm-qa *vim*

the previous command is the same as using grep with the same effect:

[Email protected] ~]# Rpm-qa | grep "*vim"

See which files are installed in a package specifically (The package name must be complete and accurate and can no longer be used for a wildcard):

[Email protected] ~]# RPM-QL vim-enhanced

Query the details of a package (the same package name must be complete and accurate):

[Email protected] ~]# Rpm-qi vim-enhanced

View a command is generated by installing what package (the command requires an absolute path):

[Email protected] ~]# RPM-QF vim

It can also be used in conjunction with the anti-quote:

[Email protected] ~]# RPM-QF ' which vim '

RPM has its role, but in some cases we encounter cyclic dependencies when installing or uninstalling with RPM, even if the use of --nodeps is not resolved

2.yum :

The Yum command can be installed, deleted, updated, and queried via a network or local source to solve the cyclic dependency problem that RPM is difficult to solve.

To install the vim-enhanced package:

[email protected] ~]# Yum install-y vim-enhanced

To uninstall the vim-enhanced package:

[email protected] ~]# Yum Remove vim-enhanced

Update vim-enhanced Package:

[email protected] ~]# Yum update-y vim-enhanced

See if the vim command was created by installing which package (similar to Rpm-qf/usr/bin/vim), provided the package is included in the Yum Source:

[email protected] ~]# Yum provides vim

This command is equivalent to:

[email protected] ~]# Yum whatprovides vim

to view all the installation packages in the Yum Source:

[email protected] ~]# Yum list

In addition to being able to operate on a package,Yum can also operate on a group of packages, with the following commands:

[email protected] ~]# Yum Groupinstall

[email protected] ~]# Yum Groupremove

[email protected] ~]# Yum grouplist

commonly used group-based installations typically install the development environment (and, of course, the installation desktop will also use yum groupinstall):

[email protected] ~]# yum groupinstall-y "Development tools"

Note: the yum source provided by CentOS is often only available to meet our most basic requirements, and if additional packages (such as nginx, etc.) need to be installed through Yum, additional Yum sources must be installed to extend More commonly used is the epel source :

[Email protected] ~]# RPM-IVH http://www.lishiming.net/data/attachment/forum/epel-release-6-8_32.noarch.rpm

if it is a one -bit operating system:

[Email protected] ~]# http://www.lishiming.net/data/attachment/forum/epel-release-6-8_64.noarch.rpm

You can also install it with the following simple commands:

[email protected] ~]# Yum install-y epel-release

sometimes we just want to download it and don't want to install it, or we need to download it on a networked machine and copy it to a machine that doesn't have access to the Internet. To address this requirement, you need to use the--downloadonly option of the yum command :

First, install the Yum plugin to support the--downloadonly option:

[email protected] ~]# Yum install-y yum-plugin-downloadonly

after that, use reinstall for the packages that have already been installed, install the packages that are not installed , if the vim-enhanced package is not installed:

[email protected] ~]# Yum install-y vim-enhanced--downloadonly

if the vim-enhanced package is installed:

[email protected] ~]# Yum reinstall-y vim-enhanced--downloadonly

This allows the vim-enhanced package to be downloaded, the default is in the/var/cache/yum/base/packages/ directory, if you want to change the storage directory, there are two methods, the first method, the use of --downloaddir Temporary designated storage directory:

[email protected] ~]# Yum install-y vim-enhanced--downloadonly--downloaddir=/usr/local/src/

The second method modifies the /etc/yum.conf configuration file:

[Email protected] ~]# vim/etc/yum.conf

[Main]

cachedir=/usr/local/src/

Keepcache=1

Specify the download directory at cachedir, Keepcache 1 to Save the download package, and 0 to not save the download package. When using the second method, the package is not completely located under the specified directory root directory, so the first method is recommended, positioning is more accurate and fast.

It is sometimes more convenient to use the yum source from NetEase and download its . Repo file from the following URL :

Http://mirrors.163.com/.help/CentOS6-Base-163.repo

Transfer to Linux System in the/etc/yum.repos.d/ directory (back up other files in that directory and empty the directory). Regenerate the cache:

[email protected] ~]# Yum Clean all

[email protected] ~]# Yum Makecache

For more information on how to make a local yum source, refer to the previous blog with the following address:

http://xitongjiagoushi.blog.51cto.com/9975742/1621301


This article is from the "barrel of fake dog excrement" blog, please be sure to keep this source http://xitongjiagoushi.blog.51cto.com/9975742/1632110

Study Notes (10)--Package management: RPM + Yum

Related Article

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.