The Yum Package Manager is probably more favored by users than the RPM Package Manager because the package Manager automatically solves the interdependencies between RPM packages. This article on CentOS 6.6 as an example, as far as possible to the reader's friends to explain the use of Yum Package Manager.
Yum (abbreviated by Yellowdog Updater modified) is a shell front-end package manager in Fedora and Redhat and SuSE. Based on RPM package management, the ability to automatically download RPM package from the specified server and install, can automatically handle the dependency relationship, and install all dependent software packages at once, users need not cumbersome to download, install. ---quoted from "Baidu Encyclopedia". So we can determine that it is actually a C/s tool, with the client and server side. The server is usually called the "Yum repository ". This is a very good term, whenever we install a program with Yum, it is like a robot, automatically from the Yum warehouse to find the corresponding package, moved to our system automatically installed for us.
The Yum configuration file is/etc/yum.conf, which defines information such as the location of the Yum repository
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/54/29/wKiom1R6dNywPB41AAP0GvbJbwM169.jpg "title=" yum_1. PNG "alt=" wkiom1r6dnywpb41aap0gvbjbwm169.jpg "/>
We can see that in the/etc/yum.repos.d/directory there are more than one of the Yum repositories, in fact the system comes with a yum repository stored in the directory, the name of the. Repo end, we will explain the Yum warehouse related content
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/54/28/wKioL1R6eDSTd1DZAACLPTYZf18806.jpg "title=" yum_2. PNG "alt=" wkiol1r6edstd1dzaaclptyzf18806.jpg "/>
Use of the Yum command:
Installation: Yum install package_name ... You can install multiple programs at the same time, and when Yum finds the program from the Yum Repository, it asks the user if it is installed.
Example: Installing the MySQL program with yum: Yum install MySQL
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/54/28/wKioL1R6g4GT_PuEAAWCOxyIfcg802.jpg "title=" yum_3. PNG "alt=" wkiol1r6g4gt_pueaawcoxyifcg802.jpg "/>
If you want to implement a fully automated installation, simply add-y to the package name and answer Yes for the user automatically. The above installation command can also be written as: Yum install mysql-y
If you want to install the program for the specified package version: Yum install package_name-version
Note: You can also install a local package using the Yum command: Yum localinstall/path/to/rpm_package_file ..., yum install/path/to/rpm_package can be used directly on CentOS 7 _file ... Install the local package
Reload : Yum Reinstall package_name ...
Example: Use Yum to reload Nginx:yum reinstall Nginx-y
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/54/28/wKioL1R6hKWyXOfqAAPthVDMxx8853.jpg "title=" yum_4. PNG "alt=" wkiol1r6hkwyxofqaapthvdmxx8853.jpg "/>
Upgrade: Yum update package_name; Check for upgradeable programs on the current system: Yum check-update; If multiple versions of the upgrade package are available and are only expected to be upgraded to the specified version: Yum update Package-version
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/28/wKioL1R6hpjDaDWqAARtAeAsERQ705.jpg "title=" yum_5. PNG "alt=" wkiol1r6hpjdadwqaartaeaserq705.jpg "/>
For example upgrade Nginx, upgrade from 1.4.7-1 to 1.6.2-1 version: Yum update nginx-y
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/54/28/wKioL1R6huuDQ2QeAAQrjzDhn_o200.jpg "title=" yum_6. PNG "alt=" wkiol1r6huudq2qeaaqrjzdhn_o200.jpg "/>
downgrade: Yum downgrade Package_name. Note: Demote the current version to its previous level, and if you want to downgrade to a specific version, specify the package version number
For example, demote the current version of Nginx to 1.4.7-1 version: Yum downgrade nginx-1.4.7-1.el6.ngx-y
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/54/29/wKiom1R6iGaB8RDsAARqxn54yjY781.jpg "title=" yum_7. PNG "alt=" wkiom1r6igab8rdsaarqxn54yjy781.jpg "/>
Uninstall Package: Yum erase package_name or yum remove package_name. Note: The dependent packages will be uninstalled together.
Query class command:
query whether a program is installed: Yum list Package_name, without the package name, will list all packages installed on the system
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/54/28/wKioL1R6i3qBNzdMAAHtig1VH7M477.jpg "title=" yum_8. PNG "alt=" wkiol1r6i3qbnzdmaahtig1vh7m477.jpg "/>
View summary information for a package: Yum info package_name
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/54/29/wKiom1R6jiGSVw99AAMXV0mDtyI279.jpg "title=" yum_9. PNG "alt=" wkiom1r6jigsvw99aamxv0mdtyi279.jpg "/>
The summary information for the package name or package based on the keyword blur contains a related list of this KEYWORD: Yum search KEYWORD
query which package the file is generated by: Yum Provides/path/to/somefile or Yum whatprovides/path/to/somefile
attached: Package group management. typically used when developing packages, such as: Development Tools, Server Platform Development, Desktop Platform Development, Debug Tools, etc. package groups
Show all package groups: Yum grouplist
Displays information about a package group: Yum groupinfo "Group_name"
Install package group: Yum Groupinstall "group_name" or yum install @ "Group_name"
Uninstall Package group: Yum groupremove "group_name" or yum remove @ "group_name"
Upgrade Package group: Yum groupupdate "group_name" or yum update @ "group_name"
Here's a look at the contents of the Yum repository for your readers.
In the/etc/yum.repo.d/directory, the. Repo name is the Yum repository. The Yum repository stores many RPM packages and server paths related to RPM package metadata, and the Yum command installation and upgrade is dependent on the Yum repository.
Yum Warehouse class command:
List all available warehouses on the current system: Yum Repolist
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/54/29/wKioL1R6qoWQ6qONAAE9dAWsaOo743.jpg "title=" 1130 images 001.png "alt=" Wkiol1r6qowq6qonaae9dawsaoo743.jpg "/>
Disable a yum warehouse yum--disablerepo=repo_id repolist, such as disable Nginx warehouse: Yum--disablerepo=nginx repolist
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/29/wKioL1R6q1Lwf4A_AAFLxzXHkQY951.jpg "title=" 1130 images 002.png "alt=" Wkiol1r6q1lwf4a_aaflxzxhkqy951.jpg "/>
Enable a yum warehouse Yum--enablerepo=repo_id repolist, such as Enable Nginx Warehouse: Yum--enablerepo=nginx repolist
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/2A/wKiom1R6qyLyOJn1AAFfdb5N8Fg707.jpg "title=" 1130 images 003.png "alt=" Wkiom1r6qylyojn1aaffdb5n8fg707.jpg "/>
Note: The command line enables or disables the preference of the Yum warehouse higher than the properties defined by enable in profile/etc/yum.repos.d/*.repo.
Clean the Yum repository cache: Yum clean all; usually when switching to the Yum repository, the cache must be cleaned first
We can use the system comes with the Yum warehouse, but in the company sometimes the network environment is not very power, then we can also configure the Yum warehouse, Linux allows users to define multiple warehouses in a repo file, you can also name multiple warehouses one by one as repo file.
format of the Yum Warehouse definition:
[repo_id] defines the unique identity of the warehouse on this system, such as [base]
name= Description information of Repo
baseurl=Yum Client accesses the path to the repository, note: to shelf write, such as: baseurl=ftp://172.16.0.1/pub/centos6/; commonly used file protocols are: ftp://,/HTTP, NFS, file :///(Last/indicates root file system path).
enabled= {1|0} Whether this yum warehouse is enabled
gpgcheck= {1|0} whether to check the source legitimacy of the package and the integrity of the package
gpgkey= Specifies the storage path for the public key key, such as: Ftp://172.16.0.1/pub/CentOS6/gpg-key
cost= cost value, default is 1000, the lower the Yum client preference, the more Yum repositories can be designated as a first access to a Yum repository
Attached: Advanced usage of Yum Client configuration
① can use cost to define warehouse usage overhead when the Yum customer defines the warehouse, default is 1000;
You can use variables when specifying paths in ②baseurl: $releasever: Major version number of the current OS release
$arch: Platform
$basearch: The underlying platform, such as the I686,i586,i486,i386 series, is i386, such as http://mirrors.sohu.com/centos/$releasever/os/$basearch
③ can replace BaseURL with the mirrorlist directive: point to a URL, which is a text file that holds a large list of mirror servers, and gets the list file when the user uses the Yum repository. Then through the Fastestmirror plug-in to determine which image is the fastest access to the server, and as the baseurl of this visit;
When defining the Yum repository, it is only necessary to define [repo_id], BaseURL, and enabled to satisfy the basic conditions used by a Yum repository. After the definition, do not think it can be used, but also need to use the Createrepo program to build it up.
Build the Yum Warehouse command: Createrepo <dir >. Note: You need yum to install the program first.
actual combat: put the RPM package in the CENTOS6.6DVD2 on the FTP server and create a yum repository. For internal use by the company.
To demonstrate, use two virtual machines, one as an FTP server (ip:172.16.24.1), and one as a client (ip:172.16.24.24)
Add the DVD disc image into the virtual machine and boot the system.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/54/28/wKioL1R6l3vyyW_oAAIsvA--31I632.jpg "title=" yum_ 10.png "alt=" Wkiol1r6l3vyyw_oaaisva--31i632.jpg "/>
Start FTP service: Service vsftpd start
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/29/wKioL1R6rgeRKrF0AAB7ZC_MzaY148.jpg "title=" yum_ 14.png "alt=" Wkiol1r6rgerkrf0aab7zc_mzay148.jpg "/>
Create a mount point for the DVD: Mkdir/media/cdrom;
mount a disc in read-only mode: Mount/dev/cdrom/media/cdrom;
In/var/ftp/pub/, create a directory pub to store these RPM packages and copy all the packages under the Packages directory in the DVD directory to the/var/ftp/pub/pub directory: cp/media/cdrom/packages/*/var/ Ftp/pub/pub (Note: This directory is the FTP server's shared directory, put in other directories with friends Please check whether the client has access to this directory)
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/54/2A/wKiom1R6meuB2IZDAAD3zCAF2Nw740.jpg "title=" yum_ 11.png "alt=" Wkiom1r6meub2izdaad3zcaf2nw740.jpg "/>
Install the build Yum Repository program: Yum install createrepo-y or download Crearepo RPM package to FTP server using Rpm-i createrepo-major version number-minor version number-issue number-other. RPM Installation
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/2A/wKiom1R6nKKzaA47AAOrpzLfm64126.jpg "title=" yum_ 12.png "alt=" Wkiom1r6nkkzaa47aaorpzlfm64126.jpg "/>
Build Warehouse: createrepo/var/ftp/pub/pub/
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/54/29/wKioL1R6pUnAGcWsAAEMmOv8j8M025.jpg "title=" yum_ 13.png "alt=" Wkiol1r6punagcwsaaemmov8j8m025.jpg "/>
Edit the configuration file on the client to point to the warehouse: Vi/etc/yum.repos.d/ftp.repo
[Ftp_pub]
Baseurl=ftp://172.16.24.1/pub/pub
Enabled=1
Gpgcheck=0
cost=200
Save exit;
Cleanup Yum cache: Yum clean all; and view results:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/54/2A/wKiom1R6rffQepW8AAOBdt9-0k4149.jpg "title=" yum_ 15.png "alt=" Wkiom1r6rffqepw8aaobdt9-0k4149.jpg "/>
Result test: Installing Axel:yum install Axel
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/2A/wKiom1R6t4qiSaabAAPUyF1LV1k768.jpg "title=" yum_ 16.png "alt=" Wkiom1r6t4qisaabaapuyf1lv1k768.jpg "/>
Note: The new upload to the ftp rpm package, to rebuild the Yum warehouse, remember!
This article is from "Xiao Zhi" blog, please be sure to keep this source http://948555452.blog.51cto.com/9146446/1584723
The Linux Package Manager (medium)--yum command has never been so detailed