Linux 7 中Yum 配置 说明

Posted 张冲andy

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux 7 中Yum 配置 说明相关的知识,希望对你有一定的参考价值。

在之前的Blog中写了Linux Yum 的配置方法,参考:

Linux 平台下 YUM 源配置 手册

http://www.cndba.cn/account/article/details/154

 

 

刚安装的Linux 7中测试发现有点注意事项。 在安装完系统之后,默认只有一个yum的配置文件。

 

[[email protected] mnt]# lsb_release -a
LSB Version:     :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: RedHatEnterpriseServer
Description:     Red Hat Enterprise Linux Server release 7.2 (Maipo)
Release:  7.2
Codename:      Maipo
[[email protected] mnt]#

如果没有lsb_release 命令,使用yum 安装即可,命令:yum install redhat-lsb*

 

 

在Yum的默认只有redhat.repo文件:

 

[[email protected] yum.repos.d]# pwd
/etc/yum.repos.d
[[email protected] yum.repos.d]# ll
total 8
-rw-r--r--. 1 root root 358 Mar  1 17:02 redhat.repo
[[email protected] yum.repos.d]# cat redhat.repo
#
# Certificate-Based Repositories
# Managed by (rhsm) subscription-manager
#
# *** This file is auto-generated.  Changes made here will be over-written. ***
# *** Use "subscription-manager repo-override --help" if you wish to make changes. ***
#
# If this file is empty and this system is subscribed consider
# a "yum repolist" to refresh available repos
 
[[email protected] yum.repos.d]#

 

 

根据里面的说明,这个redhat.repo 文件是自动生成的,不能在这里面写YUM的配置信息,否则会被覆盖掉。

 

所以我们这里直接touch 一个文件:dave.repo, 然后添加如下内容:

[[email protected] yum.repos.d]# cat dave.repo
[dave]
name=dave
baseurl=file:///mnt
enabled=1
gpgcheck=0
 
[[email protected] yum.repos.d]# yum clean all
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: dave
Cleaning up everything
[[email protected] yum.repos.d]#

 

然后就可以正常使用YUM了。

 

 

这里以安装Teamviewer为例:

[[email protected] ~]# rpm -ivh teamviewer_11.0.53191.i686.rpm
warning: teamviewer_11.0.53191.i686.rpm: Header V4 DSA/SHA1 Signature, key ID 72db573c: NOKEY
error: Failed dependencies:
         libSM.so.6 is needed by teamviewer-11.0.53191-0.i686
         libXdamage.so.1 is needed by teamviewer-11.0.53191-0.i686
         libXext.so.6 is needed by teamviewer-11.0.53191-0.i686
         libXfixes.so.3 is needed by teamviewer-11.0.53191-0.i686
         libXinerama.so.1 is needed by teamviewer-11.0.53191-0.i686
         libXrandr.so.2 is needed by teamviewer-11.0.53191-0.i686
         libXrender.so.1 is needed by teamviewer-11.0.53191-0.i686
         libXtst.so.6 is needed by teamviewer-11.0.53191-0.i686
         libasound.so.2 is needed by teamviewer-11.0.53191-0.i686
         libc.so.6(GLIBC_2.4) is needed by teamviewer-11.0.53191-0.i686
         libdbus-1.so.3 is needed by teamviewer-11.0.53191-0.i686
         libfontconfig.so.1 is needed by teamviewer-11.0.53191-0.i686
         libfreetype.so.6 is needed by teamviewer-11.0.53191-0.i686
         libgcc_s.so.1 is needed by teamviewer-11.0.53191-0.i686
         libjpeg.so.62 is needed by teamviewer-11.0.53191-0.i686
         libpng12.so.0 is needed by teamviewer-11.0.53191-0.i686
         libz.so.1 is needed by teamviewer-11.0.53191-0.i686
[[email protected] ~]#
 
