[Linux]Redhat7配置CentOS7 YUM源
一、简介
安装Redhat7并配置了网卡之后,虽然可以直接ping www.baidu.com,但是执行yum install的命令时提示如下信息:
[root@ansible ~]# yum install -y vim
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
There are no enabled repos.
Run "yum repolist all" to see the repos you have.
To enable Red Hat Subscription Management repositories:
subscription-manager repos --enable <repo>
To enable custom repositories:
yum-config-manager --enable <repo>
原因在于redhat 的更新包只对注册的用户生效,所以需要自己手动更改成CentOS 的更新包,CentOS几乎和redhat是一样的,所以无需担心软件包是否可安装,安装之后是否有问题,另外CentOS公司去年已经被Redhat 收购了,下面是安装步骤
二、配置Redhat7的YUM源
配置Redhat7的YUM源一般有2种方法:1-本地CD源 2-CentOS7源。第一种方式是挂载Redhat7的DVD镜像作为源,所有的安装都是在镜像文件中安装,这种方式比较简单,但是不方便。第二种是使用CentOS7的YUM源。下面讲的就是第二种方式:
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、 删除redhat自带的yum包
卸载上面显示的所有yum包:
[root@localhost ~]# rpm -qa|grep yum|xargs rpm -e --nodeps
[root@localhost ~]# rpm -qa |grep yum
[root@localhost ~]#
3、保证本机电脑能上网
[root@linuxprobe ~]# ping www.baidu.com
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、选择163源(最重要一步)
下载安装包rpm的地址:http://mirrors.163.com/centos/7/os/x86_64/Packages/

