爲Linux配置本地YUM倉庫[Dark凌雲]

Linux自定義本地YUM源

Yum軟件倉庫的作用是爲了進一步簡化RPM管理軟件的難度以及自動分析所需軟件包及其依賴關係的技術。裏面保存有幾乎所有常用的工具,而且只需要說出所需的軟件包名稱,系統就會自動爲您搞定一切。

相關說明

  1. YUM配置文件目錄爲:/etc/yum.repos.d/
  2. YUM配置文件後綴名稱必須爲:******.repo

配置文件參數

  1. [Yum-media]:Yum軟件倉庫唯一標識符,避免與其他倉庫衝突。
  2. name=Yum-media:Yum軟件倉庫的名稱描述,易於識別倉庫用處。
  3. baseurl=file:///media/cdrom:提供的方式包括FTP(ftp://…)、HTTP(http://…)、本地(file:///…)。
  4. enabled=1:設置此源是否可用;1爲可用,0爲禁用。
  5. gpgcheck=1:設置此源是否校驗文件;1爲校驗,0爲不校驗
  6. gpgkey=file:///media/cdrom/RPM-GPG-KEY-redhat-release:若上面參數開啓校驗,那麼請指定公鑰文件地址。

配置過程

  1. mount /dev/cdrom /media
  2. mkdir /Yum-media
  3. cp -av /media/BaseOS /Yum-media
  4. cp -av /media/Appstream /Yum-media
  5. cd /etc/yum.repos.d/
  6. rm -rf *
  7. vim meida.repo
[BaseOS]
name=BaseOS
baseurl=file:///Yum-media/BaseOS
enable=1
gpgcheck=0


[AppStream]
name=Appstream
baseurl=file:///Yum-media/AppStream
enable=1
gpgcheck=0

這裏之所以配置文件有兩個配置是基於RHEL8的,RHEL7只需要配置其中一項即可,但本地文件軟件包目錄爲baseurl=file:///Yum-media/Packges

  1. 配置完成後,使用yum list查看於倉庫,如需驗證,可以安裝軟件包驗證。
  2. 軟件包驗證:
[root@LingYun ~]# 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.
上次元數據過期檢查:0:30:57 前,執行於 2019年10月30日 星期三 18時18分22秒。
依賴關係解決。
================================================================================
 軟件包               架構     版本                                   倉庫
                                                                           大小
================================================================================
Installing:
 httpd                x86_64   2.4.37-10.module+el8+2764+7127e69e     B   1.4 M
安裝依賴關係:
 redhat-logos-httpd   noarch   80.7-1.el8                             A    25 k
 apr                  x86_64   1.6.3-9.el8                            B   125 k
 apr-util             x86_64   1.6.1-6.el8                            B   105 k
 httpd-filesystem     noarch   2.4.37-10.module+el8+2764+7127e69e     B    34 k
 httpd-tools          x86_64   2.4.37-10.module+el8+2764+7127e69e     B   101 k
 mod_http2            x86_64   1.11.3-1.module+el8+2443+605475b7      B   156 k
安裝弱的依賴:
 apr-util-bdb         x86_64   1.6.1-6.el8                            B    25 k
 apr-util-openssl     x86_64   1.6.1-6.el8                            B    27 k
Enabling module streams:
 httpd                         2.4                                             

事務概要
================================================================================
安裝  9 軟件包

總計:2.0 M
安裝大小:5.4 M
確定嗎?[y/N]: y
下載軟件包:
運行事務檢查
事務檢查成功。
運行事務測試
事務測試成功。
運行事務
  準備中      :                                                          	1/1 
  Installing  : apr-1.6.3-9.el8.x86_64                                     	1/9 
  運行腳本    : 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 
  運行腳本    : 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 
  運行腳本    : httpd-filesystem-2.4.37-10.module+el8+2764+7127e69e.noarc   	6/9 
  Installing  : httpd-filesystem-2.4.37-10.module+el8+2764+7127e69e.noarch	6/9 
  Installing  : redhat-logos-httpd-80.7-1.el8.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 
  運行腳本    : httpd-2.4.37-10.module+el8+2764+7127e69e.x86_64				9/9 
  驗證        : redhat-logos-httpd-80.7-1.el8.noarch							1/9 
  驗證        : apr-1.6.3-9.el8.x86_64										2/9 
  驗證        : apr-util-1.6.1-6.el8.x86_64									3/9 
  驗證        : apr-util-bdb-1.6.1-6.el8.x86_64								4/9 
  驗證        : apr-util-openssl-1.6.1-6.el8.x86_64							5/9 
  驗證        : httpd-2.4.37-10.module+el8+2764+7127e69e.x86_64				6/9 
  驗證        : httpd-filesystem-2.4.37-10.module+el8+2764+7127e69e.noarch	7/9 
  驗證        : httpd-tools-2.4.37-10.module+el8+2764+7127e69e.x86_6			8/9 
  驗證        : mod_http2-1.11.3-1.module+el8+2443+605475b7.x86_64			9/9 
Installed products updated.

已安裝:
  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                                     
  redhat-logos-httpd-80.7-1.el8.noarch                              
  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                     

完畢!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章