redhat 7安装CentOS 7 yum源

 由于redhat 的更新包只对注册的用户生效,所以需要自己手动更改成CentOS 的更新包,CentOS几乎和redhat是一样的,所以无需担心软件包是否可安装,下面是安装步骤。
1、首先查看redhat 7.0系统本身所安装的那些yum 软件包:
[root@pan ~]# 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@pan ~]# rpm -e yum-3.4.3-118.el7.noarch --nodeps
[[email protected] ~]# rpm -e yum-utils-1.1.31-24.el7.noarch --nodeps
[[email protected] ~]# rpm -e yum-rhn-plugin-2.0.1-4.el7.noarch --nodeps
[[email protected] ~]# rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 --nodeps
[[email protected] ~]# rpm -e yum-langpacks-0.4.2-3.el7.noarch --nodeps
[[email protected] ~]# rpm -e PackageKit-yum-0.8.9-11.el7.x86_64 --nodeps

3、保证本机电脑能上网;
[root@pan ~]# ping www.baidu.com
PING www.a.shifen.com (163.177.151.110) 56(84) bytes of data.
64 bytes from 163.177.151.110: icmp_seq=1 ttl=49 time=13.1 ms
64 bytes from 163.177.151.110: icmp_seq=2 ttl=49 time=6.80 ms
64 bytes from 163.177.151.110: icmp_seq=3 ttl=49 time=6.77 ms
^C
--- www.a.shifen.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2007ms
rtt min/avg/max/mdev = 6.777/8.917/13.168/3.006 ms

4、进入以下网站上面查看软件包的版本是否升级或者找到自己系统所对应的文件包版本更新;
网易163网络源地址:http://mirrors.163.com/
CentOS网络源地址:http://centos.ustc.edu.cn/centos/

5、找到自己所需要的版本下载:
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-150.el7.centos.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-40.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-40.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-40.el7.noarch.rpm

6、查看下载完成结果;
[root@pan ~]# ls
anaconda-ks.cfg                              yum-plugin-fastestmirror-1.1.31-40.el7.noarch.rpm
initial-setup-ks.cfg                         yum-updateonboot-1.1.31-40.el7.noarch.rpm
yum-3.4.3-150.el7.centos.noarch.rpm          yum-utils-1.1.31-40.el7.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

7、安装软件包:
[root@pan ~]# rpm -ivh yum-*
warning: yum-3.4.3-150.el7.centos.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
error: Failed dependencies:
        python-urlgrabber >= 3.10-8 is needed by yum-3.4.3-150.el7.centos.noarch     

这里出现了一个小问题~~~:安装的python-urlgrabber版本不符合您尝试安装的RPM的依赖关系,我目前没有能力解决这个问题的办法,后来想了一个折中的办法,FQ去一个国外的yum源网站下载上面这五个较低版本的安装包,在来安装就不会有问题了
在这里附上链接各位可以FQ出去下载对应版本的rpm包
    链接:http://rpm.pbone.net/
    不报错版本安装包:
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

我把这五个rpm包下载到我的windows电脑里,然后用WinSCP这个软件上传到redhat 7 系统里,WinSCP这个软件的使用方法就不在这里赘述了

8、下载好后重新安装:
[root@pan ~]# ls
yum-3.4.3-132.el7.centos.0.1.noarch.rpm            yum-updateonboot-1.1.31-34.el7.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm        yum-utils-1.1.31-34.el7.noarch.rpm
yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
[root@pan ~]# 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%]
[[email protected] ~]#
这次没有报错了,安装完成!!!

9、新建repo 配置文件;

[root@pan ~]# 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

10、清除缓存:

[root@pan ~]# yum clean all
Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: base extras updates
Cleaning up everything

11、测试安装是否正常;

[root@pan ~]# 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.
base                                                                                            | 3.6 kB  00:00:00
extras                                                                                          | 3.4 kB  00:00:00
updates                                                                                         | 3.4 kB  00:00:00
(1/4): extras/x86_64/primary_db                                                                 | 139 kB  00:00:00
(2/4): base/x86_64/group_gz                                                                     | 155 kB  00:00:00
(3/4): updates/x86_64/primary_db                                                                | 3.9 MB  00:00:01
(4/4): base/x86_64/primary_db                                                                   | 5.6 MB  00:00:02
Determining fastest mirrors
Resolving Dependencies
--> Running transaction check
---> Package lftp.x86_64 0:4.4.8-8.el7_3.2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================
Package                 Arch                      Version                            Repository                  Size
=======================================================================================================================
Installing:
lftp                    x86_64                    4.4.8-8.el7_3.2                    updates                    751 k

Transaction Summary
=======================================================================================================================
Install  1 Package

