> Rocky Linux >

Rocky配置本地yum源

该文指导如何在RockyLinux系统中配置本地yum源。首先,进入/etc/yum.repos.d目录,备份现有源,创建新目录并移动源文件。接着,编辑rocky.repo配置文件,设置BaseOS和AppStream的baseurl为本地文件路径,并启用GPG检查。最后,挂载光驱设备并使用yum安装vim来验证配置是否成功。


Rocky配置本地yum源
#先进入路径
cd /etc/yum.repos.d
#然后把所有的源移到文件夹里只留一个即可
mkdir bak
mv * bak/
cp bak/rocky.repo
#然后编辑配置文件,编辑成功就可以挂载并安装服务了,其他的全删掉
vim rocky.repo
# rocky.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client.  You should use this for Rocky updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.

[baseos]
name=Rocky Linux $releasever - BaseOS
baseurl=file:///media/BaseOS/
gpgcheck=1
enabled=1
countme=1
repo_gpgcheck=0
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9


[appstream]
name=Rocky Linux $releasever - AppStream
baseurl=file:///media/AppStream/
gpgcheck=1
enabled=1
repo_gpgcheck=0
countme=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9

gpgcheck=1

#保存并退出
:wq
mount /dev/cdrom /media
yum -y install vim
#成功即可

(责任编辑:IT)