First, preface
Before we introduced the application of RPM (see http://windchasereric.blog.51cto.com/5419433/1676324 for details), we found that the RPM installation software has a very tedious problem, that is the dependency between package and package, If you want to install and use the software program properly, you must resolve the dependencies of the software step-by-step as required. Then if the program uses a lot of packages, it will be very expensive to use people's time and energy. So is there a way to solve this problem?
In RPM we introduce the RPM software that records installation information between the software, which also includes the dependency properties between the software. So if we analyze this list before the installation, then we can install the required software one at a time according to the relationship between the software, so as to solve this problem, this is the mechanism of YUM.
Ii. introduction of Yum
Yum (Yellow dog Updater Modified) is a pre-RPM package Manager in CentOS that downloads rpm packages from a specified server and automatically analyzes and processes the dependencies between RPM packages, and then installs the packages that depend on them in turn, Without the hassle of one installation.
Third, Yum Repository:yum Warehouse
Components of the Yum Warehouse
3.1. Data
Contains all the package files
3.2. Meta-data
Refers to a data file: includes the package name of each package, the version information, the list of files contained in each package, the dependencies between packages and packages, and the grouping information for packages.
Small extension: How does metadata come about? Using the Createrepo tool, we can quickly and concisely read out all the RPM package information in the directory where we have specified a large number of RPM packages, analyze his dependencies and generate metadata. So Createrepo can understand it as a tool for making yum metadata. In the CD actually also have this metadata, the path in the CD-ROM [[email protected] mnt]# CD repodata/, followed by the SQLite file suffix notes: centos5 is the XML suffix, CENTOS6, 7 is the SQLite database The way to store the
Iv. Introduction to Yum configuration files
Yum profiles are in 2: Master profile + Warehouse configuration file
4.1. Master Profile Path/etc/yum.conf
[main] cachedir=/var/cache/yum/$ basearch/$releasever #下载RPM包的缓存目录 keepcache=0 #RPM缓存的程序包安装完成后是否保存, 0 means no save, 1 means save buglevel=2 #调试级别 Value range 0 - 10, default value is 2 logfile=/var/log/yum.log #yum相关日志存放路径 exactarch=1 #是否要平台完全匹配才能安装 obsoletes=1 #需不需要检查已过期的仓库 gpgcheck=1 # Whether to check package integrity and legality plugins=1 #是否允许支持yum的插件功能,0 said that ,1 is not allowed, it is recommended to allow, General will use yum-fastestmirror this plugin installonly_limit=5 # How many kernel packs are allowed to be retained bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref= Http://bugs.centos.org/bug_report_page.php?category=yum distroverpkg=centos-release #指定一个软件包,yum will determine your distribution based on this package, either by default, Redhat-release, or by installing any rpm packages for your own distribution.
4.2. Warehouse configuration file path /etc/yum.repos.d/*.repo
The warehouse file can have multiple, and the configuration information of one or several related warehouses can be saved as a file, and so the warehouse file name ends in. Repo
[repoid] #容器名字, must be the only name= #some name The name of the for this repository warehouse, only one identification baseurl= #指定真正仓库所在的路径, can refer to multiple warehouses #例如: Baseurl=file:///media/cdrom # ftp://172.168.1.1/path #备注第二行不能顶格写, or it will go wrong mirrorlist= # List containers can use the site, if you do not want to use, you can add # comment enabled= {0 | 1} #指是否启用这个仓库 , 0 means not enabled, 1 means enable GPGCHECK= {0&Nbsp;| 1} #是否要检测软件包的合法性, 0 means no detection, 1 means no check gpgkey= #软件包的公钥文件所在路径, for example: gpgkey=file:///media/cdrom/ gpg-rpm-key-centos-6cost= #仓库优先级, for example, if a package is available in multiple warehouses, which installation should I choose? By this priority, the default is 100, the smaller the number, the higher the priority.
Note: The default usage for each warehouse:
Base library: A package (CD-ROM) typically provided for the system release
Updates library: Storing update packages
Extra library: Storing extra bags
Epel Library: Epel library file
The library itself has priority, but only in the client, the server side is no priority
Tip: Yum can support multiple protocols, including FTP, HTTP, NFS, and local file sharing services
So the BaseURL in the warehouse configuration file can be written in more than one format.
1) FTP
Format: ftp://server/path/to/repository
2) HTTP
Format: http://server/path/to/repository
3) NFS
Format: Nft://server/nfs_path
4) Local file sharing service
Format: file:///path/to/repository
Five, yum installation steps
650) this.width=650; "src=" Http://www.178linux.com/ueditor/php/upload/image/20150721/1437466576108490.png "title= "1437466576108490.png" alt= "Yum installation step. png"/>
Vi. use of the Yum command
6.1. Yum Query function
Yum [option] [information that needs to be queried] [parameters]
-y: The default Yum needs to be interactive mode, and-y indicates that the Yes response is provided automatically
Search: Searching for a software name or keyword
List: Lists all the packages and names managed by Yum
Info: Ditto, also similar to Rpm-qai
Provides: Find this command is generated by software installation, similar to RPM-DF features
Repolist: List all available repo
For example: [[email protected] ~]# Yum provides bash
650) this.width=650; "src=" Http://www.178linux.com/ueditor/php/upload/image/20150721/1437464021499132.png "title= "1437464021499132.png" alt= "Yum provides.png"/>
[email protected] ~]# Yum repolist
650) this.width=650; "src=" Http://www.178linux.com/ueditor/php/upload/image/20150721/1437464046594795.png "title= "1437464046594795.png" alt= "Yum repolist.png" width= "734" height= "272" style= "width:734px;height:272px;"/>
6.2, install, upgrade, downgrade, uninstall function
Yum [option] [information that needs to be queried] [parameters]
Install: Follow the required software
Reinstall: Back up the software that needs to be reinstalled
Update: Next to the software you need to upgrade to
Check-update: Check for available upgrade packages
Downgrade: Back to the version you need to downgrade to
Remove: Uninstalling the Software
Erase: Function ditto, uninstall
For example: [[email protected] yum.repos.d]# Yum install zlib-static
650) this.width=650; "src=" Http://www.178linux.com/ueditor/php/upload/image/20150721/1437464708114937.png "title= "1437464708114937.png" alt= "Yum install.png"/>
6.3. Functions related to software groups
Yum [group function] [software group]
Grouplist: List all available groups
GroupInfo: followed by group name, which can be used to understand the group contains the names of all groups
Groupinstall: Installing the entire set of software
Groupremove: Deleting software for a group
for example: [[email protected] yum.repos.d]# yum grouplist# All package groups are not listed, if you want to install a group can be installed directly using Groupinstall installed groups: #已经安装的软件组 Additional Development Base console internet tools development toolsinstalled language Groups: #已经安装的语言组 Arabic Support [ar] armenian support [hy] georgian support [ka]available groups: #有效软件组包文件 Backup client backup serveravailable language groups: #有效的语言组包文件 Afrikaans Support [af] Albanian SUPPORT [SQ]
6.4. Clean up the cache
Yum Clean {All | package | headers}
All: Delete all data, including meta data and software files
Package: Remove all downloaded software files
Headers: Delete all downloaded meta data files
For example [[email protected] yum.repos.d]# Yum clean all #这样将会清除所有的已下载的元数据和软件文件Loaded plugins:fastestmirror, securitycleaning Repos:base Extras updatescleaning up everythingcleaning up list of fastest mirrors
Vii. Summary of Knowledge
7.1. Yum is the front-end tool for RPM packages, which mainly solves the dependencies of packages
7.2. Need to know the Yum configuration file
Master profile/etc/yum.conf and warehouse configuration file /etc/yum.repos.d/*.repo
7.3. Yum press and hold function process
7.4. Yum commands
Install, uninstall, update, program group, clean cache, query and other functions
This article is from the "Crab Learn Linux" blog, please be sure to keep this source http://windchasereric.blog.51cto.com/5419433/1676777
Introduction and use of the second--yum of package Manager