~~~~~此处省略安装输出内容~~~~
Installed:
  lftp.x86_64 0:4.4.8-8.el7_3.2                                                                                       

Complete!

到这里安装完成,以后安装所需包,可以不用本地yum源了,直接使用网络yum源。
时间: 2024-10-21 10:27:37

redhat 7安装CentOS 7 yum源的相关文章

在Rethat上安装Centos的yum源

首先因为Rethat的yum源要去订阅(当然是需要钱的),所以许多朋友都是以Centos的yum源来代替(Centos是开源的) 安转: 1:卸载原有Rethat的yum源 #rpm -aq|grep yum|xargs rpm -e --nodeps 2:下载需要的rpm包(Centos的yum安装包) #Wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-73.el6.centos.noarch.rpm #Wg

redhat 系统和centos系统配置yum 源的几种方法

          红帽或centos系统配置yum源 本地配置yum 源:光驱仓库,ISO仓库(一般适用于红帽linux,(因为它没有配不然怎么收钱)或者没有联网的centos系统, (都是配好的网源,只要可以联网就可以进行yum操作)) 文档带图片链接    http://pan.baidu.com/s/1c2G6Xyg    (https://yunpan.cn/Oc6mzj4mLwgDzC  访问密码 d35c ) 一.虚拟机中有光驱(虚拟机中光盘的位置)挂载的情况: (1)找到光驱的位

[转载]Redhat Enterprise 6.1 如何使用免费的CentOS的yum源

Redhat Enterprise 6.1 如何使用免费的CentOS的yum源 graybull posted @ 2013年2月18日 22:29 in Unix/Linux with tags centos free redhat Source yum , 3938 阅读 Redhat Enterprise Linux 6.1 x86_64 使用官方yum源是需要收费的,本文将讲解如何使用免费的CentOS的yum源来安装/更新软件.分成以下几步: 卸载已有的yum 下载CentOS的yu

redhat配置centos的yum源

redhat默认不支持第三方的yum源,要求有rhn账号,下面就rhel5和rhel6改为centos源 一.rhel5.5 X86_64更改为centos的yum源 查看系统自带的yum相关的rpm包  rpm -qa|grep yum 删掉系统自带的yum相关的包 rpm -e --nodeps yum-updatesd-0 rpm -e --nodeps yum-security   rpm -e --nodeps yum-metadata-p rpm -e --nodeps yum-rh

Redhat 7 yum源换成centos的YUM 源

背景:作者打算在Redhat 做kvm虚拟化的时候在安装 virt-manager发现 提示要注册红帽的yum源,简单说要钱呗.要钱那是不可能给你的,所以有以下有centos的yum源替换redhat7的yum源. 前景概括(步骤总结) 卸载原有的yum的rpm包 去阿里镜像站下载centos必要的yum包 rpm -ivh yum- 安装相对应的rpm 去阿里镜像站下载 centos-base.repo,并修改 清楚yum缓存,再重新生成缓存 测试 使用 yum -y install xxx

CentOS使用yum源中自带的rpm包安装LAMP环境

CentOS使用yum源中自带的rpm包安装LAMP环境.这是Linux下安装LAMP的环境一种最基本最简便的方式.新手可以从容安装使用. 1. 安装基础包(可选安装)yum install -y wget zip unzip gzipyum install -y python ruby perlyum install -y gc gcc gcc-c++ 2. 安装php及其相关组件yum install -y php php-gdyum install -y php-mbstring php-

redhat配置centos网络yum源

方案一: 配置网络yum源rpm -ivh vsftpd-2.2.2-6.el6_0.1.x86_64service vsftpd restartchkconfig --level 35 vsftpd oncd /var/ftp/pub/mkdir yum把上面的挂载点改成/var/ftp/pub/yumvim /etc/yum.repos.d/rhel-source.repo[server]name=serverbaserul=ftp://pub/yum/Server/  #(注意要挂载光驱)

centOS 第三方YUM源

1.安装CentOS yum源优先级插件yum-priorities来设置YUM优先级 yum install yum-plugin-priorities.noarch 2.设置CentOS默认yum源的优先级为最高 cd  /etc/yum.repos.d/ vi CentOS-Base.repo #在[base].[updates].[extras]组下面添加priority=1,在[centosplus].[contrib]组下面添加priority=2 备注:priority的优先级为1

CentOS更新yum源的方法

一.下载国内比较稳定的yum源,我这里下载163的源 同时我使用的是CentOS6.2的x86_64版本,所以下载的是CentOS6-Base-163.repo 请根据,如下方法确认自己系统的版本 [[email protected] ~]# lsb_release -a LSB Version: :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4