您的位置:首页 > 其它

Redhat 7配置yum源

2016-10-26 18:01 351 查看
1、前提

由于redhat系统不再期官网注册,系统安装完成之后无法正常使用期yun源,因此更改redhat的yum源为CentOS的源

#系统环境

root@linuxprobe[06:22:13]:~$cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.2 (Maipo)

2、删除redhat自带的yum源

rpm -aq|grep yum|xargs rpm -e --nodeps3、从阿里云下载yum相关安装包
wget http://mirrors.aliyun.com/centos/7.2.1511/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm wget http://mirrors.aliyun.com/centos/7.2.1511/os/x86_64/Packages/yum-3.4.3-132.el7.centos.0.1.noarch.rpm wget http://mirrors.aliyun.com/centos/7.2.1511/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm4、rpm安装下载的yum包,按顺序执行下面命令 rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
rpm -ivh yum-3.4.3-132.el7.centos.0.1.noarch.rpm yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
5、创建文件/etc/yum.repos.d/aliyun.repo并写入

vim /etc/yum.repos.d/aliyun.repo

[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.aliyun.com/centos/7.2.1511/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/7.2.1511/os/x86_64/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.aliyun.com/centos/7.2.1511/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/7.2.1511/os/x86_64/RPM-GPG-KEY-CentOS-7

[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.aliyun.com/centos/7.2.1511/extras//$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/7.2.1511/os/x86_64/RPM-GPG-KEY-CentOS-7

[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.aliyun.com/centos/7.2.1511/centosplus//$basearch/
gpgcheck=1
enabled=06、创建aliyun前记得把redhat自带的源一走或者删除
yum clean all && yum makecache

7、测试源

yum update -y --skip-broken 

#能看到已经能够成功的通过yum安装相关软件包

如果报错:

wget http://mirrors.aliyun.com/centos/7.2.1511/os/x86_64/RPM-GPG-KEY-CentOS-7
rpm –import RPM-GPG-KEY-CentOS-7
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  yum