The Yum of Linux package management tools

Source: Internet
Author: User
Tags gpg imagemagick

Yum (Yellow dog Updater, Modified) is an RPM package-based package management tool that automatically downloads rpm packages from a specified server and installs them, automates dependency relationships, and installs all dependent packages at once, without the hassle of downloading and installing them over and over again. For an introduction to RPM, please refer to http://blog.51cto.com/marvin89/2107904

Yum Simple flowchart:

Yum configuration file View

[[email protected] Packages]# rpm -q yumyum-3.4.3-154.el7.centos.noarch[[email protected] Packages]# rpm -qc yum/etc/logrotate.d/yum/etc/yum.conf/etc/yum/version-groups.conf

2-terminal configuration file

[[email protected] Packages]# man yum.conf#主配置[main]cachedir=/var/cache/yum/$basearch/$releaseverkeepcache=0    #debuglevel=2logfile=/var/log/yum.logexactarch=1    #centos6  centos7 之类是否精确匹配obsoletes=1gpgcheck=1    #来源合法性plugins=1    #支持插件机制installonly_limit=5bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yumdistroverpkg=centos-release   #仓库配置[repositoryID]name=Some name for this repository  #介绍baseurl=url://path/to/repository/      #必须跟repodata同一个目录enabled={1|0}gpgcheck={1|0}gpgkey=URL  #公钥 enablegroups={1|0} #用组的方式管理程序包failovermethod={roundrobin|priority}    默认为:roundrobin,意为随机挑选; baseurlcost=默认为1000  权重越高优先使用
Configure Yum with the CentOS CD as the repository

Prepare the Yum source CD disk?

[[email protected] rpm]# cd /mnt/dvd/[[email protected] dvd]# lsCentOS_BuildTag  EULA  images    LiveOS    repodata              RPM-GPG-KEY-CentOS-Testing-7EFI              GPL   isolinux  Packages  RPM-GPG-KEY-CentOS-7  TRANS.TBL

Configure the Warehouse

[[email protected] yum.repos.d]# vim /etc/yum.repos.d/local.repo[base]name=Base repo from cdbaseurl=file:///mnt/dvd/gpgcheck=1gpgkey=file:///mnt/dvd/RPM-GPG-KEY-CentOS-7

1. Display the Warehouse list:

 #repolist [all|enabled|disabled][[email protected] yum.repos.d]# yum repolistLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfilerepo id                               repo name                                        status!base                                 Base repo from cd                                9,591repolist: 9,591

2. Installation

 [[email protected] yum.repos.d]# yum install zsh-html   [#-y]    默认安装最新版本,安装老版本需要手动指定

3, upgrade, check upgrade (also can be a local package)

#升级[[email protected] yum.repos.d]# yum update  zsh-htmlLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfileNo packages marked for update-----------------------------------------------------------#检查升级[[email protected] yum.repos.d]# yum check-update zsh-htmlLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile

4. Uninstall will only unload the current package and the package that relies on the current package
Do not delete packages that depend on ImageMagick during installation? Because these packages depend on ImageMagick, not on

[[email protected] yum.repos.d]# yum install imagemagickdependencies resolved=================================                      ============================================================ Package Arch Version Repository size============================================================================================ =installing:imagemagick x86_64 6.7.8.9-15.el7_2 Base 2.1 minstalling for DEP                     Endencies:openexr-libs x86_64 1.7.1-7.el7 Base 217 k Avahi-libs x86_64 0.6.31-17.EL7 base Cairo x86_64 1.14        .8-2.el7 Base 713 K cups-libs x86_64 1:1.6.3-29.EL7 Base 356 k fontconfig x86_64 2.10.95-11.el7 base 229 k Fontpackages-file System Noarch 1.44-8.el7 Base 9.9 k gdk-pixbuf2 x86_64 2.36.5-1.EL7 Base 567 k Ghostscript x86_64 9.07-28.el7 base 4.3 M ghostscript-font S Noarch 5.50-32.el7 base 324 k graphite2 x86_64 1 .3.6-1.el7_2 base Harfbuzz k x86_64 1.3.2-1.el7 Ba                    SE 177 k ilmbase x86_64 1.0.3-7.el7 base k jasper-libs x86_64 1.900.1-31.el7 base ..... [[email protected] yum.repos.d]# yum remove imagemagickloaded plugins:fastestmirrorresolving Dependencies--> Running Transaction Check---> Package imagemagick.x86_64 0:6.7.8.9-15.el7_2 'll be erased--> finished Dependency R Esolutiondependencies resolved============================================================================================= Package Arch Version Repository size============================================================================================= Removing:imagemagick x86_64 6.7.8.9-15.el7_2 @base 7.6 mtransaction summary== ===========================================================================================remove 1 Package

Uninstalling ImageMagick's dependency package openexr-libs will also unload ImageMagick

  [[email protected] yum.repos.d]# yum Remove openexr-libsloaded plugins:fastestmirrorresolving dependencies--> Running Transaction Check---> Package openexr-libs.x86_64 0:1.7.1-7.el7 would be erased--> Processing dependency:libilmimf.so.7 () (64bit) for package:imagemagick-6.7.8.9-15.el7_2.x86_64--> Running Transaction Check---> Package imagemagick.x86_64 0:6.7.8.9-15.el7_2 'll be erased--> finished Dependency Resolutiondependencies resolved================================================================================ ============= Package Arch Version Repository size=================           ============================================================================removing:openexr-libs x86_64           1.7.1-7.EL7 @base 844 kremoving for Dependencies:imagemagick x86_64 6.7.8.9-15.el7_2 @base 7.6 M  

