RHCSA认证考试---2.给系统配置默认的存储库

红帽RHCE考试上午-RHCSA(RH200)

servera.example.com 任务

2. 给系统配置默认存储库,要求如下:

YUM 的两个存储库的地址分别是:

http://content.example.com/rhel8.2/x86_64/dvd/BaseOS

http://content.example.com/rhel8.2/x86_64/dvd/AppStream

题目内容解析:

• 创建一个yum源配置文件,在/etc/yum.repo.d/目录下

• 配置yum源配置文件中包含了AppStream(软件应用仓库)和BaseOS(基本软件仓库)


实操演示过程:

Linux的默认存储库,也叫做Linux资源包库,主要是存放了Linux相关的所有软件包,简称为“yum源 ”

• 先去看看目录内是有已经有repo文件,可以用来借鉴格式

• 默认情况下,考试的时候是空的,需要编辑创建

• 考试的时候仓库路径千万不要自己手敲,要复制粘贴

yum源文件的存放路径如下:

[root@servera network-scripts]# cd /etc/yum.repos.d/
[root@servera yum.repos.d]# pwd
/etc/yum.repos.d

创建一个yum源,编辑的内容如下:

[root@servera ~]# vim /etc/yum.repos.d/test.repo

新增如下的内容
[base]
name=BaseOS
baseurl=http://content.example.com/rhel8.2/x86_64/dvd/BaseOS
enabled=1
gpgcheck=0


[app]
name=appstream
baseurl=http://content.example.com/rhel8.2/x86_64/dvd/AppStream
enabled=1
gpgcheck=0

yum配置文件的格式

[rhel-source]        #yum标签

name=Red Hat Enterprise Linux         #yum源的描述信息

baseurl=file/http/ftp         #指定yum仓库的位置,可以是本地文件/http的url/ftp远程url

enabled=0        #是否启用yum的校验规则 0不启用,1启用

gpgcheck=1     #是否启用rpm签名 ,0不启用,1启用

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release         #启动签名到时候需要校验key内容。表示key文件的路径

生效yum源文件并生成本地yum缓存

[root@servera yum.repos.d]# yum clean all
Repository base is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
18 files removed

生成本地缓存

[root@servera yum.repos.d]# yum makecache
CentOS-8 - Base - mirrors.aliyun.com 26 kB/s | 3.9 kB 00:00
CentOS-8 - Extras - mirrors.aliyun.com 12 kB/s | 1.5 kB 00:00
CentOS-8 - AppStream - mirrors.aliyun.com 27 kB/s | 4.3 kB 00:00
Metadata cache created.

查看yum源信息

[root@servera yum.repos.d]# yum repolist
repo id repo name
AppStream CentOS-8 - AppStream - mirrors.aliyun.com
base CentOS-8 - Base - mirrors.aliyun.com
extras CentOS-8 - Extras - mirrors.aliyun.com

 

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

jiang0615csdn

你对鼓励是我最大的动力来源

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值