RHEL6.5 7.2更改为阿里云(aliyun)CentOS6 163 CentOS7的yum源
删除原有的yum包
redhat 的更新包只对注册的用户生效,所以我们自己手动更改成CentOS 的更新包,CentOS几乎和redhat是一样的,所以无需担心软件包是否可安装,安装之后是否有问题
rpm -qa | grep yum|xargs rpm -e --nodeps
rpm -aq|grep python-iniparse|xargs rpm -e --nodeps
–-nodeps强制删除
安装阿里云yum包
rpm -ivh http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
rpm -ivh http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-3.2.29-60.el6.centos.noarch.rpm
http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
添加源
cd /etc/yum.repos.d/
rm -rf *
wget -O /etc/yum.repos.d/rhel-source.repo http://mirrors.aliyun.com/repo/Centos-6.repo
sed -i 's/$releasever/6/g' rhel-source.repo
下载163的yum 安装包
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/python-iniparse-0.4-9.el7.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
安装下载的rpm包
rpm -ivh *.rpm
创建文件/etc/yum.repos.d/rhel-debuginfo.repo并写入
[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.163.com/centos/7.2.1511/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/7.2.1511/os/x86_64/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.163.com/centos/7.2.1511/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/7.2.1511/os/x86_64/RPM-GPG-KEY-CentOS-7
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.163.com/centos/7.2.1511/extras//$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/7.2.1511/os/x86_64/RPM-GPG-KEY-CentOS-7
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.163.com/centos/7.2.1511/centosplus//$basearch/
gpgcheck=1
enabled=0
清理yum缓存
yum clear all
将服务器上的软件包信息缓存到本地,以提高速度
yum makecache
测试安装
yum install httpd -y
配置网络yum源
RHEL6.5
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
[root@localhost ~]# sed -i 's/$releasever/6.8/g' /etc/yum.repos.d/CentOS-Base.repo
[root@localhost ~]# yum clean all
[root@localhost ~]# yum list
RHEL7.2
#使用参数-O来指定一个文件名
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[root@localhost ~]# sed -i 's/$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo
[root@localhost ~]# yum clean all
[root@localhost ~]# yum list
Centos系列配置方法
Epel配置
**注:配置网络yum时,为了避免之前的yum文件相互冲突,建议删除之间的配置文件
可直接执行rm -rf /etc/yum.repos.d/* 在执行相应配置**