1. 程式人生 > >redhat系列linux使用本地的光碟映象來製作一個yum安裝源

redhat系列linux使用本地的光碟映象來製作一個yum安裝源

在工作或者是日常生活中,肯定會遇到這麼一種情況,需要安裝軟體,但是本地的網路環境並不允許你上網,這個時候就可以用本地的光碟映象來作為yum的安裝源了,具體的步驟如下:

1、掛載光碟

# mount /dev/sr0 /mnt/dvd

2、備份/etc/yum.repos.d/*.repo檔案,然後刪除該目錄下的所有的*.repo檔案

# cp *.repo *.repo.bak

# rm *.repo

3、在/et/yum.repos.d/目錄下建立一個dvd.repo檔案,新增以下內容

[dvd]
name=install dvd<span style="white-space:pre">		</span># 這是名字可以起的隨意點,看自己喜歡了。
baseurl=file:///mnt/dvd     <span style="white-space:pre">	</span># 這裡是光碟掛載的位置
enabled=1
gpgcheck=0

4、重新整理repos,生成快取

# yum makecache

至此,你就可以安裝你所需要的軟體了。

yum更新源優先順序設定

1.安裝 yum-priorities

yum install yum-priorities

2.priorities的配置檔案是/etc/yum/pluginconf.d/priorities.conf,確認其是否存在。
其內容為:
[main]
enabled=1 # 0禁用 1啟用

3.編輯 /etc/yum.repos.d/目錄下的*.repo 檔案來設定優先順序。

引數為:

priority=N # N的值為1-99

推薦的設定為:
[base], [addons], [updates], [extras] … priority=1
[centosplus],[contrib] … priority=2
Third Party Repos such as rpmforge … priority=N (where N is > 10 and based on your preference)

數字越大,優先順序越低