<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                摘自:[http://www.cnblogs.com/focusonepoint/p/7120861.html](http://www.cnblogs.com/focusonepoint/p/7120861.html) > 1. yum,是Yellow dog Updater, Modified 的簡稱,是杜克大學為了提高RPM 軟件包安裝性而開發的一種軟件包管理器。 > 2. yum 的宗旨是自動化地升級,安裝/移除rpm 包,收集rpm 包的相關信息,檢查依賴性并自動提示用戶解決。yum 的關鍵之處是要有可靠的repository,顧名思義,這是軟件的倉庫,它可以是http 或ftp 站點,也可以是本地軟件池,但必須包含rpm 的header,header 包括了rpm 包的各種信息,包括描述,功能,提供的文件,依賴性等。**正是收集了這些header 并加以分析,才能自動化地完成余下的任務。** ## 1、yum配置 yum 的配置文件分為兩部分:main 和repository > 1. main 部分定義了全局配置選項,整個yum 配置文件應該只有一個main。常位于/etc/yum.conf 中。 > 2. repository 部分定義了每個源/服務器的具體配置,可以有一到多個。常位于/etc/yum.repo.d 目錄下的各文件中。 yum.conf 文件一般位于/etc目錄下,一般其中只包含main部分的配置選項。 cat /etc/yum.conf ~~~ [main] cachedir=/var/cache/yum   //yum 緩存的目錄,yum 在此存儲下載的rpm 包和數據庫,默認設置為/var/cache/yum keepcache=0   //安裝完成后是否保留軟件包,0為不保留(默認為0),1為保留 debuglevel=2   //Debug 信息輸出等級,范圍為0-10,缺省為2 logfile=/var/log/yum.log   //yum 日志文件位置。用戶可以到/var/log/yum.log 文件去查詢過去所做的更新。 pkgpolicy=newest   //包的策略。一共有兩個選項,newest 和last,這個作用是如果你設置了多個repository,而同一軟件在不同的repository 中同時存在,yum 應該安裝哪一個,如果是newest,則yum 會安裝最新的那個版本。如果是last,則yum 會將服務器id 以字母表排序,并選擇最后的那個服務器上的軟件安裝。一般都是選newest。 distroverpkg=redhat-release   //指定一個軟件包,yum 會根據這個包判斷你的發行版本,默認是redhat-release,也可以是安裝的任何針對自己發行版的rpm 包。 tolerant=1   //有1和0兩個選項,表示yum 是否容忍命令行發生與軟件包有關的錯誤,比如你要安裝1,2,3三個包,而其中3此前已經安裝了,如果你設為1,則yum 不會出現錯誤信息。默認是0。 exactarch=1   //有1和0兩個選項,設置為1,則yum 只會安裝和系統架構匹配的軟件包,例如,yum 不會將i686的軟件包安裝在適合i386的系統中。默認為1。 retries=6   //網絡連接發生錯誤后的重試次數,如果設為0,則會無限重試。默認值為6. obsoletes=1   //這是一個update 的參數,具體請參閱yum(8),簡單的說就是相當于upgrade,允許更新陳舊的RPM包。 plugins=1   //是否啟用插件,默認1為允許,0表示不允許。我們一般會用yum-fastestmirror這個插件。 bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum # Note: yum-RHN-plugin doesn't honor this. metadata_expire=1h installonly_limit = 5 # PUT YOUR REPOS HERE OR IN separate files named file.repo # in /etc/yum.repos.d ~~~ 除了上述之外,還有一些可以添加的選項,如:   exclude=selinux\*  //?排除某些軟件在升級名單之外,可以用通配符,列表中各個項目要用空格隔開,這個對于安裝了諸如美化包,中文補丁的朋友特別有用。   gpgcheck=1  //?有1和0兩個選擇,分別代表是否是否進行gpg(GNU Private Guard) 校驗,以確定rpm 包的來源是有效和安全的。這個選項如果設置在\[main\]部分,則對每個repository 都有效。默認值為0。 **四、配置本地yum源** 1、掛載系統安裝光盤 \# mount /dev/cdrom /mnt/cdrom/ 2、配置本地yum源 \# cd /etc/yum.repos.d/ \# ls 會看到四個repo 文件 ![](https://images0.cnblogs.com/blog/370046/201301/02161702-13be6e07506743d4a079d61f13a069af.jpg) CentOS-Base.repo?是yum 網絡源的配置文件 CentOS-Media.repo 是yum?本地源的配置文件 修改CentOS-Media.repo \# cat CentOS-Media.repo [![復制代碼](http://common.cnblogs.com/images/copycode.gif)](javascript:void(0); "復制代碼") ![復制代碼](https://common.cnblogs.com/images/copycode.gif) ~~~ # CentOS-Media.repo # # This repo is used to mount the default locations for a CDROM / DVD on # CentOS-5. You can use this repo and yum to install items directly off the # DVD ISO that we release. # # To use this repo, put in your DVD and use it with the other repos too: # yum --enablerepo=c5-media [command] # # or for ONLY the media repo, do this: # # yum --disablerepo=\* --enablerepo=c5-media [command] [c5-media] name=CentOS-$releasever - Media baseurl=file:///media/CentOS/ file:///mnt/cdrom/ file:///media/cdrecorder/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 ~~~ 在baseurl 中修改第2個路徑為/mnt/cdrom(即為光盤掛載點) 將enabled=0改為1 3、禁用默認的yum 網絡源 將yum 網絡源配置文件改名為CentOS-Base.repo.bak,否則會先在網絡源中尋找適合的包,改名之后直接從本地源讀取。 4、執行yum 命令 \# yum install postgresql ![](https://images0.cnblogs.com/blog/370046/201301/02163552-8dc2dcbe31e04844aa1f15ce3b5820e1.jpg) ![](https://images0.cnblogs.com/blog/370046/201301/02163602-79f3e3139ea54fdfb1978735548a7fa0.jpg) **關于repo 文件的格式** 所有repository?服務器設置都應該遵循如下格式: ~~~ [serverid] name=Some name for this server baseurl=url://path/to/repository/ ~~~ * serverid 是用于區別各個不同的repository,必須有一個獨一無二的名稱; * name 是對repository 的描述,支持像$releasever $basearch這樣的變量; * baseurl 是服務器設置中最重要的部分,只有設置正確,才能從上面獲取軟件。它的格式是: ~~~ baseurl=url://server1/path/to/repository/      url://server2/path/to/repository/      url://server3/path/to/repository/ ~~~ 其中url 支持的協議有 http:// ftp://?file://?三種。baseurl 后可以跟多個url,你可以自己改為速度比較快的鏡像站,但baseurl 只能有一個,也就是說不能像如下格式: ~~~ baseurl=url://server1/path/to/repository/ baseurl=url://server2/path/to/repository/ baseurl=url://server3/path/to/repository/ ~~~ 其中url 指向的目錄必須是這個repository header 目錄的上一級,它也支持$releasever $basearch 這樣的變量。 url 之后可以加上多個選項,如gpgcheck、exclude、failovermethod 等,比如: ~~~ [updates-released] name=Fedora Core $releasever - $basearch - Released Updates baseurl=http://download.atrpms.net/mirrors/fedoracore/updates/$releasever/$basearch      http://redhat.linux.ee/pub/fedora/linux/core/updates/$releasever/$basearch      http://fr2.rpmfind.net/linux/fedora/core/updates/$releasever/$basearch gpgcheck=1 exclude=gaim failovermethod=priority ~~~ 其中gpgcheck,exclude 的含義和\[main\] 部分相同,但只對此服務器起作用,failovermethode 有兩個選項roundrobin 和priority,意思分別是有多個url可供選擇時,yum 選擇的次序,roundrobin 是隨機選擇,如果連接失敗則使用下一個,依次循環,priority 則根據url 的次序從第一個開始。如果不指明,默認是roundrobin。 **五、配置國內yum源** 系統默認的yum 源速度往往不盡人意,為了達到快速安裝的目的,在這里修改yum源為國內源。 上海交通大學yum源 a. 修改/etc/yum.repos.d/CentOS-Base.repo為: [![復制代碼](http://common.cnblogs.com/images/copycode.gif)](javascript:void(0); "復制代碼") ![復制代碼](https://common.cnblogs.com/images/copycode.gif) ~~~ # CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever - Base #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #released updates [updates] name=CentOS-$releasever - Updates #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 ~~~ ![復制代碼](https://common.cnblogs.com/images/copycode.gif) [![復制代碼](http://common.cnblogs.com/images/copycode.gif)](javascript:void(0); "復制代碼") 關于變量 * $releasever:代表發行版的版本,從\[main\]部分的distroverpkg獲取,如果沒有,則根據redhat-release包進行判斷。 * $arch:cpu體系,如i686,athlon等 * $basearch:cpu的基本體系組,如i686和athlon同屬i386,alpha和alphaev6同屬alpha。 b.?導入GPG KEY yum 可以使用gpg 對包進行校驗,確保下載包的完整性,所以我們先要到各個repository 站點找到gpg key,一般都會放在首頁的醒目位置,一些名字諸如RPM-GPG-KEY-CentOS-5 之類的純文本文件,把它們下載下來,然后用rpm --import RPM-GPG-KEY-CentOS-5?命令將key 導入。 c.?執行yum 命令 ![](https://images0.cnblogs.com/blog/370046/201301/02195444-169e4e7d0e144142b39578e6f75ea63c.jpg) 其他國內yum源列表如下: 1\. 企業貢獻: 搜狐開源鏡像站:[http://mirrors.sohu.com/](http://mirrors.sohu.com/) 網易開源鏡像站:[http://mirrors.163.com/](http://mirrors.163.com/) 2\. 大學教學: 北京理工大學: [http://mirror.bit.edu.cn](http://mirror.bit.edu.cn/)?(IPv4 only) [http://mirror.bit6.edu.cn](http://mirror.bit6.edu.cn/)?(IPv6 only) 北京交通大學: [http://mirror.bjtu.edu.cn](http://mirror.bjtu.edu.cn/)?(IPv4 only) [http://mirror6.bjtu.edu.cn](http://mirror6.bjtu.edu.cn/)?(IPv6 only) [http://debian.bjtu.edu.cn](http://debian.bjtu.edu.cn/)?(IPv4+IPv6) 蘭州大學:[http://mirror.lzu.edu.cn/](http://mirror.lzu.edu.cn/) 廈門大學:[http://mirrors.xmu.edu.cn/](http://mirrors.xmu.edu.cn/) 清華大學: [http://mirrors.tuna.tsinghua.edu.cn/](http://mirrors.tuna.tsinghua.edu.cn/)?(IPv4+IPv6) [http://mirrors.6.tuna.tsinghua.edu.cn/](http://mirrors.6.tuna.tsinghua.edu.cn/)?(IPv6 only) [http://mirrors.4.tuna.tsinghua.edu.cn/](http://mirrors.4.tuna.tsinghua.edu.cn/)?(IPv4 only) 天津大學:[http://mirror.tju.edu.cn/](http://mirror.tju.edu.cn/) 中國科學技術大學: [http://mirrors.ustc.edu.cn/](http://mirrors.ustc.edu.cn/)?(IPv4+IPv6) [http://mirrors4.ustc.edu.cn/](http://mirrors4.ustc.edu.cn/) [http://mirrors6.ustc.edu.cn/](http://mirrors6.ustc.edu.cn/) 東北大學: [http://mirror.neu.edu.cn/](http://mirror.neu.edu.cn/)?(IPv4 only) [http://mirror.neu6.edu.cn/](http://mirror.neu6.edu.cn/)?(IPv6 only) 電子科技大學:[http://ubuntu.uestc.edu.cn/](http://ubuntu.uestc.edu.cn/) **六、使用第三方軟件庫** Centos/RHEL默認的yum軟件倉庫非常有限,僅僅限于發行版本那幾張盤里面的常規包和一些軟件包的更新,利用RpmForge,可以增加非常多的第三方rpm軟件包。RpmForge庫現在已經擁有超過10000種的CentOS的軟件包,被CentOS社區認為是最安全也是最穩定的一個第三方軟件庫。 1、安裝yum-priorities插件 這個插件是用來設置yum在調用軟件源時的順序的。因為官方提供的軟件源,都是比較穩定和被推薦使用的。因此,官方源的順序要高于第三方源的順序。如何保證這個順序,就需要安裝yum-priorities這插件了。 \# yum -y install yum-priorities ![](https://images0.cnblogs.com/blog/370046/201301/02204151-aa1395b880d746cb84bed46976a156a1.jpg) 2、安裝完yum-priorities插件后需要設置/etc/yum.repos.d/ 目錄下的.repo相關文件(如CentOS-Base.repo),在這些文件中插入順序指令:priority=N (N為1到99的正整數,數值越小越優先) 一般配置\[base\],?\[addons\],?\[updates\],?\[extras\] 的priority=1,\[CentOSplus\],?\[contrib\] 的priority=2,其他第三的軟件源為:priority=N (推薦N>10) 以CentOS-Base.repo 為例: [![復制代碼](http://common.cnblogs.com/images/copycode.gif)](javascript:void(0); "復制代碼") ![復制代碼](https://common.cnblogs.com/images/copycode.gif) ~~~ [base] name=CentOS-$releasever - Base #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 priority=1 ~~~ ![復制代碼](https://common.cnblogs.com/images/copycode.gif) [![復制代碼](http://common.cnblogs.com/images/copycode.gif)](javascript:void(0); "復制代碼") 3、下載與安裝相應rpmforge的rpm文件包 \# wget?[http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm](http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm) 4、安裝DAG的PGP Key \# rpm --import?[http://apt.sw.be/RPM-GPG-KEY.dag.txt](http://apt.sw.be/RPM-GPG-KEY.dag.txt) 5、驗證rpmforge的rpm文件包 \# rpm -K rpmforge-release-0.5.2-2.el5.rf.\*.rpm 6、安裝rpmforge的rpm文件包 \# rpm -i rpmforge-release-0.5.2-2.el5.rf.i386.rpm ![](https://images0.cnblogs.com/blog/370046/201301/02210852-3f7781d7c9f7431e8d1fc090f4b83162.jpg) 7、設置/etc/yum.repos.d/rpmforge.repo文件中源的級別 \[root@TS-DEV yum.repos.d\]# cat rpmforge.repo? [![復制代碼](http://common.cnblogs.com/images/copycode.gif)](javascript:void(0); "復制代碼") ![復制代碼](https://common.cnblogs.com/images/copycode.gif) ~~~ ### Name: RPMforge RPM Repository for RHEL 5 - dag ### URL: http://rpmforge.net/ [rpmforge] name = RHEL $releasever - RPMforge.net - dag baseurl = http://apt.sw.be/redhat/el5/en/$basearch/rpmforge mirrorlist = http://apt.sw.be/redhat/el5/en/mirrors-rpmforge #mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge enabled = 1 protect = 0 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag gpgcheck = 1 priority=12 ~~~ ![復制代碼](https://common.cnblogs.com/images/copycode.gif) [![復制代碼](http://common.cnblogs.com/images/copycode.gif)](javascript:void(0); "復制代碼") 8、測試安裝 \# yum install htop ![](https://images0.cnblogs.com/blog/370046/201301/02212020-80d96b6885a54f0ba99b6a25ec653fdf.jpg)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看