Linux自定義本地YUM源
Yum軟件倉庫的作用是爲了進一步簡化RPM管理軟件的難度以及自動分析所需軟件包及其依賴關係的技術。裏面保存有幾乎所有常用的工具,而且只需要說出所需的軟件包名稱,系統就會自動爲您搞定一切。
相關說明
- YUM配置文件目錄爲:/etc/yum.repos.d/
- YUM配置文件後綴名稱必須爲:******.repo
配置文件參數
- [Yum-media]:Yum軟件倉庫唯一標識符,避免與其他倉庫衝突。
- name=Yum-media:Yum軟件倉庫的名稱描述,易於識別倉庫用處。
- baseurl=file:///media/cdrom:提供的方式包括FTP(ftp://…)、HTTP(http://…)、本地(file:///…)。
- enabled=1:設置此源是否可用;1爲可用,0爲禁用。
- gpgcheck=1:設置此源是否校驗文件;1爲校驗,0爲不校驗
- gpgkey=file:///media/cdrom/RPM-GPG-KEY-redhat-release:若上面參數開啓校驗,那麼請指定公鑰文件地址。
配置過程
mount /dev/cdrom /media
mkdir /Yum-media
cp -av /media/BaseOS /Yum-media
cp -av /media/Appstream /Yum-media
cd /etc/yum.repos.d/
rm -rf *
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
- 配置完成後,使用yum list查看於倉庫,如需驗證,可以安裝軟件包驗證。
- 軟件包驗證:
[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
完畢!