注意下面的链接可能会失效,打开上面WEB按照实际的版本下载这5个包即可。
[root@ansible ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm
[root@ansible ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
[root@ansible ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-45.el7.noarch.rpm
[root@ansible ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-45.el7.noarch.rpm
[root@ansible ~]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm
6、查看下载完成结果
[root@ansible ~]# ls
anaconda-ks.cfg initial-setup-ks.cfg Templates yum-metadata-parser-1.1.4-10.el7.x86_64.rpm.1
Desktop Music Videos yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm
Documents Pictures yum-3.4.3-158.el7.centos.noarch.rpm yum-updateonboot-1.1.31-45.el7.noarch.rpm
Downloads Public yum-metadata-parser-1.1.4-10.el7.x86_64.rpm yum-utils-1.1.31-45.el7.noarch.rpm
7、安装软件包:
[root@ansible ~]# rpm -ivh yum-*
warning: yum-3.4.3-158.el7.centos.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
warning: package yum-metadata-parser-1.1.4-10.el7.x86_64 was already added, skipping yum-metadata-parser-1.1.4-10.el7.x86_64
Preparing... ################################# [100%]
Updating / installing...
1:yum-metadata-parser-1.1.4-10.el7 ################################# [ 20%]
2:yum-plugin-fastestmirror-1.1.31-4################################# [ 40%]
3:yum-3.4.3-158.el7.centos ################################# [ 60%]
4:yum-updateonboot-1.1.31-45.el7 ################################# [ 80%]
5:yum-utils-1.1.31-45.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@ansible ~]# yum -y install vim
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
[Linux]Redhat7配置CentOS7 YUM源的更多相关文章
- [Linux]Redhat7配置本地镜像源
一.Redhat7源 上一个文章介绍了如何配置的Redhat7的YUM网络源:[Linux]Redhat7配置CentOS7 YUM源 .如果在无法联网的情况下,可以使用镜像文件作为源安装需要的包. ...
- RedHat Linux RHEL6配置本地YUM源
YUM是Yellow dog Updater Modified的简称,起初是由yellow dog这一发行版的开发者Terra Soft研发,用python写成,那时还叫做yup(yellow dog ...
- Linux虚拟机配置本地yum源
刚开始使用Linux,自己构建了一个Linux虚拟机之后,在使用yum install的时候,经常是出错,提示连接不上. 一直以为是自己构建的虚拟机的问题,后来在网上查找了一些资料,才发现:需要配置本 ...
- 红帽系列linux自行配置本地yum源
yum是红帽系列的一种包管理工具,能方便的自动解决安装包的依赖关系.以前用rpm包管理安装gcc时,rpm -ivh gcc.rpm ,一般会提示要安装gcc需要安装某某lib库,等你找到那个库的rp ...
- redhat7配置本地yum源
1.首先是要有一个iso文件,并将这个文件挂载到某个目录 挂载: 配置: 检验: yum list 现在你就可以在没有网的情况下,安装软件了~~~
- Linux_配置本地YUM源(RHEL8)
[RHEL8] Linux-RHEL8配置本地YUM 源,按照之前传统的配置本地YUM的方法肯定不行,在RHEL8版本的软件源发生了变化,在RHEL8版本的软件仓库分成了两部分:[AppStream] ...
- linux 配置本地yum源,配置国内yum源,配置epel源
目录 一.配置本地yum源 二.配置国内yum源和epel源 一.配置本地yum源 1.挂载ISO镜像 mount -o loop /mnt/yum-iso/CentOS-7-x86_64-DVD-1 ...
- Linux挂载iso镜像、配置本地yum源
Linux挂载iso镜像.配置本地yum源 1.备份原yum源配置文件 [root@localhost ~]# ll /etc/yum.repos.d/ [root@localhost ~]# mkd ...
- Linux配置网络YUM源
配置网络yum源 RHEL6.5 [root@xuegod163 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun ...
随机推荐
- Software Testing 2 —— Fault、error and failure小练习
Questions: Below are two faulty programs. Each includes a test case that results in failure. Answer ...
- Linux hostname设置,静态ip设置,hostname与静态ip相互映射
1,hostname设置 永久设置: centos 7 下,切换到root 用户 vi /etc/hostname 输入要修改的hostname centos 6或者其他linux 系统,可能在/et ...
- js与jQuery的区别——每日一记录
js是一种脚本语言,jQuery是在他基础上的一种框架
- Rest和Restful & http
Rest :Representational State Transfer 表述性状态转移 Restful: Rest+ful形容词,遵循Rest原则的应用程序或设计 Rest原则: 1. 网络上的所 ...
- Linux基础命令---lprm删除打印任务
lprm lprm指令用来删除当前打印队列上的任务,如果没有指定,那么就删除当前打印任务.您可以指定一个或多个职务ID编号来取消这些职务,或者使用选项”-”取消所有作业. 此命令的适用范围:RedHa ...
- UValive4195 Heroes of Money and Magic
斜率优化 想骂人了,马格吉最后调了半小时 TMD造数据的人是SB吧? 我写 while(scanf("%d%d",&n,&m)!=EOF&&n) ...
- c#高级编程第七版 学习笔记 第二章 核心c#
第二章 核心C# 本章内容: 声明变量 变量的初始化和作用域 C#的预定义数据类型 在c#程序中使用条件语句.循环和跳转语句执行流 枚举 名称空间 Main()方法 基本的命令行c#编译器选项 使用S ...
- openvpn 初步使用
服务端:Centos 7.2 openvpn 2.4.3 客户端:Windows 10 安装包 openvpn的官网在国内访问不了,服务端通过yum安装,客户端在第三方网站下载的 一般的国内源应该都包 ...
- MySql 中的<=>操作符
今天在学习数据库的索引优化时,关于memory存储引擎的的hash索引时,看到了操作符<=> ,这个操作符还是第一次见到,于是上网查了一下.我想大家应该知道 = != <> ...
- Guitar Pro里自动化编辑器有什么用?如何使用?
我们在使用操作Guitar Pro来进行吉他学习创作时,会遇到下面几个问题.当我们想要改变全部小节或者某一特定小节的拍速时,就会在想,有没有什么简便工具来实现我们的想法呢?告诉大家,Guitar Pr ...