功能 | yum | rpm |
---|---|---|
查詢 | yum list | grep KEYWORD yum search KEYWORD yum info PACKAGE_NAME yum provides FILE_PATH_NAME |
rpm -qa | grep KEYWORD rpm [ -qi | -ql | -qc | -gd | -q –scripts | -q –changelog ] PACKAGE_NAME rpm -qf FILE_PATH |
查詢(Group) | yum groups [ list | info ] | rpm [ -qpi | -qpl | -qpc | -qpd | -qp –scripts | -qp –changelog] PACKAGE_NAME |
安裝 | yum -y [group] install PACKAGE_NAME | rpm -ivh PACKAGE_NAME yum -y localinstall PACKAGE_NAME |
更新 | yum -y update PACKAGE_NAME | rpm -Uvh PACKAGE_NAME |
移除 | yum -y [group] remove PACKAGE_NAME | rpm -e PACKAGE_NAME |
13.3 Managing Software Updates with yum =======================================
sudo yum group install "Development Tools"
:安裝整包 Development Toolsyum list kernel
:列出 kernel 清單 (包含已經安裝 & 可安裝的)uname -r
:列出 kenal 版本uname -a
:列出 kernel 詳細資訊sudo yum history
:檢視 yum 歷程記錄sudo yum undo 5
:取消 ID=5 所紀錄的 yum 工作
13.4 Enabling yum Software Repositories =======================================
/etc/yum.repos.d/*.repo
:此目錄內的附檔名必須都是 repo
1 | [ID] |
常用指令:
yum repolist all
:列出目前所有 repositorysudo yum-config-manager --disable rhel_dvd
:停用 “rhel_dvd” repositorysudo yum-config-manager --add-repo="http://content.example.com/rhel7.0/x86_64/rht/"
:直接指定路徑增加 repositorysudo rpm --import http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
:加入 GPG Keysudo yum -y install http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
:透過 rpm 安裝方式加入 repository
其他:
EPEL
:Extra Package for Enterprise Linux使用 yum-config-manager 搭配
--nogpgcheck
表示忽略 GPG key 的檢查,可能會有安全性上的風險
(非常重要) ===== Practice ====== (非常重要)
1 | $ sudo yum-config-manager --add-repo="http://content.example.com/rhel7.0/x86_64/rht" |
編輯 /etc/yum.repo.d/errata.repo 內容如下:
1 | [updates] |
1 | # 檢查詢所有的 repository (包含 enabled & disabled) |
13.5 Examining RPM Package Files ================================
rpm 常用參數:
1 | # 查詢指定套件 |