Redhat 7使用CentOS 7的Yum网络源

简介:

由于redhat 的更新包只对注册的用户生效,所以需要自己手动更改成CentOS 的更新包,CentOS几乎和redhat是一样的,所以无需担心软件包是否可安装,安装之后是否有问题,另外CentOS公司去年已经被Redhat 收购了,下面是安装步骤。 
1、首先查看redhat 7.0系统本身所安装的那些yum 软件包:

[root@linuxprobe ~]# rpm -qa | grep yum
yum-utils-1.1.31-24.el7.noarch
yum-langpacks-0.4.2-3.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-rhn-plugin-2.0.1-4.el7.noarch
PackageKit-yum-0.8.9-11.el7.x86_64
yum-3.4.3-118.el7.noarch

2、卸载这些软件包;

[root@linuxprobe ~]# rpm -e yum-3.4.3-118.el7.noarch --nodeps
[root@linuxprobe ~]# rpm -e yum-utils-1.1.31-24.el7.noarch --nodeps
[root@linuxprobe ~]# rpm -e yum-rhn-plugin-2.0.1-4.el7.noarch --nodeps
[root@linuxprobe ~]# rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 --nodeps
[root@linuxprobe ~]# rpm -e yum-langpacks-0.4.2-3.el7.noarch --nodeps
[root@linuxprobe ~]# rpm -e PackageKit-yum-0.8.9-11.el7.x86_64 --nodeps

3、保证本机电脑能上网;

[root@linuxprobe ~]# ping www.baidu.co
PING www.a.shifen.com (61.135.169.121) 56(84) bytes of data.
64 bytes from 61.135.169.121: icmp_seq=1 ttl=53 time=31.8 ms
64 bytes from 61.135.169.121: icmp_seq=2 ttl=53 time=31.9 ms
64 bytes from 61.135.169.121: icmp_seq=3 ttl=53 time=32.0 ms

4、进入以下网站上面查看软件包的版本是否升级或者找到自己系统所对应的文件包版本更新;

网易163网络源地址:http://mirrors.163.com/
CentOS网络源地址:http://centos.ustc.edu.cn/centos/

5、找到自己所需要的版本下载:

