配置Linux YUM源設置使用代理
在向大家詳細介紹Linux YUM之前,首先讓大家了解下Linux YUM,然后全面介紹Linux YUM,希望對大家有用。Fedora 10的Linux YUM源設置。RPM Fusion 團隊宣布 Fedora 10 的軟件倉庫可以使用了!
RPM Fusion 由之前的 Dribble,F(xiàn)reshrpms,和 Livna 合并而來并成為一個超級軟件倉庫,專門為 Fedora,CentOS以及RHEL提供官方不能提供的軟件。Fedpra 10為我們帶來了很多 Linux 的最新特性,比如,F(xiàn)10 可以自動搜索并安裝播放視頻所必須的解碼器了。RPM Fusion 包含大量的多媒體解碼器,以及大量 nVidia 顯卡等受限驅(qū)動。rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpmhttp://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm。
雖然 RPM Fusion 合并了其它三個軟件倉庫,但是并不包括著名的 ATrpms 源,ATrpms 的 Fedora 10 軟件倉庫也發(fā)布了,要安裝atrpms源:
rpm -Uvh http://dl.atrpms.net/all/atrpms-repo-10-2.fc10.i386.rpm第三方軟件倉庫 Adobe:rpm -ivh http://linuxdownload.adobe.com/linux/i386/adobe-release-i386-1.0-1.noarch.rpmrpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux。
另外,這里再給出添加國內(nèi)上海交大源的設置,在開始之前,首先確保你安裝了如下軟件,補上尚未安裝的。執(zhí)行以下命令:yum -y install gcc make subversion。
首先增加上海交大的更新源:(如果你有更好的更新源段,歡迎評論給出,謝謝?。ゞedit /etc/yum.repos.d/sjtu.repo 在打開的空白窗口中加入
- Fedora-ftp.sjtu.edu.cn]
- name=Fedora 10 - i386
- baseurl=http://ftp.sjtu.edu.cn/fedora/linux/releases/10/Fedora/i386/os/
- enabled=1
- gpgcheck=0
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
- [Everything-ftp.sjtu.edu.cn]
- name=Everything 10 - i386
- baseurl=http://ftp.sjtu.edu.cn/fedora/linux/releases/10/Everything/i386/os/
- enabled=1
- gpgcheck=0
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
- [updates-ftp.sjtu.edu.cn]
- name=Fedora updates
- baseurl=http://ftp.sjtu.edu.cn/fedora/linux/updates/10/i386/
- enabled=1
- gpgcheck=0
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
注意大小寫,網(wǎng)上有幾篇文章中的大小寫錯誤,會導致404 Not Found,然后保存退出。然后依次執(zhí)行:
[下面的內(nèi)容非常重要]比如在yum install audacious* 的過程中出現(xiàn)如下情況:audacious-plugin-fc i386 0.3-1Everything-ftp.sjtu.edu.cn
下載包錯誤:
audacious-plugin-fc-0.3-1.i386: [Errno 256] No more mirrors to try.
也就是當前Linux YUM源都已經(jīng)不可用. 使用Google: 會有如下的一條條查找結(jié)果:#Index of /pub/linux/distributions/fedora/linux/releases/10 ...30-Oct-2008 21:31 45672 audacious-plugin-fc-0.3-1.i386.rpm 30-Oct-2008 21:31 31788 audacious-plugins-1.5.1-2.fc10.i386.rpm 30-Oct-2008 21:31 1337465 ...
ftp.freepark.org/pub/linux/distributions/fedora/linux/releases/.../Packages/
Index of /fedora/releases/10/Everything/i386/os/Packages/
audacious-plugin-fc-0.3-1.i386.rpm, 2008-Oct-30 16:31:19, 31.0K, application/octet-stream. audacious-plugins-1.5.1-2.fc10.i386.rpm, 2008-Oct-30 16:31:22 ...
mirror.fdcservers.net/fedora/releases/10/Everything/i386/os/Packages/
Index of /pub/linux/fedora/linux/releases/10/Everything/i386/os ...
audacious-plugin-fc-0.3-1.i386.rpm 30-Oct-2008 22:31 31K [ ] audacious-plugins-1.5.1-2.fc10.i386.rpm 30-Oct-2008 22:31 1M [ ] ...
ftp.wcss.pl/pub/linux/fedora/linux/releases/10/Everything/.../Packages/
也就是說,上述網(wǎng)站提供了Fedora鏡像,如果能進入到其中的文件夾找到audacious-plugin-fc-0.3-1.i386,則此鏡像是可以使用的。那么,我們可以把這個鏡像加入到/etc/yum.repo.d/下。方法也很簡單,只要把像上面sjtu.repo文件中的baseurl的值和鏡像中的目錄對應起來,表示這樣可以獲得那些安裝文件即行了。
更詳細的配置文件如下例:
- [tummy]
- name=Tummy Fedora $releasever - $basearch
- failovermethod=priority
- baseurl=http://mirrors.tummy.com/pub/fedora.redhat.com/fedora/linux/releases/$releasever/Everything/$basearch/os/
- enabled=1
- gpgcheck=1
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
- [tummy-debuginfo]
- name=Tummy Fedora $releasever - $basearch - Debug
- failovermethod=priority
- baseurl=http://mirrors.tummy.com/pub/fedora.redhat.com/fedora/linux/releases/$releasever/Everything/$basearch/debug/
- enabled=1
- gpgcheck=1
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
- [tummy-source]
- name=Tummy Fedora $releasever - Source
- failovermethod=priority
- baseurl=http://mirrors.tummy.com/pub/fedora.redhat.com/fedora/linux/releases/$releasever/Everything/source/SRPMS/
- enabled=1
- gpgcheck=1
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
- [tummy-Everything]
- name=Tummy Everything $releasever - $basearch
- baseurl=http://mirrors.tummy.com/pub/fedora.redhat.com/fedora/linux/releases/$releasever/Everything/$basearch/os/
- enabled=1
- gpgcheck=0
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
- [tummy-updates]
- name=Tummy Fedora $releasever - $basearch - Updates
- failovermethod=priority
- baseurl=http://mirrors.tummy.com/pub/fedora.redhat.com/fedora/linux/updates/$releasever/$basearch/
- enabled=1
- gpgcheck=1
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
- [tummy-updates-debuginfo]
- name=Tummy Fedora $releasever - $basearch - Updates - Debug
- failovermethod=priority
- baseurl=http://mirrors.tummy.com/pub/fedora.redhat.com/fedora/linux/updates/$releasever/$basearch/debug/
- enabled=1
- gpgcheck=1
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
- [tummy-updates-source]
- name=Tummy Fedora $releasever - Updates Source
- failovermethod=priority
- baseurl=http://mirrors.tummy.com/pub/fedora.redhat.com/fedora/linux/updates/$releasever/SRPMS/
- enabled=1
- gpgcheck=1
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
上面的工作結(jié)束后,做一些收尾工作吧。
1.要把repos.d里面的已經(jīng)失效的鏡像文件都刪除掉,以免它去找別的源。重新建立Linux YUM的緩存(download and make usable all the metadata for the currently enabled yum repos)yum makecache
2.然后一行命令對整個系統(tǒng)升級
yum update -y
3.安裝圖形化的yum
yum install yumex
4.最快鏡像插件
就像這個插件名所說的那樣,這個插件可以搜索你鏡像列表中最快的鏡像服務器,并從中下載文件包。要安裝,請輸入:yum install yum-fastestmirror現(xiàn)在,像通常使用Linux YUM那樣使用就可以了。你可以在下面這個文件中配置這個插件的各種設置:gedit /etc/yum/pluginconf.d/fastestmirror.conf
5.安裝加速插件(試了沒有,除出錯誤信息什么都沒有)
這個插件為Fedora用戶提供更快,更小的下載量,它只下載 rpm 安裝包中被更新的部分,而不是整個rpm 包。加速插件被計劃包含在Fedora11中。要安裝,請輸入:yum install yum-presto然后編輯 /etc/yum.repos.d/fedora-updates.repo 文件gedit /etc/yum.repos.d/fedora-updates.repo將mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates- released-f$releasever&arch=$basearch這一行注釋掉(在前加上#),然后在其下,加上這樣一行:mirrorlist=http://presto-mirrors.anmar.eu.org/mirrorlist?repo=updates-released-f$releasever&arch=$basearch保存退出即可。
6. 配置Linux YUM以使用代理
如果你使用 http 代理服務器,如果你想要 yum 通過代理服務器連接網(wǎng)絡,打開終端,輸入如下命令:gedit /etc/yum.conf在 Linux YUM配置中加入下面這一行proxy=http://ip:port/ ip就是你代理服務器的 ip 地址,端口就是你代理服務器監(jiān)聽的端口。不要忘記端口后面的 “/” 符號。
7. 安全插件
這個插件只允許你搜索并安裝僅和安全有關的升級包,如果你將 Fedora 安裝在服務器的生產(chǎn)力模式下還是非常實用的。要安裝,請輸入:yum install yum-security要應用安全插件請輸入yum –security update需要了解更多信息或者像 bugzilla 匯報等額外選項或者咨詢信息,請閱讀手冊man yum-security
8.允許降級的插件
Linux YUM 默認是不允許你降級一個軟件包的,然而有時候一個新的軟件包反而給你帶來問題。在這種情況下你就可以用這個插件降級該軟件到之前穩(wěn)定版本了。要安裝,請輸入:yum install yum-allowdowngrade要使用它請輸入yum update –allow-downgrade你可以通過更改下面這個文件中被啟用的選項來禁用該插件
gedit /etc/yum/pluginconf.d/allowdowngrade.conf
9.安裝axel
最簡單的方法是下載rpm包,分別下載axel和yum-axelget到本地,然后執(zhí)行:yum --nogpgcheck localinstall axel-2.3.1.fc10.i386.rpm yum --nogpgcheck localinstall yum-axelget-.0-0.2.20080705.fc10.noarch.rpm這樣axel就下載完成了,它可以使在下載時將一個文件或者包,分成10份同時進行下載。
10.至此,大功告成。
在下載時偶爾會出現(xiàn)它的最快鏡像插件選擇不對的情況,如果比較著急的話可以在它下載的時候感覺進度條半天沒動或者剩余時間還有很長的時候選擇中斷這個源的下載,ctrl+C,然后Linux YUM會自動開始從別的源去下載更新。
【編輯推薦】