2015-12-04
#!/bin/bash ### AUTHOR: Leo ### DATE: 2015/12/4 ### NAME:yum.sh ### DESC:rhle配置yum仓库 #备份原有的repo文件 cd /etc/yum.repos.d && mkdir bak && mv *.repo bak #卸载rhel的yum命令 rpm -aq | grep yum|xargs rpm -e --nodeps #下载centos的yum命令安装包 wget http://mirrors.163.com/centos/6.7/os/x86_64/Packages/yum-3.2.29-69.el6.centos.noarch.rpm wget http://mirrors.163.com/centos/6.7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm wget http://mirrors.163.com/centos/6.7/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm wget http://mirrors.163.com/centos/6.7/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm #安装centos的yum命令 rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm rpm -ivh yum-3.2.29-69.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm #下载安装163、epel、rpmforge的repo文件 wget http://mirrors.163.com/.help/CentOS6-Base-163.repo wget http://mirrors.opencas.cn/epel/epel-release-latest-6.noarch.rpm wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm rpm -ivh epel-release-latest-6.noarch.rpm rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm #修改/etc/yum.repos.d/epel.repo 将 #baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch 改为 baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch #设置系统版本号为6 echo 6 > /etc/yum/vars/releasever #清除旧的yum缓存,并生成新缓存 yum clean all && yum makecache