qq78707 发表于 2018-5-10 09:35:15

Redhat 7.0使用163网易CentOS 7 的Yum 网络源

  1、首先查看redhat 7.0系统本身所安装的那些yum 软件包:
# 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
  2、删除这些软件包;
# rpm -e yum-3.4.3-118.el7.noarch --nodeps
# rpm -e yum-utils-1.1.31-24.el7.noarch --nodeps
# rpm -e yum-rhn-plugin-2.0.1-4.el7.noarch --nodeps
# rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 --nodeps
# rpm -e yum-langpacks-0.4.2-3.el7.noarch --nodeps
# rpm -e PackageKit-yum-0.8.9-11.el7.x86_64 --nodeps
  3、本机电脑得能上网;
# ping 8.8.8.8
  PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
  64 bytes from 8.8.8.8: icmp_seq=1 ttl=48 time=51.3 ms
  64 bytes from 8.8.8.8: icmp_seq=2 ttl=48 time=49.5 ms
  4、进入以下网站上面查看软件包的版本是否升级或者找到自己系统所对应的文件包版本更新;
  网易163网络源地址:http://mirrors.163.com/
  CentOS网络源地址:http://centos.ustc.edu.cn/centos/
  5、找到自己所需要的版本下载:
# wget http://mirrors.163.com/centos/7.2.1511/os/x86_64/Packages/yum-3.4.3-132.el7.centos.0.1.noarch.rpm   
# wget http://mirrors.163.com/centos/7.2.1511/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
# wget http://mirrors.163.com/centos/7.2.1511/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
# wget http://mirrors.163.com/centos/7.2.1511/os/x86_64/Packages/yum-utils-1.1.31-34.el7.noarch.rpm
# wget http://mirrors.163.com/centos/7.2.1511/os/x86_64/Packages/yum-updateonboot-1.1.31-34.el7.noarch.rpm
  6、查看下载完成结果;
# ls
  yum-3.4.3-132.el7.centos.0.1.noarch
  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
  7、安装软件包:
# rpm -ivh yum-*
  warning: yum-3.4.3-132.el7.centos.0.1.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
  Preparing...                        #################################
  Updating / installing...
  1:yum-metadata-parser-1.1.4-10.el7 ################################# [ 20%]
  2:yum-plugin-fastestmirror-1.1.31-3################################# [ 40%]
  3:yum-3.4.3-132.el7.centos.0.1   ################################# [ 60%]
  4:yum-updateonboot-1.1.31-34.el7   ################################# [ 80%]
  5:yum-utils-1.1.31-34.el7          #################################
  8、新建repo 配置文件;
# 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.
  #
  #

  name=CentOS-$releasever - Base - 163.com
  #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&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

  name=CentOS-$releasever - Updates - 163.com
  #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&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

  name=CentOS-$releasever - Extras - 163.com
  #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&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

  name=CentOS-$releasever - 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
  vim 修改下载来的文件,把其中的$releasever全部替换成7,保存,参考命令:s/$releasever/7/g
  9、至此YUM 网络源已经安装完成;
# yum clean all
页: [1]
查看完整版本: Redhat 7.0使用163网易CentOS 7 的Yum 网络源