一、yum 基於RPM包管理,能夠從指定的伺服器自動下載RPM包並且安裝,可以處理依賴性關係,並且一次安裝所有依賴的軟體包,無需繁瑣下載多個檔案。
yum與yum映象源密切相關,yum映象源可以理解為一個線上的映象軟體倉庫,你所需要下載的軟體需要在裡面有。
yum install xxx* 安裝
yum remove xxx* 刪除
yum update xxx 更新
yum search xxx 查詢
yum clean all 清除快取
二、配置修改yum映象源:
下面以配置阿里雲映象源為例:
1.首先備份你現有的yum源配置檔案
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2.編輯你的yum源配置檔案
vi /etc/yum.repos.d/CentOS-Base.repo
3.將以下內容複製並替換到你的配置檔案中,這裡以阿里雲的映象源為例:
[base]
name=CentOS-$releasever - Base - Aliyun
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
released updates
[updates]
name=CentOS-$releasever - Updates - Aliyun
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - Aliyun
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - Aliyun
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
4.儲存檔案並退出編輯器。
5.清除YUM快取並重新載入軟體源資訊
sudo yum clean all
sudo yum makecache
6.測試新的映象源是否工作
yum update