Personally feel that this unloading method is not very good, will remain a lot of useless bags

?
5. Display the package:

# yum list [all | glob_exp1] [glob_exp2] [...]# yum list {available|installed|updates} [glob_exp1] [...][[email protected] yum.repos.d]# yum listInstalled PackagesGeoIP.x86_64                                1.5.0-11.el7                           @anaconda #@表示安装过的。anaconda表示操作系统....zziplib-devel.i686                              0.13.62-5.el7                       base   #还未安装的zziplib-devel.x86_64                            0.13.62-5.el7                       basezsh-html.x86_64                             5.0.2-28.el7                          @base      #base源安装的

6, specific Package information view

[[email protected] yum.repos.d]# yum info ImageMagickLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfileInstalled PackagesName        : ImageMagickArch        : x86_64Version     : 6.7.8.9Release     : 15.el7_2Size        : 7.6 MRepo        : installedFrom repo   : baseSummary     : An X application for displaying and manipulating images....

7. See which package is provided by the specified attribute (which can be a file): equivalent to RPM-QF

# provides | whatprovides feature1 [feature2] [...][[email protected] yum.repos.d]# yum provides /etc/passwdLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfilesetup-2.8.71-7.el7.noarch : A set of system configuration and setup filesRepo        : baseMatched from:Filename    : /etc/passwdsetup-2.8.71-7.el7.noarch : A set of system configuration and setup filesRepo        : @anacondaMatched from:Filename    : /etc/passwd

8. Check the search package name and summary information with the keyword specified;

[[email protected] yum.repos.d]# yum search zshLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile===================================== N/S matched: zsh ======================================zsh-html.x86_64 : Zsh shell manual in html formatzsh.x86_64 : Powerful interactive shell  Name and summary matches only, use "search all" for everything.

9. Dependency Package View

[[email protected] yum.repos.d]# yum deplist bashLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfilepackage: bash.x86_64 4.2.46-28.el7  dependency: libc.so.6(GLIBC_2.15)(64bit)   provider: glibc.x86_64 2.17-196.el7  dependency: libdl.so.2()(64bit)......

10. View Yum Transaction history:

#history [info|list|packages-list|packages-info|summary|addon-info|redo|undo|rollback|new|sync|stats][[email protected] yum.repos.d]# yum historyLoaded plugins: fastestmirrorID     | Login user               | Date and time    | Action(s)      | Altered-------------------------------------------------------------------------------    17 | root <root>              | 2018-04-25 21:53 | Install        |    1    16 | root <root>              | 2018-04-25 21:49 | Erase          |    1    15 | root <root>              | 2018-04-25 21:49 | Install        |   48

11. Package Group View

[[email protected] yum.repos.d]# yum grouplistInstalled Groups:   .....Available Groups:   Compatibility Libraries   Console Internet Tools   Graphical Administration Tools   Development Tools    .....

12. Installation package Group

[[email protected] yum.repos.d]# yum groupinstall "Development Tools"# 升级 groupupdate group1 [group2] [...]

13, remove the package group

[[email protected] yum.repos.d]# yum groupremove  "Development Tools"

14, Package group information view

[[email protected] yum.repos.d]# yum groupinfo  "Development Tools"
Build Your own Yum source

1. Add a few RPM packages for the Yum source

[[email protected] yum.repos.d]# mkdir -p /yum/repo[[email protected] yum.repos.d]# cp /mnt/dvd/Packages/z* /yum/repo/

2, Centos7 need to install Createrepo

[[email protected] repo]# yum install createrepo

3. Initialize the Warehouse

[[email protected] repo]# pwd/yum/repo[[email protected] repo]# createrepo ../   #在上级目录下创建repodataSpawning worker 0 with 5 pkgsSpawning worker 1 with 5 pkgsSpawning worker 2 with 5 pkgsWorkers FinishedSaving Primary metadataSaving file lists metadataSaving other metadataGenerating sqlite DBsSqlite DBs complete[[email protected] repo]# cd ..[[email protected] yum]# ls repodata447ec135b1c7f6b6270eefc3c48487b7111af058b6a8e69d2752dff8fe692f10-filelists.sqlite.bz25bf5f6ef05024c6fa8323255156d043213eac62f765d4106d71e57e133e16990-other.xml.gz6c2ee7607b3b821acc6907604067e85d101fb4eecc6e10baa45086f26e0343f8-primary.sqlite.bz2c881c0f911ca54a1ade1d96280a04b8224a5d782522d555f7c6d1b528c2ddd7f-other.sqlite.bz2e018c8c524d20f6f30d26b42c909757eb2966a55c2f1a90d543602848db03384-filelists.xml.gzed266c67e84620208b4124883f03e6a8eaf0ba1d98a0dddd85c5a57beb8efbc4-primary.xml.gzrepomd.xml

4. Edit the configuration file

[myrepo]name=test repobaseurl=file:///yumgpgcheck=0

5. Use your own Yum source

[[email protected] repodata]# yum remove zsh[[email protected] repodata]# yum install zshloaded plugins: Fastestmirrormyrepo | 2.9 KB 00:00myrepo/primary_db | 9.2 KB 00:00loading Mirror speeds from cached hostfileresolving dependencies--> Running transaction Check---> Pack Age zsh.x86_64 0:5.0.2-28.el7 'll be installed--> finished Dependency resolutiondependencies resolved============== ================================================================= Package Arch Version R           Epository size===============================================================================installing:zsh x86_64 5.0.2-28.el7 Myrepo 2.4 mtransaction summary==================================== ===========================================install 1 packagetotal Download size:2.4 minstalled size:5.6 MIs this ok [y/ D/N]:

Yum for Linux package management tools

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.