CentOS6.9和7安装 yum

国内的yum仓库

http://mirrors.163.com/centos/7/os/x86_64/Packages/

http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/


1
CentOS7安装yum需要用到软件包:
网址:http://mirrors.163.com/centos/7/os/x86_64/Packages/ 进去找:
yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm

yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

yum-3.4.3-132.el7.centos.0.1.noarch.rpm

python-iniparse-0.4-9.el7.noarch.rpm
2
《1》首先需要安装python-iniparse
rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm
《2》安装剩下的三个yum


wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm
wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

[root@root1]# ll
wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm
wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

跟安装7步骤一样
《1》安装 python-iniparse
rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
《2》安装 yum
rpm -ivh --force yum-3.2.29-81.el6.centos.noarch.rpm yum-metadata-parser-1.1.2-16.el6.x86_64.rpm yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm

[1] 首先备份/etc/yum.repos.d/CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

[2] 进入yum源配置文件所在文件夹

cd /etc/yum.repos.d/

[3] 下载163或者阿里云的yum源配置文件,放入/etc/yum.repos.d/(操作前请做好相应备份)

163:
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

centos5:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

centos6:

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

centos7:

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

或者
《1》进去http://mirrors.163.com/.help/centos.html下载对应版本repo文件, 放入/etc/yum.repos.d/(操作前请做好相应备份)
《2》执行yum makecache时报错:
failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try.
http://mirrors.163.com/centos/$releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not
但是执行yum makecache时出现上述错误。

就把下载的CentOS7对应的repo文件中的$releasever全部改成对应版本6或者7
把不存在的网址的子路径删去即可
把gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6换成
gpgkey=http://mirror.163.com/centos/RPM-GPG-KEY-CentOS-6

[4] 运行yum makecache生成缓存
yum clean all
yum makecache

你可能感兴趣的:(Linux)