centos7.2從新安裝yum

[root@zf-test-web01-4 ~]# yum install rng-tools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 You can enable repos with yum-config-manager --enable <repo>html

紅色部分問題解決以下:node

-bash-4.2# vi /etc/yum/pluginconf.d/fastestmirror.conf web


[main]
enabled=0
verbose=0
always_print_best_host = true
socket_timeout=3
#  Relative paths are relative to the cachedir (and so works for users as well
# as root).
hostfilepath=timedhosts.txt
maxhostfileage=10
maxthreads=15
#exclude=.gov, facebookcentos

 

把enabled=1改成enabled=0緩存

再次執行yum安裝,仍報錯bash

[root@zf-test-web01-4 ~]# yum install -y rng-tools
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 You can enable repos with yum-config-manager --enable <repo>socket

也就是藍色部分,解決辦法:網站

1. 查看centos7.2系統自己所安裝的那些yum 軟件包ui

[root@zf-test-web01-4 ~]# rpm -qa|grep yum
yum-plugin-fastestmirror-1.1.31-34.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-3.4.3-132.el7.centos.0.1.noarchcentos7

[root@zf-test-web01-4 ~]# 

 

2. 卸載這些軟件包

[root@zf-test-web01-4 ~]# rpm -e yum-plugin-fastestmirror-1.1.31-34.el7.noarch --nodeps
warning: /etc/yum/pluginconf.d/fastestmirror.conf saved as /etc/yum/pluginconf.d/fastestmirror.conf.rpmsave
[root@zf-test-web01-4 ~]# rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 --nodeps
[root@zf-test-web01-4 ~]# rpm -e yum-3.4.3-132.el7.centos.0.1.noarch --nodeps
[root@zf-test-web01-4 ~]# 

 

3. 進入centos鏡像網站找到本身對應系統須要的yum包

    查看系統的命令:

[root@zf-test-web01-4 ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core) 

   查看系統的位數:

[root@zf-test-web01-4 ~]# file /bin/ls
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=aa7ff68f13de25936a098016243ce57c3c982e06, stripped

 

http://vault.centos.org/

 

4. 下載這些yum包

wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://vault.centos.org/7.2.1511/os/x86_64/Packages/yum-3.4.3-132.el7.centos.0.1.noarch.rpm

 

5. 安裝下載的這些yum包

[root@zf-test-web01-4 ~]# rpm -ivh yum-*
Preparing...                          ################################# [100%]
Updating / installing...
   1:yum-metadata-parser-1.1.4-10.el7 ################################# [ 33%]
   2:yum-plugin-fastestmirror-1.1.31-3################################# [ 67%]
   3:yum-3.4.3-132.el7.centos.0.1     ################################# [100%]
[root@zf-test-web01-4 ~]# 

 

6. 更新centos系統的repo文件

http://mirrors.163.com/.help/centos.html

1)首先備份/etc/yum.repos.d/CentOS-Base.repo

[root@zf-test-web01-4 yum.repos.d]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2)下載對應版本repo文件, 放入/etc/yum.repos.d/(操做前請作好相應備份)

3)運行如下命令生成緩存

[root@zf-test-web01-4 yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Cleaning repos: base extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
[root@zf-test-web01-4 yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
base                                                             | 3.6 kB  00:00:00     
extras                                                           | 3.4 kB  00:00:00     
updates                                                          | 3.4 kB  00:00:00     
(1/12): base/7/x86_64/group_gz                                   | 156 kB  00:00:00     
(2/12): base/7/x86_64/filelists_db                               | 6.7 MB  00:00:01     
(3/12): extras/7/x86_64/prestodelta                              |  71 kB  00:00:00     
(4/12): extras/7/x86_64/primary_db                               | 145 kB  00:00:00     
(5/12): extras/7/x86_64/filelists_db                             | 528 kB  00:00:00     
(6/12): extras/7/x86_64/other_db                                 |  97 kB  00:00:00     
(7/12): updates/7/x86_64/prestodelta                             | 589 kB  00:00:00     
(8/12): base/7/x86_64/primary_db                                 | 5.7 MB  00:00:01     
(9/12): base/7/x86_64/other_db                                   | 2.5 MB  00:00:00     
(10/12): updates/7/x86_64/primary_db                             | 4.5 MB  00:00:00     
(11/12): updates/7/x86_64/other_db                               | 490 kB  00:00:00     
(12/12): updates/7/x86_64/filelists_db                           | 2.7 MB  00:00:01     
Determining fastest mirrors
Metadata Cache Created

 

7. 從新運用yum安裝軟件

相關文章
相關標籤/搜索