RHEL 8上创建本地YUM存储库
本地YUM存储库是存储Redhat或CentOS的rpm包并分发到客户端服务器以进行软件安装和操作系统更新的地方。
此本地存储库可以节省Internet带宽以及从Internet下载软件包的时间。
在这里,我们将使用ISO在RHEL 8上为RHEL 8创建本地YUM存储库。
Red Hat Enterprise Linux 8分为两个存储库,
BaseOS
应用程序流(AppStream)
BaseOS中的软件包旨在提供底层操作系统功能的核心集,为所有类型的安装提供基础。
Application Stream中的包包括用户空间应用程序,运行时语言和数据库,以支持各种工作负载和用例。
可以使用repo包创建存储库的源,也可以将DVD mount到本地目录。
mount DVD / CD ROM到本地目录将帮助您节省复制ISO 到本地的磁盘时间,以及节省本地的磁盘空间。
在这里,将使用ISO为例来配置本地的yum 源,首先将RHEL 8 ISO mount到您希望的任何目录上。 为了测试,我将它挂载在/mnt/rhel上。
mkdir /mnt/rhel
mount /path/RHEL-8.0-20181113.1-Server-x86_64-dvd1.iso /mnt/rhel/
vim /etc/fstab
添加ISO包路径到fstab 文件
/path/RHEL-8.0-20181113.1-Server-x86_64-dvd1.iso /mnt/rhel iso9660 loop 0 0
在创建 .repo文件之前,如果不再需要,请将/etc/yum.repos.d/directory中的现有文件移动到/ tmp。
mv /etc/yum.repos.d/*.repo /tmp/
在/etc/yum.repos.d目录下创建一个名为local.repo的repo文件。
vi /etc/yum.repos.d/local.repo
Base OS
[LocalRepo_BaseOS]
name=LocalRepo_BaseOS
baseurl=file:///mnt/rhel/BaseOS
gpgcheck=0
gpgkey=file:///mnt/rhel/BaseOS/RPM-GPG-KEY-redhat-release
enabled=1
App Stream
[LocalRepo_AppStream]
name=LocalRepository_AppStream
baseurl=file:///mnt/rhel/AppStream
enabled=1
gpgcheck=0
gpgkey=file:///mnt/rhel/AppStream/RPM-GPG-KEY-redhat-beta
细节:
[LocalRepo] | 该部分的名称 |
---|---|
name | 存储库的名称 |
baseurl | 包裹的位置 |
enabled | 启用存储库 |
gpgcheck | 启用安全安装(gpgcheck是可选的(如果设置gpgcheck = 0,则无需提及gpgkey) |
gpgkey | 密钥的位置 |
通过运行以下命令清除存储库缓存。
yum clean all
让我们从本地存储库安装telnet包。
yum install vsftpd
输出如下。
当您下载包时,gpgcheck设置为0,它将不会提示您接受gpg签名密钥。
LocalRepository_AppStream 2.8 kB/s | 2.8 kB 00:01
LocalRepo_BaseOS 2.7 kB/s | 2.7 kB 00:01
Dependencies resolved.
=========================================================================================================================================================================================
Package Arch Version Repository Size
=========================================================================================================================================================================================
Installing:
vsftpd x86_64 3.0.3-28.el8 LocalRepo_AppStream 180 k
Transaction Summary
=========================================================================================================================================================================================
Install 1 Package
Total size: 180 k
Installed size: 356 k
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installed: vsftpd-3.0.3-28.el8.x86_64
Installing : vsftpd-3.0.3-28.el8.x86_64 1/1
Running scriptlet: vsftpd-3.0.3-28.el8.x86_64 1/1
Installed: vsftpd-3.0.3-28.el8.x86_64
Verifying : vsftpd-3.0.3-28.el8.x86_64 1/1
Installed:
vsftpd-3.0.3-28.el8.x86_64
Complete!
恭喜你!您已在计算机上成功配置了本地yum存储库。
参考文档:https://developers.redhat.com/blog/2018/11/14/python-in-rhel-8/