一、首先查看RHEL7.0系統自己所安裝的那些yum 軟件包:node
[root@max ~]# rpm -qa | grep yum yum-utils-1.1.31-24.el7.noarch yum-langpacks-0.4.2-3.el7.noarch yum-metadata-parser-1.1.4-10.el7.x86_64 yum-rhn-plugin-2.0.1-4.el7.noarch PackageKit-yum-0.8.9-11.el7.x86_64 yum-3.4.3-118.el7.noarch 二、卸載這些軟件包: [root@max ~]# rpm -e yum-3.4.3-118.el7.noarch --nodeps [root@max ~]# rpm -e yum-utils-1.1.31-24.el7.noarch --nodeps [root@max ~]# rpm -e yum-rhn-plugin-2.0.1-4.el7.noarch --nodeps [root@max ~]# rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 --nodeps [root@max ~]# rpm -e yum-langpacks-0.4.2-3.el7.noarch --nodeps [root@max ~]# rpm -e PackageKit-yum-0.8.9-11.el7.x86_64 --nodeps [root@max ~]# rpm -e python-urlgrabber-3.10-4.el7.noarch.rpm 【依賴關係】 三、保證本機電腦能上網; [root@max ~]# ping www.baidu.co PING www.a.shifen.com (61.135.169.121) 56(84) bytes of data. 64 bytes from 61.135.169.121: icmp_seq=1 ttl=53 time=31.8 ms 64 bytes from 61.135.169.121: icmp_seq=2 ttl=53 time=31.9 ms 64 bytes from 61.135.169.121: icmp_seq=3 ttl=53 time=32.0 ms 4.找到本身所須要的版本下載: http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-118.el7.centos.noarch.rpm http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-132.el7.centos.0.1.noarch.rpm http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-34.el7.noarch.rpm http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-34.el7.noarch.rpm http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
七、安裝軟件包: [root@max ~]# ls python-urlgrabber-3.10-8.el7.noarch.rpm yum-3.4.3-132.el7.centos.0.1.noarch.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm yum-updateonboot-1.1.31-34.el7.noarch.rpm yum-utils-1.1.31-34.el7.noarch.rpm [root@max ~]# rpm -ivh python-urlgrabber-3.10-8.el7.noarch.rpm [root@max ~]# rpm -ivh yum-* 八、新建repo 配置文件; [root@max ~]# vim /etc/yum.repos.d/CentOS-Base.repo #CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$7 - Base - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=os baseurl=http://mirrors.163.com/centos/7/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$7 - Updates - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=updates baseurl=http://mirrors.163.com/centos/7/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$7 - Extras - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=extras baseurl=http://mirrors.163.com/centos/7/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$7 - Plus - 163.com baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 九、至此YUM 網絡源已經安裝完成; [root@max ~]# yum clean all [root@max ~]# yum update