建立网络源和本地源yum仓库
作者:互联网
rpm包安装有直接的rpm包安装或者现在为了解决rpm包安装时的依赖问题的yum(dnf)安装。yum安装本质上还是底层调用rpm包安装。在yum安装软件包时,yum时根据系统的yum源的配置来安装软件的。yum源所指是本地的文件就是本地源,指向其他服务器就是网络源。在yum安装软件时就会去yum所指的文件路径中去寻找软件,找不到就会报错,实际运用中,镜像地址一般为国外网站,可修改为国内的一些镜像 。
虚拟机启动前编辑CD/DVD属性,设置虚拟机启动时连接,并设置启动时光驱加载centos8.4安装光盘,如下图:
centos8系统启动后,进行yum源修改
[root@centos8 ~]# yum -y install autofs #设置光盘自动挂载目录
[root@centos8 ~]# systemctl enable --now autofs
Created symlink /etc/systemd/system/multi-user.target.wants/autofs.service → /usr/lib/systemd/system/autofs.service.
[root@centos8 ~]# cd /misc/cd
[root@centos8 cd]# ls
AppStream BaseOS EFI images isolinux LICENSE media.repo TRANS.TBL
[root@centos8 cd]# cd /etc/yum.repos.d
[root@centos8 yum.repos.d]# mkdir bak #备份系统yum源
[root@centos8 yum.repos.d]# mv *.repo bak
[root@centos8 yum.repos.d]# touch Baseos.repo
[root@centos8 yum.repos.d]# vi !* #建立新的yum源
[baseos]
name=baseos
baseurl=file:///misc/cd/BaseOS #本地yum源
https://mirrors.cloud.tencent.com/centos/$releasever/BaseOS/$basearch/os/ #网咯yum源
https://mirrosr.sohu.com/centos/$releasever/BaseOS/$basearch/os
https://repo.huaweicloud.com/centos/$releasever/BaseOS/$basearch/os
gpgcheck=0 #设置为0,不进行验证
[AppStream]
name=AppStream
baseurl=file:///misc/cd/AppStream
https://mirrors.cloud.tencent.com/centos/$releasever/AppStream/$basearch/os/
https://mirrosr.sohu.com/centos/$releasever/AppStream/$basearch/os/
https://repo.huaweicloud.com/centos/$releasever/AppStream/$basearch/os/
gpgcheck=0
[epel]
name=epel
baseurl=https://mirrors.cloud.tencent.com/epel/$releasever/Everything/$basearch
https://mirrosr.sohu.com/epel/$releasever/Everything/$basearch
https://repo.huaweicloud.com/epel/$releasever/Everything/$basearch
gpgcheck=0
[extras]
name=extras
baseurl=https://mirrors.cloud.tencent.com/centos/$releasever/extras/$basearch/os
https://mirrosr.sohu.com/centos/$releasever/extras/$basearch/os
https://repo.huaweicloud.com/centos/$releasever/extras/$basearch/os
gpgcheck=0
[root@centos8 yum.repos.d]# yum clean all #清理yum源缓存
28 files removed
[root@centos8 yum.repos.d]# yum makecache #建立新的yum源缓存
[root@centos8 yum.repos.d]# yum repolis #yum源查看
repo id repo name
AppStream AppStream
baseos baseos
epel epel
extras extras
标签:https,仓库,root,releasever,本地,yum,com,centos8 来源: https://www.cnblogs.com/gamebear/p/15714184.html