Redhat 7.0使用CentOS 7 的Yum 网络源
redhat 的更新包只对注册的用户生效,所以我们自己手动更改成CentOS 的更新包,CentOS几乎和redhat是一样的,所以无需担心软件包是否可安装,安装之后是否有问题,另外CentOS公司去年已经被Redhat 收购了,不说费话了,我们还是来操作吧!
1、首先查看redhat 7.0系统本身所安装的那些yum 软件包:
1[root@localhost ~]# rpm -qa | grep yum
2yum-utils-1.1.31-24.el7.noarch
3yum-langpacks-0.4.2-3.el7.noarch
4yum-metadata-parser-1.1.4-10.el7.x86_64
5yum-rhn-plugin-2.0.1-4.el7.noarch
6PackageKit-yum-0.8.9-11.el7.x86_64
7yum-3.4.3-118.el7.noarch
2、删除这些软件包/删除redhat原有的yum源(任选其一):
a)
1[root@localhost ~]# rpm -e yum-3.4.3-118.el7.noarch --nodeps
2[root@localhost ~]# rpm -e yum-utils-1.1.31-24.el7.noarch --nodeps
3[root@localhost ~]# rpm -e yum-rhn-plugin-2.0.1-4.el7.noarch --nodeps
4[root@localhost ~]# rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 --nodeps
5[root@localhost ~]# rpm -e yum-langpacks-0.4.2-3.el7.noarch --nodeps
6[root@localhost ~]# rpm -e PackageKit-yum-0.8.9-11.el7.x86_64 --nodeps
b)
1[root@localhost ~]# rpm -aq | grep yum|xargs rpm -e --nodeps
3、检查本机电脑是否正常链接到万维网。
1[root@localhost ~]# ping www.baidu.com
4、进入以下网站上面查看软件包的版本是否升级或者找到自己系统所对应的文件包版本更新;
1网易163网络源地址:http://mirrors.163.com/
2CentOS网络源地址:http://centos.ustc.edu.cn/centos/
5、找到自己所需要的版本下载,如果wget命令不能使用,首先安装wget.rpm。
1[root@localhost ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-118.el7.centos.noarch.rpm
2[root@localhost ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
3[root@localhost ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-24.el7.noarch.rpm
4[root@localhost ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-24.el7.noarch.rpm
5[root@localhost ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-24.el7.noarch.rpm
6、查看下载完成结果;
1[root@localhost ~]# ls
2yum-3.4.3-118.el7.centos.noarch.rpm
3yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
4yum-plugin-fastestmirror-1.1.31-24.el7.noarch.rpm
5yum-updateonboot-1.1.31-24.el7.noarch.rpm
6yum-utils-1.1.31-24.el7.noarch.rpm
7、安装软件包:
1[root@localhost ~]# rpm -ivh yum-*
8、更改yum源,新建repo 配置文件,这里使用网易的CentOS镜像源。
1[root@localhost ~]# cd /etc/yum.repos.d/
2[root@localhost ~]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
3[root@localhost ~]# vi CentOS6-Base-163.repo
编辑文件,把文件里面的$releasever全部替换为版本号,即7最后保存!或者直接把下面的内存拷贝到CentOS6-Base-163.repo文件中即可(已经修改好)
1*********************************************************************
2[base]
3name=CentOS-7 - Base - 163.com
4baseurl=http://mirrors.163.com/centos/7/os/$basearch/
5#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
6gpgcheck=1
7gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
8
9#released updates
10[updates]
11name=CentOS-7- Updates - 163.com
12baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
13#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
14gpgcheck=1
15gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
16
17#additional packages that may be useful
18[extras]
19name=CentOS-7 - Extras - 163.com
20baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
21#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
22gpgcheck=1
23gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
24
25#additional packages that extend functionality of existing packages
26[centosplus]
27name=CentOS-7 - Plus - 163.com
28baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/
29#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=centosplus
30gpgcheck=1
31enabled=0
32gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
33*******************************************************************************
9、至此yum 网络源已经安装完成,清理yum缓存,
# yum makecache
1[root@localhost ~]# yum clean all
2[root@localhost ~]# yum makecache
10、测试是否能从网络yum安装rpm包。
1[root@localhost ~]# yum -y install unixODBC