这里少了很多的包,我们打上:
[[email protected] ~]# yum install libSM.so.6 libXdamage.so.1 libXext.so.6 libXfixes.so.3 libXinerama.so.1 libXrandr.so.2 libXrender.so.1 libXtst.so.6 libasound.so.2 libc.so.6 libdbus-1.so.3 libfontconfig.so.1 libfreetype.so.6 libgcc_s.so.1 libjpeg.so.62 libpng12.so.0 libz.so.1  -y
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
dave                                                                                                                                  | 4.1 kB  00:00:00    
(1/2): dave/group_gz                                                                                                                  | 136 kB  00:00:00    
(2/2): dave/primary_db                                                                                                                | 3.6 MB  00:00:00    
Resolving Dependencies
--> Running transaction check
---> Package alsa-lib.i686 0:1.0.28-2.el7 will be installed
---> Package dbus-libs.i686 1:1.6.12-13.el7 will be installed
---> Package fontconfig.i686 0:2.10.95-7.el7 will be installed
--> Processing Dependency: libexpat.so.1 for package: fontconfig-2.10.95-7.el7.i686
---> Package freetype.i686 0:2.4.11-11.el7 will be installed
---> Package glibc.i686 0:2.17-105.el7 will be installed
--> Processing Dependency: libfreebl3.so for package: glibc-2.17-105.el7.i686
--> Processing Dependency: libfreebl3.so(NSSRAWHASH_3.12.3) for package: glibc-2.17-105.el7.i686
---> Package libSM.i686 0:1.2.2-2.el7 will be installed
--> Processing Dependency: libICE.so.6 for package: libSM-1.2.2-2.el7.i686
--> Processing Dependency: libuuid.so.1 for package: libSM-1.2.2-2.el7.i686
--> Processing Dependency: libuuid.so.1(UUID_1.0) for package: libSM-1.2.2-2.el7.i686
---> Package libXdamage.i686 0:1.1.4-4.1.el7 will be installed
--> Processing Dependency: libX11.so.6 for package: libXdamage-1.1.4-4.1.el7.i686
---> Package libXext.i686 0:1.3.3-3.el7 will be installed
---> Package libXfixes.i686 0:5.0.1-2.1.el7 will be installed
---> Package libXinerama.i686 0:1.1.3-2.1.el7 will be installed
---> Package libXrandr.i686 0:1.4.2-2.el7 will be installed
---> Package libXrender.i686 0:0.9.8-2.1.el7 will be installed
---> Package libXtst.i686 0:1.2.2-2.1.el7 will be installed
--> Processing Dependency: libXi.so.6 for package: libXtst-1.2.2-2.1.el7.i686
---> Package libgcc.i686 0:4.8.5-4.el7 will be installed
---> Package libjpeg-turbo.i686 0:1.2.90-5.el7 will be installed
---> Package libpng12.i686 0:1.2.50-6.el7 will be installed
---> Package zlib.i686 0:1.2.7-15.el7 will be installed
--> Running transaction check
---> Package expat.i686 0:2.1.0-8.el7 will be installed
---> Package libICE.i686 0:1.0.9-2.el7 will be installed
---> Package libX11.i686 0:1.6.3-2.el7 will be installed
--> Processing Dependency: libxcb.so.1 for package: libX11-1.6.3-2.el7.i686
---> Package libXi.i686 0:1.7.4-2.el7 will be installed
---> Package libuuid.i686 0:2.23.2-26.el7 will be installed
---> Package nss-softokn-freebl.i686 0:3.16.2.3-13.el7_1 will be installed
--> Running transaction check
---> Package libxcb.i686 0:1.11-4.el7 will be installed
--> Processing Dependency: libXau.so.6 for package: libxcb-1.11-4.el7.i686
--> Running transaction check
---> Package libXau.i686 0:1.0.8-2.1.el7 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
=============================================================================================================================================================
 Package                                     Arch                          Version                                       Repository                     Size
=============================================================================================================================================================
Installing:
 alsa-lib                                    i686                          1.0.28-2.el7                                  dave                          391 k
 dbus-libs                                   i686                          1:1.6.12-13.el7                               dave                          151 k
 fontconfig                                  i686                          2.10.95-7.el7                                 dave                          229 k
 freetype                                    i686                          2.4.11-11.el7                                 dave                          388 k
 glibc                                       i686                          2.17-105.el7                                  dave                          4.2 M
 libSM                                       i686                          1.2.2-2.el7                                   dave                           39 k
 libXdamage                                  i686                          1.1.4-4.1.el7                                 dave                           20 k
 libXext                                     i686                          1.3.3-3.el7                                   dave                           39 k
 libXfixes                                   i686                          5.0.1-2.1.el7                                 dave                           18 k
 libXinerama                                 i686                          1.1.3-2.1.el7                                 dave                           14 k
 libXrandr                                   i686                          1.4.2-2.el7                                   dave                           25 k
 libXrender                                  i686                          0.9.8-2.1.el7                                 dave                           25 k
 libXtst                                     i686                          1.2.2-2.1.el7                                 dave                           20 k
 libgcc                                      i686                          4.8.5-4.el7                                   dave                          103 k
 libjpeg-turbo                               i686                          1.2.90-5.el7                                  dave                          137 k
 libpng12                                    i686                          1.2.50-6.el7                                  dave                          181 k
 zlib                                        i686                          1.2.7-15.el7                                  dave                           90 k
