红帽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