<linux就该这么学>RHEL8配置软件仓库
RHEL8配置软件仓库
RHEL8配置软件仓库(yum源)
给虚拟机添加光盘文件
挂载光盘文件到目录
# 创建挂载点 mkdir /media/cdrom # 挂载 [root@localhost media]# vim /etc/fstab ## 在最后添加如下内容 /dev/cdrom /media/cdrom iso9660 defaults 0 0 [root@localhost media]# mount -a mount: /media/cdrom: WARNING: device write-protected, mounted read-only.
配置yum仓库的文件
# 进入目录 [root@localhost media]# cd /etc/yum.repos.d/ # yum配置文件的名称随意,结尾为repo即可 [root@localhost media]# vim readhat.repo # 写入文件内容 [BaseOS] name=BaseOS baseurl=file:///media/cdrom/BaseOS gpgheck=0 enabled=1 [AppStream] name=AppStream baseurl=file:///media/cdrom/AppStream gpgcheck=0 enabled=1
使用yum /dnf安装软件
yum install 软件包名称
tip:
如果出现以下错误:
[root@localhost media]# dnf install tmux Updating Subscription Management repositories. Unable to read consumer identity This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. You have enabled checking of packages via GPG keys. This is a good thing. However, you do not have any GPG public keys installed. You need to download the keys for packages you wish to install and install them. You can do that by running the command: rpm --import public.gpg.key
可以使用
rpm --import public.gpg.key
解决
配置阿里云yum源的方式
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
当有多个yum源存在时,linux提供有配置优先级的插件(需要安装)
License:
CC BY 4.0