Installing for dependencies:
 expat                                       i686                          2.1.0-8.el7                                   dave                           80 k
 libICE                                      i686                          1.0.9-2.el7                                   dave                           64 k
 libX11                                      i686                          1.6.3-2.el7                                   dave                          610 k
 libXau                                      i686                          1.0.8-2.1.el7                                 dave                           29 k
 libXi                                       i686                          1.7.4-2.el7                                   dave                           40 k
 libuuid                                     i686                          2.23.2-26.el7                                 dave                           75 k
 libxcb                                      i686                          1.11-4.el7                                    dave                          202 k
 nss-softokn-freebl                          i686                          3.16.2.3-13.el7_1                             dave                          187 k
 
Transaction Summary
=============================================================================================================================================================
Install  17 Packages (+8 Dependent packages)
 
Total download size: 7.3 M
Installed size: 22 M
Downloading packages:
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                         39 MB/s | 7.3 MB  00:00:00    
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libgcc-4.8.5-4.el7.i686                                                                                                                  1/25
  Installing : nss-softokn-freebl-3.16.2.3-13.el7_1.i686                                                                                                2/25
  Installing : glibc-2.17-105.el7.i686                                                                                                                  3/25
  Installing : libICE-1.0.9-2.el7.i686                                                                                                                  4/25
  Installing : libuuid-2.23.2-26.el7.i686                                                                                                               5/25
  Installing : libXau-1.0.8-2.1.el7.i686                                                                                                                6/25
  Installing : libxcb-1.11-4.el7.i686                                                                                                                   7/25
  Installing : libX11-1.6.3-2.el7.i686                                                                                                                  8/25
  Installing : libXext-1.3.3-3.el7.i686                                                                                                                 9/25
  Installing : libXi-1.7.4-2.el7.i686                                                                                                                  10/25
  Installing : libXfixes-5.0.1-2.1.el7.i686                                                                                                            11/25
  Installing : libXrender-0.9.8-2.1.el7.i686                                                                                                           12/25
  Installing : zlib-1.2.7-15.el7.i686                                                                                                                  13/25
  Installing : freetype-2.4.11-11.el7.i686                                                                                                             14/25
  Installing : expat-2.1.0-8.el7.i686                                                                                                                  15/25
  Installing : fontconfig-2.10.95-7.el7.i686                                                                                                           16/25
  Installing : libpng12-1.2.50-6.el7.i686                                                                                                              17/25
  Installing : libXrandr-1.4.2-2.el7.i686                                                                                                              18/25
  Installing : libXdamage-1.1.4-4.1.el7.i686                                                                                                           19/25
  Installing : libXtst-1.2.2-2.1.el7.i686                                                                                                              20/25
  Installing : libXinerama-1.1.3-2.1.el7.i686                                                                                                          21/25
  Installing : libSM-1.2.2-2.el7.i686                                                                                                                  22/25
  Installing : libjpeg-turbo-1.2.90-5.el7.i686                                                                                                         23/25
  Installing : 1:dbus-libs-1.6.12-13.el7.i686                                                                                                          24/25
  Installing : alsa-lib-1.0.28-2.el7.i686                                                                                                              25/25
  Verifying  : libXext-1.3.3-3.el7.i686                                                                                                                 1/25
  Verifying  : fontconfig-2.10.95-7.el7.i686                                                                                                            2/25
  Verifying  : libICE-1.0.9-2.el7.i686                                                                                                                  3/25
  Verifying  : glibc-2.17-105.el7.i686                                                                                                                  4/25
  Verifying  : libXrandr-1.4.2-2.el7.i686                                                                                                               5/25
  Verifying  : libgcc-4.8.5-4.el7.i686                                                                                                                  6/25
  Verifying  : libXdamage-1.1.4-4.1.el7.i686                                                                                                            7/25
  Verifying  : nss-softokn-freebl-3.16.2.3-13.el7_1.i686                                                                                                8/25
  Verifying  : libxcb-1.11-4.el7.i686                                                                                                                   9/25
  Verifying  : libSM-1.2.2-2.el7.i686                                                                                                                  10/25
  Verifying  : libXinerama-1.1.3-2.1.el7.i686                                                                                                          11/25
  Verifying  : libuuid-2.23.2-26.el7.i686                                                                                                              12/25
  Verifying  : libjpeg-turbo-1.2.90-5.el7.i686                                                                                                         13/25
  Verifying  : libXau-1.0.8-2.1.el7.i686                                                                                                               14/25
  Verifying  : libXfixes-5.0.1-2.1.el7.i686                                                                                                            15/25
  Verifying  : libpng12-1.2.50-6.el7.i686                                                                                                              16/25
  Verifying  : libXtst-1.2.2-2.1.el7.i686                                                                                                              17/25
  Verifying  : zlib-1.2.7-15.el7.i686                                                                                                                  18/25
  Verifying  : freetype-2.4.11-11.el7.i686                                                                                                             19/25
  Verifying  : 1:dbus-libs-1.6.12-13.el7.i686                                                                                                          20/25
  Verifying  : alsa-lib-1.0.28-2.el7.i686                                                                                                              21/25
  Verifying  : libXrender-0.9.8-2.1.el7.i686                                                                                                           22/25
  Verifying  : libX11-1.6.3-2.el7.i686                                                                                                                 23/25
  Verifying  : expat-2.1.0-8.el7.i686                                                                                                                  24/25
  Verifying  : libXi-1.7.4-2.el7.i686                                                                                                                  25/25
 
