CentOS6.8
脚本:
#安装yum所需的包已经下载到本地
#!/bin/bash
rpm -qa | grep yum | xargs rpm -e --nodeps
rm -rf /etc/yum.conf
rm -rf /etc/yum.repos.d/*
rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm yum-3.2.29-81.el6.centos.noarch.rpm
cd /etc/yum.repos.d/
wget http://mirrors.aliyun.com/repo/Centos-6.repo
sed -i 's/$releasever/6/g' /etc/yum.repos.d/Centos-6.repo
yum clean all
yum makecache
yum repolist
if [ $? = 0 ];then
echo "successful"
else
echo "failed"
fi