-
在RHEL8中,軟件源分成了兩部分,一個是BaseOS,另一個是AppStream
-
BaseOS 存儲庫 - BaseOS 存儲庫以傳統 RPM 包的形式提供底層核心 OS 內容。
-
AppStream 存儲庫 - Application Stream 存儲庫提供用戶可能希望在給定用戶空間中運行的所有應用程序。
-
yum 軟件倉庫配置如下:
#編輯本地軟件倉庫源
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# vim rhel8.repo
[Tom_yum] #唯一標識符,不能重復
name=Tom_yum #倉庫名稱,可任意取個名稱
baseurl=file:///media/cdrom/BaseOS #提供的方式,file:// 是本地倉庫,http:// 是網絡倉庫
enabled=1 #是否可用,1表示啟用,0表示不啟用
gpgcheck=0 #是否校驗,1表示要校驗,0表示不檢驗
[AppStream] #在RHEL8中還要配置AppStream倉庫
name=AppStream
baseurl=file:///media/cdrom/AppStream
enabled=1
gpgcheck=0
[root@localhost yum.repos.d]# ls
redhat.bak redhat.repo rhel8.repo
- 接下來清理緩存、建立元數據,操作如下:
[root@michael ~]# 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.
12 files removed #文件已刪除
[root@michael ~]# 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.
AppStream 41 MB/s | 5.3 MB 00:00
Tom_yum 21 MB/s | 2.2 MB 00:00
Last metadata expiration check: 0:00:01 ago on Sun 31 Oct 2021 01:03:07 PM CST.
#上次元數據過期檢查:0:00:01 前,執行於 2021年10月31日 星期日 13時3分7秒。
Metadata cache created. #元數據緩存已建立
- 查看在用的yum源
[root@michael ~]# yum repolist 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.
Last metadata expiration check: 0:04:57 ago on Sun 31 Oct 2021 01:03:07 PM CST.
repo id repo name status
AppStream AppStream enabled: 4,672
Tom_yum Tom_yum enabled: 1,658
- 在RHEL8中,yum 命令與 dnf 命令是一樣的,dnf 命令更好的解決了軟件依賴問題。常用命令如下:
dnf repolist #查看系統中可用的 DNF 軟件庫
dnf repolist all #查看系統中可用和不可用的 DNF 軟件庫
dnf list #列出所有RPM包
dnf list installed #列出所有安裝了的RPM包
dnf list available #列出所有可供安裝的RPM包
dnf search nano #搜索軟件倉庫中的RPM包
dnf provides /bin/bash #查找一些軟件的提供者
dnf info nginx #查看軟件包詳情
dnf install nginx #安裝軟件包
dnf remove nginx #刪除軟件包
dnf autoremove #刪除無用孤立的軟件包
dnf clean all #刪除緩存的無用軟件包
dnf help clean #獲取某條命令的使用幫助
dnf history #查看命令執行歷史
dnf grouplist #查看所有的軟件包組
dnf groupinstall "安全性工具" #安裝一個軟件包組
dnf -enablerepo=epel install nginx #從特定的軟件包庫安裝特定的軟件
dnf reinstall nano #重新安裝軟件包