Installed:
  alsa-lib.i686 0:1.0.28-2.el7         dbus-libs.i686 1:1.6.12-13.el7         fontconfig.i686 0:2.10.95-7.el7         freetype.i686 0:2.4.11-11.el7       
  glibc.i686 0:2.17-105.el7            libSM.i686 0:1.2.2-2.el7               libXdamage.i686 0:1.1.4-4.1.el7         libXext.i686 0:1.3.3-3.el7          
  libXfixes.i686 0:5.0.1-2.1.el7       libXinerama.i686 0:1.1.3-2.1.el7       libXrandr.i686 0:1.4.2-2.el7            libXrender.i686 0:0.9.8-2.1.el7     
  libXtst.i686 0:1.2.2-2.1.el7         libgcc.i686 0:4.8.5-4.el7              libjpeg-turbo.i686 0:1.2.90-5.el7       libpng12.i686 0:1.2.50-6.el7        
  zlib.i686 0:1.2.7-15.el7           
 
Dependency Installed:
  expat.i686 0:2.1.0-8.el7     libICE.i686 0:1.0.9-2.el7 libX11.i686 0:1.6.3-2.el7                   libXau.i686 0:1.0.8-2.1.el7 libXi.i686 0:1.7.4-2.el7
  libuuid.i686 0:2.23.2-26.el7 libxcb.i686 0:1.11-4.el7  nss-softokn-freebl.i686 0:3.16.2.3-13.el7_1
 
Complete!
[[email protected] ~]#
 
 
[[email protected] ~]# rpm -ivh teamviewer_11.0.53191.i686.rpm
warning: teamviewer_11.0.53191.i686.rpm: Header V4 DSA/SHA1 Signature, key ID 72db573c: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:teamviewer-11.0.53191-0          ################################# [100%]
[[email protected] ~]#

 

Teamviewer安装成功。

 

 转:http://www.cndba.cn/account/article/details/155

以上是关于Linux 7 中Yum 配置 说明的主要内容,如果未能解决你的问题,请参考以下文章

Redhat Linux 7 搭建局域网YUM

linux启动时报init错误;yum配置出错

Linux 7 Ansible 初学 配置被控制机器的 YUM 源

Linux 7 Ansible 初学 配置被控制机器的 YUM 源

CentOS7 配置 yum 源和 epel 源

Linux 配置本地 yum 源(6/7/8)