The RPM is described in detail in the previous blog "Management--rpm Package Manager for Linux packages", but there is a problem? Is that RPM does not automatically resolve dependencies between packages. So there's an enhanced version of the RPM manager-yum.
The following is an example of the CentOS6 series.
First, Yum Introduction
YUM (Yellowdog Updater Modified) is a C/s architecture, why can it automatically solve the dependency relationship? This depends on the RPM repository in the YUM service, where we have the RPM-format packages we use most often.
1, the composition of the Yum Warehouse
Composition |
Content |
Data
|
Store each RPM package |
Meta data |
Package name, version information, dependencies, packet grouping information, dependency list. Following the SQLite format in CENTOS6, the resulting metadata directory is repodata. |
2. How Yum clients access the server
Take the upgrade as an example:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/3F/85/wKiom1PKQOHycOhCAAGR0TdSJ6A513.jpg "title=" 11111111111111111111111111111111111.jpg "alt=" Wkiom1pkqohycohcaagr0tdsj6a513.jpg "/>
3. How to configure the server and client of Yum
1) on the server side
First: Make sure that you have a Yum repository available on the server side. The Yum repository is actually a file server. The parent directory where the Repodata directory is located is a yum repository.
Second: The server side must be a way to share the Yum repository, can be used by clients, common sharing methods are: Ftp,http,nfs. If it is used locally (the client and server are the same machine), you can also use file mode.
2) Yum Client
Provides a repo configuration file that indicates the warehouse access path and various properties. Master profile (Central profile):/etc/yum.conf.
# Here you define some default configuration properties and global configuration properties [main]cachedir=/var/cache/yum/$basearch/$releaseverkeepcache =0debuglevel=2logfile=/var/ log/yum.logexactarch=1obsoletes=1gpgcheck=1plugins=1installonly_limit=5bugtracker_url=http://bugs.centos.org/ set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yumdistroverpkg= Centos-release
The configuration of a few related repositories is saved as a file, and the file names end in. Repo and are saved in the/ETC/YUM.REPO.D directory.
Here's a look at the file format (take the 163 image as an example):
[base] # indicates the name of the warehouse and the user can define the name=centos-$releasever - base - 163.com # is generally a description of the name of this warehouse # the key is this, indicating the access path to the warehouse # for ease of configuration, Yum introduces variables, four variables available in the Yum configuration file:# releasever: The version of the program, for Yum, refers to the redhat-release version, and replaces the main version number, such as redhat 6.5, with the 6; # arch: system schema # basearch: The basic architecture of system, such as i686,i586, is the i386; # yum0-9: of environment variables defined in the system, and the;# most commonly used in Yum is releasever and basearch# will be replaced at the time of access: Baseurl=# baseurl can use multiple: for example # baseurl=# # use the above format when using multiple BaseURL baseurl=http:// mirrors.163.com/centos/$releasever/os/$basearch/# mirrorlist=http://mirrorlist.centos.org/?release=$ Releasever&arch= $basearch &repo=os# baseurl and mirrlist usually require only one, and we generally configure baseurlgpgcheck=1 # Whether GPG detection (package integrity and legality) GPGKEY= # GPG detection is the key file # there are other types of selection, readers in the configuration, you can choose their own # commonly used are: # enable= {0|1} whether to enable the warehouse # cost=n the "cost" of the configuration warehouse, etc.The price is at the priority level. The smaller the meaning of N, the higher the priority.
By configuring these preparations, you can use the Yum tool.
Third, the use of Yum tools
Here is an example of an Internet 163 image for illustration.
1. List all available repo
Yum repolist {Enabled|disabled|all}
# yum repolist {enabled|disabled|all}# enabled List of available # disabled unavailable # all all the [[email protected] yum.repos.d]# yum repolistloaded plugins: Fastestmirror, refresh-packagekit, securityloading mirror speeds from cached hostfilebase | 3.7 kB 00:00 extras | 3.4 kb 00:00 updates | 3.4 kB 00:00 repo id repo name statusbase CentOS-6 - Base - 163.com 6,367extras centos-6 - extras - 163. com 14updates CentOS-6 - Updates - 163.com 1,153repolist: 7,534
2. List RPM Packages
Yum List {all|installed|available}
# Yum List {all|installed|available}# All lists all packages equivalent to Yum List # installed list installed packages # available list available packages (not including installed) # In general, this will make with [[email protected] yum.repos.d]# Yum List installed | grep "http" httpd.x86_64 2.2.15-26.el6.centoshttpd-tools.x86_64 2.2.15-26.el6.centos
3. Package Description Information
Yum Info package_name
loading mirror speeds from cached hostfileinstalled packagesname : httpdarch : x86 _64version : 2.2.15release : 26. el6.centossize : 2.9 mrepo : installedFrom repo : Anaconda-centos-201303050102.x86_64summary : apache http serverurl : http://httpd.apache.org/License : asl 2.0description : the apache http server is a powerful, efficient, and extensible : web server. Available packagesname : httpdarch : x86_64Version : 2.2.15Release : 30.el6.centosSize : 821 kRepo : updatessummary : apache http serverurl : http://httpd.apache.org/ License : asl 2.0description : the apache http Server is a powerful, efficient, and extensible : web server.
4. List all Package group information
Yum Grouplist
# often we will be like this to use [[email protected] yum.repos.d]# Yum grouplist | grep "Deve" Additional development Desktop Platform Development development tools Server Platform Development
5. Display the package group information: For example, the list of packages included in the group
Yum groupinfo "GROUP NAME"
[[email protected] yum.repos.d]# yum groupinfo "Development tools" Loaded plugins: fastestmirror, refresh-packagekit, securitysetting up group Processloading mirror speeds from cached hostfilegroup: development tools Description: A basic development environment. Mandatory Packages: autoconf automake binutils bison flex gcc gcc-c++ gettext libtool make patch pkgconfig redhat-rpm-config rpm-build Default Packages: byacc cscope ctags cvs diffstat doxygen elfutils gcc-gfortran git indent intltool patchutils rcs subversion swig systemtap Optional Packages: electricfence ant babel bzr chrpath cmake compat-gcc-34 compat-gcc-34-c++ compat-gcc-34-g77 cvs-inetd dejagnu expect gcc-gnat gcc-java gcc-objc gcc-objc++ imake jpackage-utils kdewebdev ksc libstdc++-docs mercurial mod_dav_svn nasm perltidy python-docs rpmdevtools rpmlint systemtap-sdT-devel systemtap-server
6. Clean up the cache
Yum Clean {all|packages|metadata|expire-cache|rpmdb|plugins}
# yum Clean {all|packages|metadata|expire-cache|rpmdb|plugins}# All cache # Packages Clear Package Cache # Metedata Clear metadata Cache # EXPIRE-CAC He clears the expiration cache # Rpmdb clears the RPM database Cache # Plufins clears the plugin cache # The most common is yum clean all[[email protected] yum.repos.d]# yum clean allloaded p Lugins:fastestmirror, Refresh-packagekit, securitycleaning repos:base extras updatescleaning up EverythingCleaning up L ist of Fastest Mirrors
7. Install Package
Yum Install Package_name
Yum Install httpd-y # Common option is-y means no confirmation required, direct installation
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/3F/85/wKiom1PKdIrQ2CS_AAS68Jnry00075.jpg "title=" 1213213213123.jpg "alt=" Wkiom1pkdirq2cs_aas68jnry00075.jpg "/>
Reinstall:
Yum Reinstall Package_name
Yum Reinstall httpd-y
8. Upgrade
Yum check-update: Check for available upgrade packages
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/3F/85/wKiom1PKd1iAcJ4pAADWasr_URw300.jpg "title=" Qwq.jpg "alt=" Wkiom1pkd1iacj4paadwasr_urw300.jpg "/>
Yum Update package_name upgrade software
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/3F/86/wKioL1PKeUmDibpIAAN3IyhKUU8012.jpg "title=" 4.jpg " alt= "Wkiol1pkeumdibpiaan3iyhkuu8012.jpg"/>
[Email protected] yum.repos.d]# rpm-q ntpntp-4.2.6p5-1.el6.centos.x86_64
Yum downgrade Package_name deprecated, back to the original version
# Yum Downgrade Ntp-y downgrade the first time there may be an error, one of the solutions is: Yum upgrade-y upgrade Yum tool [[email protected] yum.repos.d]# Yum downgrade Ntp-yloa Ded Plugins:fastestmirror, Refresh-packagekit, securitysetting up downgrade processloading mirror speeds from cached host Fileonly Upgrade available on package:ntp-4.2.6p5-1.el6.centos.x86_64nothing to do
9. Uninstall
Yum Remove|erase package_name
Yum Remove httpd-y
10. Query which package the file is generated by
Yum Whatprovides|provides/path/to/somefile
# all the packages that provide this profile are listed [[email protected] yum.repos.d]# Yum provides/etc/httpd/conf/httpd.conf Loaded plugins:fastestmirror , Refresh-packagekit, securityloading mirror speeds from cached Hostfilehttpd-2.2.15-30.el6.centos.x86_64:apache HTTP S erverrepo:updatesmatched From:filename:/etc/httpd/conf/httpd.confhttpd-2.2.15-29.el6.centos.x86_64:apache HTTP serverrepo:basematched from:filename:/etc/httpd/conf/httpd.confhttpd-2.2.15-30.el6.centos.x86_64:apac He HTTP serverrepo:installedmatched From:other:provides-match:/etc/httpd/conf/httpd.conf
11. installation package Group
Yum Groupinstall "GROUP NAME"
# Common packages include: # Desktop Platform Development Development Platform # Development Tools Development Package # For example: Yum groupinstall "Development tools"-Y
12. Unload Package Group
Yum groupremove "GROUP NAME"
Four, self-made Yum Warehouse
1, if used as an individual, the simplest way is to mount a disc image to use.
Take VMware virtual machines as an example:
To attach a disc image, mount a disc image and use it.
Where: BaseURL in. Repo uses file. Example: Baseurl=file:///media/centos
2. Self-built Yum Warehouse server
Take FTP as an example, step:
(1) Install the FTP program and start the service
# RPM-IVH vsftp-Version number
Or
# yum Install Vsftpd-y
Start the service
# service VSFTPD Start
# Chkconfig VSFTPD on
(2) FTP shared directory is/var/ftp/pub
Create subdirectories to hold all RPM packages that are relevant (recommended)
(3) Generate a metadata file for the warehouse so that it can be used as a warehouse
# RPM-IVH createrepo-Version number
Or
# yum Install Createrepo-y
# createrepo/path/to/rpm_repo/generate repo Metadata directory for example: Createrepo/var/ftp/pub/packages
(4) Configure the Yum client to use this repository
Summary: This article mainly introduces the use of the Yum tool, and briefly introduces the steps of the self-made Yum service.
This article is from the "Upstream Cold" blog, please be sure to keep this source http://guoting.blog.51cto.com/8886857/1440326
Linux software package Management--yum