[root@Linuxprobe ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-118.el7.centos.noarch.rpm
--2016-01-17 20:43:15--  http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-118.el7.centos.noarch.rpm
Resolving mirrors.163.com (mirrors.163.com)... 123.58.173.185, 123.58.173.186
Connecting to mirrors.163.com (mirrors.163.com)|123.58.173.185|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2016-01-17 20:43:15 ERROR 404: Not Found.   //如果找不到,是安装包更新了,你可以到这个网站http://mirrors.163.com/centos/7/os/x86_64/Packages/复制下载链接,然后再下载下来; 
[root@linuxprobe ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-132.el7.centos.0.1.noarch.rpm
[root@linuxprobe ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
[root@linuxprobe ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-34.el7.noarch.rpm 
[root@linuxprobe ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-34.el7.noarch.rpm
[root@linuxprobe ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm

6、查看下载完成结果;

[root@linuxprobe ~]# ls
yum-3.4.3-132.el7.centos.0.1.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
yum-updateonboot-1.1.31-34.el7.noarch.rpm
yum-utils-1.1.31-34.el7.noarch.rpm

7、安装软件包:

[root@Linuxprobe ~]# rpm -ivh yum-*
warning: yum-3.4.3-132.el7.centos.0.1.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
1:yum-metadata-parser-1.1.4-10.el7    ################################# [ 20%]
2:yum-plugin-fastestmirror-1.1.31-3   ################################# [ 40%]
3:yum-3.4.3-132.el7.centos.0.1        ################################# [ 60%]
4:yum-updateonboot-1.1.31-34.el7      ################################# [ 80%]
5:yum-utils-1.1.31-34.el7             ################################# [100%]

8、新建repo 配置文件;

[root@linuxprobe ~]# vim /etc/yum.repos.d/CentOS-Base.repo
#CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$7 - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$7 - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$7 - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$7 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

9、至此YUM 网络源已经安装完成;

[root@linuxprobe ~]# yum clean all

10、测试安装是否正常;

[root@Linuxprobe ~]# yum -y install lftp
Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package lftp.x86_64 0:4.4.8-7.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================================
Package              Arch                     Version                    Repository               Size
================================================================================================
Installing:
lftp                x86_64                    4.4.8-7.el7                base                     750 k
Transaction Summary
================================================================================================

Install  1 Package
………………省略部分安装过程………………
Installed:
lftp.x86_64 0:4.4.8-7.el7
Complete!

到这里安装完成,以后安装所需包,可以不用本地yum源了,直接使用网络yum源。



本文转自Linux就该这么学博客园博客,原文链接:http://www.cnblogs.com/linuxprobe/p/5432871.html,如需转载请自行联系原作者
相关文章
|
15天前
|
Linux
成功解决:CentOS7中无法连接网络
这篇文章介绍了如何解决CentOS 7虚拟机无法连接网络的问题。作者猜测问题可能是由于虚拟机软件的网关和CentOS 7系统的网关不一致导致的。文章提供了两种解决方案:修改虚拟网络编辑器的网关或修改CentOS系统的网关和IP地址。作者选择了后者,并演示了如何在CentOS终端中以root用户身份修改IP和网关。
成功解决:CentOS7中无法连接网络
|
16天前
|
关系型数据库 MySQL Linux
在CentOS上使用yum安装与使用MySQL
在CentOS操作系统上使用yum包管理器安装和配置MySQL数据库的详细步骤,包括下载MySQL的yum源配置、安装MySQL服务、启动和停止服务、设置开机自启动、获取临时密码、修改root用户密码、授权用户以及处理相关问题。同时,文章还包含了一些操作的截图,帮助用户更直观地理解安装和配置过程。
112 0
在CentOS上使用yum安装与使用MySQL
|
27天前
|
网络协议 Linux
CentOS7 yum安装报错“Could not resolve host: mirrorlist.centos.org;"之解决办法(换源)
CentOS7 yum安装报错“Could not resolve host: mirrorlist.centos.org; Name or service not known“之解决办法(换源)
|
11天前
|
缓存 Linux 网络安全
解决 CentOS 7 官方 yum 仓库无法使用的最佳实践
【8月更文挑战第18天】若 CentOS 7 的官方 YUM 仓库无法使用,可按以下步骤解决: 1. **检查网络连接**: - 确认服务器能正常上网,可通过访问外部网站或网络诊断测试。 - 检查防火墙设置,避免其阻挡 YUM 的网络访问。 2. **检查 YUM 配置**: - 核实 `/etc/yum.repos.d/` 下的 `CentOS-Base.repo` 文件中仓库地址正确无误。 - 确认配置文件内的 `enabled` 选项设为 `1` 以启用仓库。
|
16天前
|
Linux Docker 容器
在CentOS操作系统上使用yum安装/使用/卸载Docker容器引擎
在CentOS操作系统上安装、配置、使用和卸载Docker容器引擎的详细步骤,包括配置Docker镜像加速的方法。
90 0
|
16天前
|
网络协议 Linux 网络安全
Hyper-v 如何配置 Centos7 虚拟机网络?
Hyper-v 如何配置 Centos7 虚拟机网络?
|
18天前
|
jenkins Java Devops
CentOS 7上安装 Jenkins 2.346 -- yum 方式
CentOS 7上安装 Jenkins 2.346 -- yum 方式
20 0
|
18天前
|
jenkins Linux 持续交付
CentOS 7上安装 Jenkins 2.227 -- yum 方式
CentOS 7上安装 Jenkins 2.227 -- yum 方式
61 0
|
3月前
yum 可以安装rpm包
【6月更文挑战第18天】yum 可以安装rpm包
311 0
|
3天前
|
Oracle Java 关系型数据库
yum安装指定版本的openJDK
yum安装指定版本的openJDK
下一篇
云函数