RHEL8 創建本地YUM存儲庫


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 0 0

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=0
gpgkey=file:///mnt/dvd/BaseOS/RPM-GPG-KEY-redhat-release
enabled=1

App Stream
[LocalRepo_AppStream]
name=LocalRepository_AppStream
baseurl=file:///mnt/dvd/AppStream
enabled=1
gpgcheck=0
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.
0 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 |   0  B     00:00    
local dvd yum                                                                                                                    0.0  B/s |   0  B     00:00    
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: 0:00:52 ago on Sat 28 Sep 2019 05:44:38 PM EDT.
Dependencies resolved.
=======================================================================================================================================================================================================================================================================
 Package                                                        Arch                                               Version                                                                           Repository                                                   Size
=======================================================================================================================================================================================================================================================================
Installing:
 httpd                                                          x86_64                                             2.4.37-10.module+el8+2764+7127e69e                                                local_appstream                                             1.4 M
Installing dependencies:
 apr                                                            x86_64                                             1.6.3-9.el8                                                                       local_appstream                                             125 k
 apr-util                                                       x86_64                                             1.6.1-6.el8                                                                       local_appstream                                             105 k
 httpd-filesystem                                               noarch                                             2.4.37-10.module+el8+2764+7127e69e                                                local_appstream                                              34 k
 httpd-tools                                                    x86_64                                             2.4.37-10.module+el8+2764+7127e69e                                                local_appstream                                             101 k
 mod_http2                                                      x86_64                                             1.11.3-1.module+el8+2443+605475b7                                                 local_appstream                                             156 k
 redhat-logos-httpd                                             noarch                                             80.7-1.el8                                                                        yum_local                                                    25 k
Installing weak dependencies:
 apr-util-bdb                                                   x86_64                                             1.6.1-6.el8                                                                       local_appstream                                              25 k
 apr-util-openssl                                               x86_64                                             1.6.1-6.el8                                                                       local_appstream                                              27 k
Enabling module streams:
 httpd                                                                                                             2.4                                                                                                                                                

Transaction Summary
=======================================================================================================================================================================================================================================================================
Install  9 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        :                                                                                                                                                                                                                                               1/1 
  Installing       : apr-1.6.3-9.el8.x86_64                                                                                                                                                                                                                        1/9 
  Running scriptlet: apr-1.6.3-9.el8.x86_64                                                                                                                                                                                                                        1/9 
  Installing       : apr-util-bdb-1.6.1-6.el8.x86_64                                                                                                                                                                                                               2/9 
  Installing       : apr-util-openssl-1.6.1-6.el8.x86_64                                                                                                                                                                                                           3/9 
  Installing       : apr-util-1.6.1-6.el8.x86_64                                                                                                                                                                                                                   4/9 
  Running scriptlet: apr-util-1.6.1-6.el8.x86_64                                                                                                                                                                                                                   4/9 
  Installing       : httpd-tools-2.4.37-10.module+el8+2764+7127e69e.x86_64                                                                                                                                                                                         5/9 
  Installing       : redhat-logos-httpd-80.7-1.el8.noarch                                                                                                                                                                                                          6/9 
  Running scriptlet: httpd-filesystem-2.4.37-10.module+el8+2764+7127e69e.noarch                                                                                                                                                                                    7/9 
  Installing       : httpd-filesystem-2.4.37-10.module+el8+2764+7127e69e.noarch                                                                                                                                                                                    7/9 
  Installing       : mod_http2-1.11.3-1.module+el8+2443+605475b7.x86_64                                                                                                                                                                                            8/9 
  Installing       : httpd-2.4.37-10.module+el8+2764+7127e69e.x86_64                                                                                                                                                                                               9/9 
  Running scriptlet: httpd-2.4.37-10.module+el8+2764+7127e69e.x86_64                                                                                                                                                                                               9/9 
  Verifying        : apr-1.6.3-9.el8.x86_64                                                                                                                                                                                                                        1/9 
  Verifying        : apr-util-1.6.1-6.el8.x86_64                                                                                                                                                                                                                   2/9 
  Verifying        : apr-util-bdb-1.6.1-6.el8.x86_64                                                                                                                                                                                                               3/9 
  Verifying        : apr-util-openssl-1.6.1-6.el8.x86_64                                                                                                                                                                                                           4/9 
  Verifying        : httpd-2.4.37-10.module+el8+2764+7127e69e.x86_64                                                                                                                                                                                               5/9 
  Verifying        : httpd-filesystem-2.4.37-10.module+el8+2764+7127e69e.noarch                                                                                                                                                                                    6/9 
  Verifying        : httpd-tools-2.4.37-10.module+el8+2764+7127e69e.x86_64                                                                                                                                                                                         7/9 
  Verifying        : mod_http2-1.11.3-1.module+el8+2443+605475b7.x86_64                                                                                                                                                                                            8/9 
  Verifying        : redhat-logos-httpd-80.7-1.el8.noarch                                                                                                                                                                                                          9/9 
Installed products updated.

Installed:
  httpd-2.4.37-10.module+el8+2764+7127e69e.x86_64        apr-util-bdb-1.6.1-6.el8.x86_64                     apr-util-openssl-1.6.1-6.el8.x86_64   apr-1.6.3-9.el8.x86_64  apr-util-1.6.1-6.el8.x86_64  httpd-filesystem-2.4.37-10.module+el8+2764+7127e69e.noarch 
  httpd-tools-2.4.37-10.module+el8+2764+7127e69e.x86_64  mod_http2-1.11.3-1.module+el8+2443+605475b7.x86_64  redhat-logos-httpd-80.7-1.el8.noarch 

Complete!
[root@localhost yum.repos.d]# 

配置完成,如有問題,請留言交流!

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM