yum 的好处及本地yum的好处不在本文讨论范畴,本文针对rhel8中的新功能yum做简要介绍和配置,在 RHEL 8中分为两个存储库:
- BaseOS
- 应用程序流(AppStream)
BaseOS中的软件包旨在提供底层操作系统功能的核心集,为所有类型的安装提供基础。Application Stream中的包包括用户空间应用程序,运行时语言和数据库,以支持各种工作负载和用例。
1.创建本地yum源
可以使用repo包创建存储库的源,也可以将DVD mount 到本地目录。
1.1. 创建挂载目录
mkdir /mnt/dvd
1.2 挂载ISO文件
将本地ISO文件挂载到挂载目录/mnt/dvd中
mount /opt/RHEL-8.0-20181113.1-Server-x86_64-dvd1.iso /mnt/dvd/
永久挂载ISO包
vim /etc/fstab # 添加ISO包路径到fstab 文件 /opt/RHEL-8.0-20181113.1-Server-x86_64-dvd1.iso /mnt/dvd iso9660 loop
1.3 创建repo文件
在/etc/yum.repos.d目录下创建一个名为local.repo的repo文件。
vi /etc/yum.repos.d/local.repo Base OS
[LocalRepo_BaseOS]
name=LocalRepo_BaseOS
baseurl=file:///mnt/dvd/BaseOS
gpgcheck=
gpgkey=file:///mnt/dvd/BaseOS/RPM-GPG-KEY-redhat-release
enabled= App Stream
[LocalRepo_AppStream]
name=LocalRepository_AppStream
baseurl=file:///mnt/dvd/AppStream
enabled=
gpgcheck=
gpgkey=file:///mnt/dvd/AppStream/RPM-GPG-KEY-redhat-beta
参数说明:
[LocalRepo] # 该部分的名称
name # 存储库的名称
baseurl # 包裹的位置
enabled # 启用存储库
gpgcheck # 启用安全安装(gpgcheck是可选的(如果设置gpgcheck = 0,则无需提及gpgkey)
gpgkey # 密钥的位置
2. 从本地yun安装软件包
2.1 清除本地缓存
[root@localhost ~]# yum clean all
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.
files removed
2.2. 重建本地缓存
[root@localhost ~]# yum makecache
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.
localrepository_appstream 0.0 B/s | B :
local dvd yum 0.0 B/s | B :
Failed to synchronize cache for repo 'local_appstream', ignoring this repo.
Failed to synchronize cache for repo 'yum_local', ignoring this repo.
Metadata cache created.
2.3. 从本地yum 安装软件包
[root@localhost yum.repos.d]# yum install httpd
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.
Last metadata expiration check: :: ago on Sat Sep :: PM EDT.
Dependencies resolved.
=======================================================================================================================================================================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================================================================================================================================================================
Installing:
httpd x86_64 2.4.-.module+el8++7127e69e local_appstream 1.4 M
Installing dependencies:
apr x86_64 1.6.-.el8 local_appstream k
apr-util x86_64 1.6.-.el8 local_appstream k
httpd-filesystem noarch 2.4.-.module+el8++7127e69e local_appstream k
httpd-tools x86_64 2.4.-.module+el8++7127e69e local_appstream k
mod_http2 x86_64 1.11.-.module+el8++605475b7 local_appstream k
redhat-logos-httpd noarch 80.7-.el8 yum_local k
Installing weak dependencies:
apr-util-bdb x86_64 1.6.-.el8 local_appstream k
apr-util-openssl x86_64 1.6.-.el8 local_appstream k
Enabling module streams:
httpd 2.4 Transaction Summary
=======================================================================================================================================================================================================================================================================
Install Packages Total size: 2.0 M
Installed size: 5.4 M
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : /
Installing : apr-1.6.-.el8.x86_64 /
Running scriptlet: apr-1.6.-.el8.x86_64 /
Installing : apr-util-bdb-1.6.-.el8.x86_64 /
Installing : apr-util-openssl-1.6.-.el8.x86_64 /
Installing : apr-util-1.6.-.el8.x86_64 /
Running scriptlet: apr-util-1.6.-.el8.x86_64 /
Installing : httpd-tools-2.4.-.module+el8++7127e69e.x86_64 /
Installing : redhat-logos-httpd-80.7-.el8.noarch /
Running scriptlet: httpd-filesystem-2.4.-.module+el8++7127e69e.noarch /
Installing : httpd-filesystem-2.4.-.module+el8++7127e69e.noarch /
Installing : mod_http2-1.11.-.module+el8++605475b7.x86_64 /
Installing : httpd-2.4.-.module+el8++7127e69e.x86_64 /
Running scriptlet: httpd-2.4.-.module+el8++7127e69e.x86_64 /
Verifying : apr-1.6.-.el8.x86_64 /
Verifying : apr-util-1.6.-.el8.x86_64 /
Verifying : apr-util-bdb-1.6.-.el8.x86_64 /
Verifying : apr-util-openssl-1.6.-.el8.x86_64 /
Verifying : httpd-2.4.-.module+el8++7127e69e.x86_64 /
Verifying : httpd-filesystem-2.4.-.module+el8++7127e69e.noarch /
Verifying : httpd-tools-2.4.-.module+el8++7127e69e.x86_64 /
Verifying : mod_http2-1.11.-.module+el8++605475b7.x86_64 /
Verifying : redhat-logos-httpd-80.7-.el8.noarch /
Installed products updated. Installed:
httpd-2.4.-.module+el8++7127e69e.x86_64 apr-util-bdb-1.6.-.el8.x86_64 apr-util-openssl-1.6.-.el8.x86_64 apr-1.6.-.el8.x86_64 apr-util-1.6.-.el8.x86_64 httpd-filesystem-2.4.-.module+el8++7127e69e.noarch
httpd-tools-2.4.-.module+el8++7127e69e.x86_64 mod_http2-1.11.-.module+el8++605475b7.x86_64 redhat-logos-httpd-80.7-.el8.noarch Complete!
[root@localhost yum.repos.d]#
配置完成,如有问题,请留言交流!