[root@centos6 ~]# yum -y install net-snmp net-snmp-utils
Loaded plugins: fastestmirror, security
Setting up Install Process
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base

解決方式
[root@centos6 ~]# cd /etc/yum.repos.d
[root@centos6 yum.repos.d]# vi CentOS-Base.repo

編輯以下三個區塊,用下列設定取代
[base]
name=CentOS-$releasever - Base
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
# baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=https://vault.centos.org/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

# released updates
[updates]
name=CentOS-$releasever - Updates
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
# baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=https://vault.centos.org/6.10/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

# additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
# baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
baseurl=https://vault.centos.org/6.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

存檔離開

清除暫存檔案
[root@centos6 yum.repos.d]# yum clean all

再試試剛剛的yum 安裝指令看看
如果遇到以下錯誤訊息
[root@centos6 yum.repos.d]# yum -y install net-snmp net-snmp-utils
Loaded plugins: fastestmirror, security
Setting up Install Process
Determining fastest mirrors
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

同一個目錄編輯 epel.repo
找到 [epel] 區段
用以下設定取代
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://archives.fedoraproject.org/pub/archive/epel/6/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

之後再試試
[root@centos6 yum.repos.d]# yum -y install net-snmp net-snmp-utils
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
epel                                                | 4.7 kB     00:00
epel/primary_db                                     | 6.1 MB     00:10
extras                                              | 3.4 kB     00:00
extras/primary_db                                                              |  29 kB     00:00
updates                                             | 3.4 kB     00:00
updates/primary_db                                                             |  12 MB     01:26
Resolving Dependencies
--> Running transaction check
---> Package net-snmp.x86_64 1:5.5-60.el6_10.2 will be installed
--> Processing Dependency: net-snmp-libs = 1:5.5-60.el6_10.2 for package: 1:net-snmp-5.5-60.el6_10.2.x86_64
--> Processing Dependency: libsensors.so.4()(64bit) for package: 1:net-snmp-5.5-60.el6_10.2.x86_64
--> Processing Dependency: libnetsnmptrapd.so.20()(64bit) for package: 1:net-snmp-5.5-60.el6_10.2.x86_64
--> Processing Dependency: libnetsnmpmibs.so.20()(64bit) for package: 1:net-snmp-5.5-60.el6_10.2.x86_64
--> Processing Dependency: libnetsnmphelpers.so.20()(64bit) for package: 1:net-snmp-5.5-60.el6_10.2.x86_64
--> Processing Dependency: libnetsnmpagent.so.20()(64bit) for package: 1:net-snmp-5.5-60.el6_10.2.x86_64
--> Processing Dependency: libnetsnmp.so.20()(64bit) for package: 1:net-snmp-5.5-60.el6_10.2.x86_64
---> Package net-snmp-utils.x86_64 1:5.5-60.el6_10.2 will be installed
--> Running transaction check
---> Package lm_sensors-libs.x86_64 0:3.1.1-17.el6 will be installed
---> Package net-snmp-libs.x86_64 1:5.5-60.el6_10.2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================
 Package                           Arch                     Version                              Repository                 Size
=================
Installing:
 net-snmp                          x86_64                   1:5.5-60.el6_10.2                    updates                   309 k
 net-snmp-utils                    x86_64                   1:5.5-60.el6_10.2                    updates                   177 k
Installing for dependencies:
 lm_sensors-libs                   x86_64                   3.1.1-17.el6                         base                       38 k
 net-snmp-libs                     x86_64                   1:5.5-60.el6_10.2                    updates                   1.5 M

Transaction Summary
=================
Install       4 Package(s)

Total download size: 2.1 M
Installed size: 6.7 M
Downloading Packages:
(1/4): lm_sensors-libs-3.1.1-17.el6.x86_64.rpm                                 |  38 kB     00:00
(2/4): net-snmp-5.5-60.el6_10.2.x86_64.rpm                                     | 309 kB     00:00
(3/4): net-snmp-libs-5.5-60.el6_10.2.x86_64.rpm                                | 1.5 MB     00:01
(4/4): net-snmp-utils-5.5-60.el6_10.2.x86_64.rpm                               | 177 kB     00:00
---------------------------------------------------------------------------------------------------
Total                                      619 kB/s | 2.1 MB     00:03
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : lm_sensors-libs-3.1.1-17.el6.x86_64                                                1/4
  Installing : 1:net-snmp-libs-5.5-60.el6_10.2.x86_64                                             2/4
  Installing : 1:net-snmp-utils-5.5-60.el6_10.2.x86_64                                            3/4
  Installing : 1:net-snmp-5.5-60.el6_10.2.x86_64                                                  4/4
  Verifying  : 1:net-snmp-libs-5.5-60.el6_10.2.x86_64                                             1/4
  Verifying  : 1:net-snmp-utils-5.5-60.el6_10.2.x86_64                                            2/4
  Verifying  : 1:net-snmp-5.5-60.el6_10.2.x86_64                                                  3/4
  Verifying  : lm_sensors-libs-3.1.1-17.el6.x86_64                                                4/4

Installed:
  net-snmp.x86_64 1:5.5-60.el6_10.2                            net-snmp-utils.x86_64 1:5.5-60.el6_10.2

Dependency Installed:
  lm_sensors-libs.x86_64 0:3.1.1-17.el6                          net-snmp-libs.x86_64 1:5.5-60.el6_10.2

Complete!

恭喜,成功了

undefined

arrow
arrow
    文章標籤
    centos linux yum
    全站熱搜

    helloworld 發表在 痞客邦 留言(0) 人氣()