1. 程式人生 > >CentOS 6.6 yum源完全配置

CentOS 6.6 yum源完全配置

本文來自Q群52240781

一  yum 簡介
    yum,是"Yellow dog Updater,Modified"的簡稱,是杜克大學為了提高RPM軟體包安裝性而開發的一種軟體包管理器. 起初是由yellow dog這一發行版的開發者Terra Soft研發,用python寫成,那時還叫做yup(yellow dog updater),後經杜克大學的[email protected]開發團隊進行改進,遂有此名. yum的宗旨是自動化地升級,安裝/移除rpm包,收集rpm包的相關資訊,檢查依賴性並自動提示使用者解決. yum的關鍵之處是要有可靠的repository,顧名思義,這是軟體的倉庫,它可以是http或ftp站點,也可以是本地軟體池,但必須包含rpm的header,header包括了rpm包的各種資訊,包括描述,功能,提供的檔案,依賴性等. 正是收集了這些header並加以分析,才能自動化地完成餘下的任務.
    yum 的理念是使用一箇中心倉庫(repository)管理一部分甚至一個distribution的應用程式相互關係,根據計算出來的軟體依賴關係進行相關的升級,安裝, 刪除等操作,減少了Linux使用者一直頭痛的dependencies的問題. 這一點上,yum和apt相同. apt原為debian的deb型別軟體管理所使用,但是現在也能用到RedHat 門下的rpm了.
    yum主要功能是更方便的新增/刪除/更新RPM包,自動解決包的依賴性問題,便於管理大量系統的更新問題.
    yum可以同時配置多個資源庫(Repository),簡潔的配置檔案(/etc/yum.conf),自動解決增加或刪除rpm包時遇到的依賴性問題,保持與RPM資料庫的一致性.

+--------------------------+
| 使用Yum下載RPM包而不安裝

|
+--------------------------+

方法一:通過yum自帶一個工具:yumdownloader
# yum -y install yum-utils*
# rpm -ql yum-utils
/usr/bin/debuginfo-install
/usr/bin/package-cleanup
/usr/bin/repo-graph
/usr/bin/repo-rss
/usr/bin/repoclosure
/usr/bin/repodiff
/usr/bin/repomanage
/usr/bin/repoquery
/usr/bin/reposync
/usr/bin/repotrack
/usr/bin/verifytree
/usr/bin/yum-builddep
/usr/bin/yum-debug-dump
/usr/bin/yum-groups-manager
/usr/bin/yumdownloader       #可以看到yumdownloade這個工具是由yum-utils這個軟體安裝生成的!

安裝好後就可以直接使用了,使用非常簡單,如下:

# yumdownloader vlock
vlock-1.3-23.i386.rpm                                          |  11 kB     00:00    
# ls
vlock-1.3-23.i386.rpm

方法二:使用yum的一個外掛:yum-downloadonly

安裝外掛
# yum install yum-downloadonly
會自動下載安裝yum-plugin-downloadonly
# ls /etc/yum/pluginconf.d/downloadonly.conf
/etc/yum/pluginconf.d/downloadonly.conf

安裝yum支援的所有外掛

yum install axel
yum install yum-presto
yum install yum-fastestmirror
yum install yum-metadata-parser
yum install yum-downloadonly
yum install yum-priorities
yum install yum-*


下載檔案:
# yum install --downloadonly tftp
下載後文件在/var/cache下
# ls /var/cache/yum/i386/6/base/packages/tftp-0.49-7.el6.i686.rpm
# yum install --downloadonly tftp --downloaddir=~/ #指定檔案下載路徑

二  yum安裝
    CentOS預設已經安裝了yum,不需要另外安裝,這裡為了實驗目的,先將yum解除安裝再重新安裝.
1  檢視系統預設安裝的yum
    # rpm -qa|grep yum
2  解除安裝yum
    # rpm -e yum-fastestmirror-1.1.16-14.el5.centos.1 yum-metadata-parser-1.1.2-3.el5.centos yum-3.2.22-33.el5.centos
3  重新安裝yum
    這裡可以通過wget 從網上下載相關包安裝,也可以掛載系統安裝光碟進行安裝,這裡選擇掛載系統安裝光碟進行安裝.
    # mount /dev/cdrom /mnt/cdrom/
    # rpm -ivh yum-3.2.22-33.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
    # yum -v

yum 的基礎安裝包包括:
    yum  //RPM installer/updater
    yum-fastestmirror  //Yum plugin which chooses fastest repository from a mirrorlist
    yum-metadata-parser  //A fast metadata parser for yum


三  yum配置
    yum的配置檔案分為兩部分main和repository
    main部分定義了全域性配置選項,整個yum 配置檔案應該只有一個main. 常位於/etc/yum.conf中.
    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/
   或者掛在系統映象
    # mount -o loop -t iso9660 CentOS-6.6-x86_64-bin-DVD1.iso /media/_local_repo_DVD1
    # mount -o loop -t iso9660 CentOS-6.6-x86_64-bin-DVD2.iso /media/_local_repo_DVD2
2  配置本地yum源
    # cd /etc/yum.repos.d/
    # ls
    會看到四個repo 檔案
    CentOS-Base.repo 是yum網路源的配置檔案
    CentOS-Media.repo 是yum本地源的配置檔案
    建立_local_DVD.repo
    # vim _local_DVD.repo
#########################################
[_local_DVD]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
        file:///mnt/cdrom/
        file:///media/cdrecorder/
        file:///media/_local_repo_DVD1
        file:///media/_local_repo_DVD2
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#########################################
    在baseurl中修改第2個路徑為/mnt/cdrom(即為光碟掛載點)
    將enabled=0改為1
3  禁用預設的yum 網路源
    將yum 網路源配置檔案改名為CentOS-Base.repo.backup,否則會先在網路源中尋找適合的包,改名之後直接從本地源讀取.
4  執行yum 命令
    # yum install vim

關於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
enable=1
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檔案為CentOS-Base.repo.backup;並複製一份改名為CenOS-sjtu.repo,內容為:
----------------------------------------------
# CentOS-Base.repo
[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/
enable=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#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/
enable=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#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/
enable=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#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/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#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/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
----------------------------------------------
關於變數
    $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-6 之類的純文字檔案,把它們下載下來,然後用rpm --import RPM-GPG-KEY-CentOS-6 命令將key匯入.

c. 執行yum 命令

其他國內yum源列表如下:
1. 企業貢獻:
搜狐開源映象站:http://mirrors.sohu.com/
網易開源映象站:http://mirrors.163.com/
2. 大學教學:
北京理工大學:
    http://mirror.bit.edu.cn (IPv4 only)
    http://mirror.bit6.edu.cn (IPv6 only)
北京交通大學:
    http://mirror.bjtu.edu.cn (IPv4 only)
    http://mirror6.bjtu.edu.cn (IPv6 only)
    http://debian.bjtu.edu.cn (IPv4+IPv6)
蘭州大學:http://mirror.lzu.edu.cn/
廈門大學:http://mirrors.xmu.edu.cn/
清華大學:
    http://mirrors.tuna.tsinghua.edu.cn/ (IPv4+IPv6)
    http://mirrors.6.tuna.tsinghua.edu.cn/ (IPv6 only)
    http://mirrors.4.tuna.tsinghua.edu.cn/ (IPv4 only)
天津大學:http://mirror.tju.edu.cn/
中國科學技術大學:
    http://mirrors.ustc.edu.cn/ (IPv4+IPv6)
    http://mirrors4.ustc.edu.cn/
    http://mirrors6.ustc.edu.cn/
東北大學:
    http://mirror.neu.edu.cn/ (IPv4 only)
    http://mirror.neu6.edu.cn/ (IPv6 only)
電子科技大學: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
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 為例:
##############################################################
[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-6
priority=1
##############################################################

+---------------------------+
| 新增adobe軟體倉並匯入金鑰 |
+---------------------------+
32位

# rpm -ivh adobe-release-i386-1.0-1.noarch.rpm 
64位

# rpm -ivh adobe-release-x86_64-1.0-1.noarch.rpm
# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
設定/etc/yum.repos.d/中的adobe-linux-x86_64.repo中的priority=10
現在可以安裝adobe的flashplayer外掛了
# yum install flash-plugin

+------------------+
| 安裝atomic yum源 |
+------------------+
    # wget http://www.atomicorp.com/installers/atomic  #下載
    # sh ./atomic   #安裝
    # vi  /etc/yum.repos.d/atomic.repo  #修改atomic yum源優先順序,priority=11
##############################################################
[atomic]
name=CentOS / Red Hat Enterprise Linux $releasever - atomicrocketturtle.com
mirrorlist=http://www.atomicorp.com/mirrorlist/atomic/centos-6-$basearch
#mirrorlist=http://www.atomicorp.com/channels/atomic/centos/6/mirrors-atomic
enabled=1
protect=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY.art.txt
priority=11
##############################################################

+----------------+
| 安裝epel yum源 |
+----------------+
rpmfusion主要為桌面發行版提供大量rpm包,而EPEL則為伺服器版本提供大量的rpm包,而且大多數rpm包在官方repository中是找不到的;

CentOS 5.*
32位系統

# rpm -ivh epel-release-5-4.noarch.rpm
64位系統:

# rpm -ivh epel-release-5-4.noarch.rpm
匯入key:

# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5

CentOS 6.*
32位系統:

# ipm -ivh epel-release-6-8.noarch.rpm
64位系統:

# rpm -ivh epel-release-6-8.noarch.rpm
匯入key:

# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

如果用比較新的軟體,用epel-test.repo這個檔案就行了
別忘了安裝# yum install yum-priorities

    # vi /etc/yum.repos.d/epel.repo   #修改epel yum源優先順序,priority=12
###############################################################
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
priority=12
#################################################################

+--------------------+
| 安裝rpmforge軟體源 |
+--------------------+
1  下載與安裝相應rpmforge的rpm檔案包,到http://pkgs.repoforge.org/rpmforge-release/ 查詢對應版本的軟體下載
32位# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
64位# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
2  安裝DAG的PGP Key
    # rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
    或者匯入本地的key
    # rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-*
3  驗證rpmforge的rpm檔案包
    # rpm -K rpmforge-release-0.5.3-1.el6.rf.*.rpm
4  安裝rpmforge的rpm檔案包
    # rpm -i rpmforge-release-0.5.3-1.el6.rf.*.rpm
5  設定/etc/yum.repos.d/rpmforge.repo檔案中源的級別
    # cat rpmforge.repo
########################################################
### Name: RPMforge RPM Repository for RHEL 6 - dag
### URL: http://rpmforge.net/
[rpmforge]
name=RHEL $releasever - RPMforge.net - dag
baseurl=http://apt.sw.be/redhat/el6/en/$basearch/rpmforge
mirrorlist=http://apt.sw.be/redhat/el6/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=13
########################################################

+---------------------+
| 安裝rpmfusion yum源 |
+---------------------+
含有各種音視訊軟體,但穩定性不如rpmforge
32位
    # rpm -ivh http://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-free-release-6-1.noarch.rpm
    # rpm -ivh http://download1.rpmfusion.org/nonfree/el/updates/6/i386/rpmfusion-nonfree-release-6-1.noarch.rpm
64位
    # rpm -ivh http://download1.rpmfusion.org/free/el/updates/6/x86_64/rpmfusion-free-release-6-1.noarch.rpm
    # rpm -ivh http://download1.rpmfusion.org/nonfree/el/updates/6/x86_64/rpmfusion-nonfree-release-6-1.noarch.rpm

    # vi /etc/yum.repos.d/rpmfusion-free-updates.repo   #修改rpmfusion yum源優先順序,priority=13
#################################################################
[rpmfusion-free-updates-testing]
name=RPM Fusion for EL 6 - Free - Test Updates
#baseurl=http://download1.rpmfusion.org/free/el/updates/testing/6/$basearch/
mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=free-el-updates-testing-6&arch=$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-el-6
priority=14
#################################################################

安裝完畢執行
# yum clean all
# yum makecache
然後就可以使用新的yum源管理軟體

//////////////////////下面是一個yum配置的指令碼程式,可以運行於centos6.x////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#! /bin/bash
# created by longbin <[email protected]>
# 2015-08-06
## yum and yum plugins installation scripts

PLAT_ARCH=$(uname -i | tr 'A-Z' 'a-z')

## check whether system is centos or not
function check_system_distributor() {
## get system distributor ID: centos ?
LINUX_DISTRIBUTOR=$(cat /etc/issue |tr 'A-Z' 'a-z'|awk ' /release/ {print $1}' | sed -n "1p")
LINUX_DISTRIBUTOR=${LINUX_DISTRIBUTOR:=$(lsb_release -i |tr 'A-Z' 'a-z'|awk '/distributor/ {print $3}')}
LINUX_DISTRIBUTOR=${LINUX_DISTRIBUTOR:=$(cat /etc/*release |tr 'A-Z' 'a-z'|awk '/\<release\>/ {print $1}'|sed -n '1p')}
LINUX_DISTRIBUTOR=${LINUX_DISTRIBUTOR:=$(cat /etc/*release |tr 'A-Z' 'a-z'|awk '/distrib_id=/ {print $1}'|sed 's/distrib_id=//'|sed -n '1p')}

	echo "checking system distributor and release ID ..."
	if [[ "${LINUX_DISTRIBUTOR}" == "centos" ]] ;then
		echo -e "\tCurrent OS Distributor: ${LINUX_DISTRIBUTOR}"
	else
		echo -e "\tCurrent OS is not centos"
		echo -e "\tCurrent OS Distributor: ${LINUX_DISTRIBUTOR}"
		exit 1
	fi
}

## check whether system is centos 6.5 or 6.6
function check_system_release_version() {
## get system release version: 6.5/6.6 ?
LINUX_RELEASE_VERSION=$(cat /etc/issue | awk '/release/ {print $3}'| sed -n '1p')
LINUX_RELEASE_VERSION=${LINUX_RELEASE_VERSION:=$(lsb_release -r | tr 'A-Z' 'a-z' | awk '/release/ {print $2}')}
LINUX_RELEASE_VERSION=${LINUX_RELEASE_VERSION:=$(cat /etc/*release |tr 'A-Z' 'a-z'|awk '/\<release\>/ {print $3}'|sed -n '1p')}
LINUX_RELEASE_VERSION=${LINUX_RELEASE_VERSION:=$(cat /etc/*release |tr 'A-Z' 'a-z'|awk '/distrib_release=/ {print $1}'|sed 's/distrib_release=//'|sed -n '1p')}
	case ${LINUX_RELEASE_VERSION:0:5} in
		6.*)
			echo -e "\tCurrent OS Version: ${LINUX_RELEASE_VERSION}"
			;;
		*)
			echo "Only support centos version, eg: 6.5/6.6 ..."
			exit 1
			;;
	esac
	echo "checked OK, preparing to setup softwares ..."
}

function check_user_UID() {
	sudo ls > /dev/null
	if [ "x$?" == "x1" ] ;then
		echo -e "\tThere is a configuration/permission problem."
		echo -e "\tPlease ensure that you have the permission"
		exit 1
	fi
	if [ "x${UID}" == "x0" ] ;then
		SUDO=''
	else
		SUDO=sudo
	fi
}

function check_yum_install_env() {
	check_system_distributor
	check_system_release_version
	check_user_UID
	trap 'echo -e "\nAborted by user, exit";exit' INT
	if [ "x$(which yum 2>/dev/null)" == "x" ] ;then
		echo "yum not exists, please install yum manully"
		exit 1
	fi
}

function yum_plugins_installation() {
	echo "Preparing to install yum plugins ..."
	# ${SUDO} yum install yum-*
	# ${SUDO} yum install axel
	${SUDO} yum install yum-presto
	${SUDO} yum install yum-fastestmirror
	${SUDO} yum install yum-metadata-parser
	${SUDO} yum install yum-downloadonly
	${SUDO} yum install yum-priorities
}

function yum_axel_plugin_install() {
	${SUDO} yum install axel
#	if [ "x${PLAT_ARCH}" == "xx86_64" ] ;then
#		${SUDO} rpm -ivh http://pkgs.repoforge.org/axel/axel-2.4-1.el6.rf.x86_64.rpm
#	else
#		${SUDO} rpm -ivh http://pkgs.repoforge.org/axel/axel-2.4-1.el6.rf.i686.rpm
#	fi
	# pushd /etc/yum/pluginconf.d/
	# ${SUDO} wget http://cnfreesoft.googlecode.com/svn/trunk/axelget/axelget.conf
	${SUDO} wget http://www.ha97.com/code/axelget.conf -P /etc/pluginconf.d/
	if [ "$?" != 0 ] ;then
		local tmp_file=$(mktemp)
		${SUDO} cat > ${tmp_file} << EOF
[main]
enabled=1
onlyhttp=1
enablesize=54000
cleanOnException=1
EOF
		${SUDO} mv ${tmp_file} /etc/yum/pluginconf.d/axelget.conf
	fi
	# popd
	# pushd /usr/lib/yum-plugins/
	# ${SUDO} wget http://cnfreesoft.googlecode.com/svn/trunk/axelget/axelget.py
	${SUDO} wget http://www.ha97.com/code/axelget.py -P /usr/lib/yum-plugins/
	if [ "$?" != 0 ] ;then
		local tmp_file=$(mktemp)
		${SUDO} cat > ${tmp_file} << EOF
from yum.plugins import PluginYumExit, TYPE_CORE, TYPE_INTERACTIVE
from urlparse import urljoin
import os,time

requires_api_version = '2.3'
plugin_type = (TYPE_CORE, TYPE_INTERACTIVE)

enablesize=300000
trymirrornum=-1
maxconn=10
httpdownloadonly=False
cleanOnException=0

def init_hook(conduit):
	global enablesize,trymirrornum,maxconn,cleanOnException,httpdownloadonly
	enablesize = conduit.confInt('main','enablesize',default=30000)
	trymirrornum = conduit.confInt('main','trymirrornum',default=-1)
	maxconn = conduit.confInt('main','maxconn',default=10)
	httpdownloadonly=conduit.confBool('main','onlyhttp',default=False)
	cleanOnException=conduit.confInt('main','cleanOnException',default=0)
	return

def predownload_hook(conduit):
	global enablesize,cleanOnException,httpdownloadonly
	preffermirror=""
	PkgIdx=0
	TotalPkg=len(conduit.getDownloadPackages())
	for po in (conduit.getDownloadPackages()):
		PkgIdx+=1
		if hasattr(po, 'pkgtype') and po.pkgtype == 'local':
			continue
		totsize = long(po.size)
		ret = False
		if totsize <= enablesize:
			conduit.info(2, "Package %s download size %d less than %d,Skip plugin!"  % (po.repo.id,totsize,enablesize))
			continue
		else:
			conduit.info(2, "[%d/%d]Ok,we will try to use axel to download this big file:%d" % (PkgIdx,TotalPkg,totsize))
		local = po.localPkg()
		if os.path.exists(local):
			if not os.path.exists(local+".st"):
				fstate=os.stat(local)
				if totsize == fstate.st_size:
					conduit.info(2,"Target already exists,skip to next file!")
					continue
		localall = "%s %s" % (local,local+".st")
		rmcmd = "rm -f %s" % (localall)
		curmirroridx = 0
		conduit.info(2,"Before we start,clean all the key files")
		os.system(rmcmd)
		connnum = totsize / enablesize
		if connnum*enablesize<totsize:
			connnum+=1
		if connnum > maxconn:
			connnum = maxconn
		mirrors=[]
		mirrors[:0]=po.repo.urls
		if preffermirror != "":
			mirrors[:0] = [preffermirror]
		for url in mirrors:
			if url.startswith("ftp://") and httpdownloadonly:
				print "Skip Ftp Site:",url
				continue
			if url.startswith("file://"):
				print "Skip Local Site:",url
				continue
			curmirroridx += 1
			if (curmirroridx > trymirrornum) and (trymirrornum != -1):
				conduit.info(2, "Package %s has tried %d mirrors,Skip plugin!" % (po.repo.id,trymirrornum))
				break
			remoteurl =  "%s/%s" % (url,po.remote_path)
			syscmd = "axel -a -n %s %s -o %s" % (connnum,remoteurl,local)
			conduit.info(2, "Execute axel cmd:\n%s"  % syscmd)
			os.system(syscmd)
			time.sleep(2)
			if os.path.exists(local+".st"):
				conduit.info(2,"axel exit by exception,let's try another mirror")
				if cleanOnException:
					conduit.info(2,"because cleanOnException is set to 1,we do remove key file first")
					os.system(rmcmd)
				continue
			elif not os.path.exists(local):#this mirror may not update yet
				continue
			else:
				ret = True
				preffermirror=url
				break
		if not ret:
			conduit.info (2,"try to run rm cmd:%s"  % rmcmd)
			os.system(rmcmd)
EOF
		${SUDO} mv ${tmp_file} /usr/lib/yum-plugins/axelget.py
	fi
	# popd
}

# modify varible value of file callback function
function modify_varible_value_of_file_cb() {
	if [ "$#" -lt 3 ] ;then
		echo "too less arguments"
		exit 1
	fi
	# echo $*
	local filename=$1
	local variable=$2
	local value=$3
	local res=$(cat ${filename}| sed -n "/^${variable}/p")
	if [ "x${res}" == "x" ] ;then
		#append variable and value to file
		${SUDO} sed -i "/^enable[d]\?[ ]\?=[ ]\?1/ a ${variable}=${value}" ${filename}
	else
		#modify variable and value to file
		${SUDO} sed -i "/^${variable}[ ]\?=/ s;${variable}.*$;${variable}=${value};" ${filename}
	fi
}

function check_yum_conf_enable_plugins() {
	local yum_conf=$(cat /etc/yum.conf| sed -n '/^plugins[ ]\?=[ ]\?1/p')
	if [ "x${yum_conf}" != "x" ] ;then
		return
	else
		# yum_conf_enable_plugins /etc/yum.conf
		modify_varible_value_of_file_cb /etc/yum.conf plugins 1
	fi
}

function backup_yum_repos_d_files() {
	local backup_dir=/etc/yum.repos.d/repos.old.$(date +%Y%m%d%H%M%S)
	${SUDO} mkdir -p ${backup_dir}
	if [ "x$?" != "x0" ] ;then
		return
	fi
	# pushd /etc/yum.repos.d
	for file in $(ls /etc/yum.repos.d/ | sed -n '/repo$/p') ;
	do
		if [ -f "/etc/yum.repos.d/${file}" ] ;then
			${SUDO} cp /etc/yum.repos.d/${file} ${backup_dir}
		fi
	done
	# popd
}

function create_local_repo_DVD() {
	if [ -f CentOS-6.6-x86_64-bin-DVD1.iso ] ;then
		${SUDO} mkdir /media/_local_repo_DVD1
		${SUDO} mount -o loop -t iso9660 CentOS-6.6-x86_64-bin-DVD1.iso /media/_local_repo_DVD1
	fi
	if [ -f CentOS-6.6-x86_64-bin-DVD2.iso ] ;then
		${SUDO} mkdir /media/_local_repo_DVD2
		${SUDO} mount -o loop -t iso9660 CentOS-6.6-x86_64-bin-DVD2.iso /media/_local_repo_DVD2
	fi
	local tmp_file=$(mktemp)
	${SUDO} cat > ${tmp_file} << EOF
[_local_repo_DVD]
name=CentOS-\$releasever - Media
baseurl=file:/var/lib/yum/plugins/local
		file:///media/CentOS/
		file:///mnt/cdrom/
		file:///media/cdrecorder/
		file:///media/_local_repo_DVD1
		file:///media/_local_repo_DVD2
enabled=0
priority=9
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
EOF
	${SUDO} mv ${tmp_file} /etc/yum.repos.d/_local_repo_DVD.repo
}

function create_maintain_script() {
	return #no need to create the script
	local tmp_file=$(mktemp)
	${SUDO} cat > ${tmp_file} << EOF
#! /bin/bash
read -p "backup or restore <bk/rs>? " select
if [[ "x\${select}" == "xbk" ]] ;then
	for file in \$(ls /etc/yum.repos.d/ | sed -n '/repo$/p')
	do
		sudo mv \${file} \${file}.backup
	done
elif [[ "x\${select}" == "xrs" ]] ;then
	for file in \$(ls /etc/yum.repos.d/ | sed -n '/backup$/p')
	do
		sudo mv \${file} \${file%.backup*}
	done
else
	echo "Invalid option "
fi
EOF
	${SUDO} mv ${tmp_file} /etc/yum.repos.d/_backup_restore.sh
}

# add adobe repo
function yum_add_adobe_repo() {
	if [ "x${PLAT_ARCH}" == "xx86_64" ] ;then
		#64bit#
		${SUDO} rpm -ivh http://linuxdownload.adobe.com/linux/x86_64/adobe-release-x86_64-1.0-1.noarch.rpm
	else
		#32bit#
		${SUDO} rpm -ivh http://linuxdownload.adobe.com/linux/i386/adobe-release-i386-1.0-1.noarch.rpm
	fi
	${SUDO} rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
	# set adobe-linux-x86_64.repo priority=10
	local repo_file=/etc/yum.repos.d/adobe-linux-${PLAT_ARCH}.repo
	modify_varible_value_of_file_cb ${repo_file} priority 10
	${SUDO} yum install flash-plugin
}

# add atomic repo
function yum_add_atomic_repo() {
	${SUDO} wget http://www.atomicorp.com/installers/atomic  #download
	${SUDO} chmod a+x ./atomic
	yes " " | sudo sh ./atomic   #install
	${SUDO} rm -f ./atomic
}

# add epel repo
function yum_add_epel_repo() {
#	if [ "${PLAT_ARCH}" == "xx86_64" ] ;then
#		#64bit:#
#		${SUDO} rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
#	else
#		#32bit#
#		${SUDO} rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
#	fi
	${SUDO} yum install epel-release
	${SUDO} rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
}

# add rpmforge repo
function yum_add_rpmforge_repo() {
	# download from http://pkgs.repoforge.org/rpmforge-release/
	if [ "x${PLAT_ARCH}" == "xx86_64" ] ;then
		#64bit#
		${SUDO} wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
	else
		#32bit#
		${SUDO} wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
	fi
	${SUDO} rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
	${SUDO} rpm -ivh rpmforge-release-0.5.3-1.el6.rf.*.rpm
	${SUDO} rm -f rpmforge-release-0.5.3-1.el6.rf*.rpm
}

# add rpmfusion repo which includes many multimedia libs
function yum_add_rpmfusion_repo() {
	if [ "x${PLAT_ARCH}" == "xx86_64" ] ;then
		#64bit
		${SUDO} rpm -ivh http://download1.rpmfusion.org/free/el/updates/6/x86_64/rpmfusion-free-release-6-1.noarch.rpm
		${SUDO} rpm -ivh http://download1.rpmfusion.org/nonfree/el/updates/6/x86_64/rpmfusion-nonfree-release-6-1.noarch.rpm
	else
		#32bit
		${SUDO} rpm -ivh http://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-free-release-6-1.noarch.rpm
		${SUDO} rpm -ivh http://download1.rpmfusion.org/nonfree/el/updates/6/i386/rpmfusion-nonfree-release-6-1.noarch.rpm
	fi
}

function yum_add_nux_dextop_repo() {
	if [ "x${PLAT_ARCH}" == "xx86_64" ] ;then
		#64bit
		${SUDO} rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm
	else
		#32bit
		${SUDO} rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/i386/nux-dextop-release-0-2.el6.nux.noarch.rpm
	fi
	# ${SUDO} rm -f nux-dextop-release*.rpm
	modify_varible_value_of_file_cb nux-dextop.repo enable 1
}

function setup_yum_repos_priority() {
	# pushd /etc/yum.repos.d/
	REPO_FILE_LIST=" CentOS-Base.repo atomic.repo epel.repo epel-testing.repo nux-dextop.repo rpmforge.repo rpmfusion-free-updates.repo "
	repo_priority_num=1
	for file in ${REPO_FILE_LIST}
	do
		file=/etc/yum.repos.d/${file}
		if [ -f "${file}" ] ;then
			echo "updating ${file} ..."
			modify_varible_value_of_file_cb ${file} priority XXX
		else
			continue
		fi
		for ((i=0; i<5; i++)) ;
		do
			let prn=${repo_priority_num}+${i}
			# echo ${repo_priority_num} ${prn}
			${SUDO} sed "1, /^priority=XXX/ {/^priority=XXX/ s/priority=.*$/priority=${prn}/}" -i ${file}
		done
		let repo_priority_num+=5
	done
	# popd
}

function rebuild_yum_cache() {
	${SUDO} yum clean all
	${SUDO} yum makecache
}

function install_and_setup_yum_plugins() {
	yum_plugins_installation
	# yum_axel_plugin_install
}

function enable_and_backup_repos() {
	check_yum_conf_enable_plugins
	backup_yum_repos_d_files
}

function add_extra_repos() {
	create_local_repo_DVD
	# create_maintain_script
	yum_add_adobe_repo
	# yum_add_atomic_repo
	yum_add_epel_repo
	yum_add_nux_dextop_repo
	yum_add_rpmforge_repo
	yum_add_rpmfusion_repo
	yum_axel_plugin_install
}

function setup_priority_and_rebuild_cache() {
	setup_yum_repos_priority
	rebuild_yum_cache
}

check_yum_install_env
install_and_setup_yum_plugins
enable_and_backup_repos
add_extra_repos
setup_priority_and_rebuild_cache



///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
=========================================================================
YUM錯誤conflicts with file from package的解決辦法

YUM一堆錯誤,是64位的包和32位的包衝突.
YUM錯誤conflicts with file from package的解決辦法,先解除安裝有衝突的軟體包,如下是 yum -y remove subversion 然後再重新YUM就OK了.
--------------------------------------------------------------------------
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test

Transaction Check Error:
  file /usr/share/emacs/site-lisp/psvn.el from install of subversion-1.4.6-jason.1.i386 conflicts with file from package subversion-1.4.2-4.el5_3.1.x86_64
  file /usr/share/locale/es/LC_MESSAGES/subversion.mo from install of subversion-1.4.6-jason.1.i386 conflicts with file from package subversion-1.4.2-4.el5_3.1.x86_64
  file /usr/share/locale/it/LC_MESSAGES/subversion.mo from install of subversion-1.4.6-jason.1.i386 conflicts with file from package subversion-1.4.2-4.el5_3.1.x86_64
  file /usr/share/locale/ja/LC_MESSAGES/subversion.mo from install of subversion-1.4.6-jason.1.i386 conflicts with file from package subversion-1.4.2-4.el5_3.1.x86_64
  file /usr/share/locale/ko/LC_MESSAGES/subversion.mo from install of subversion-1.4.6-jason.1.i386 conflicts with file from package subversion-1.4.2-4.el5_3.1.x86_64
  file /usr/share/locale/nb/LC_MESSAGES/subversion.mo from install of subversion-1.4.6-jason.1.i386 conflicts with file from package subversion-1.4.2-4.el5_3.1.x86_64
  file /usr/share/locale/zh_CN/LC_MESSAGES/subversion.mo from install of subversion-1.4.6-jason.1.i386 conflicts with file from package subversion-1.4.2-4.el5_3.1.x86_64
  file /usr/share/xemacs/site-packages/lisp/psvn.el from install of subversion-1.4.6-jason.1.i386 conflicts with file from package subversion-1.4.2-4.el5_3.1.x86_64

Error Summary
-------------
-------------------------------------------------------------------------
正當高興的時候,發現yum安裝webmin的時候還是有錯誤:
-------------------------------------------------------------------------
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
FATAL - 2010-11-28 15:51:02 - Fatal Error Occurred: Something went wrong during installation: 0
FATAL - 2010-11-28 15:51:03 - Cannot continue installation.
FATAL - 2010-11-28 15:51:03 - Attempting to remove virtualmin repository configuration,so the installation can be
FATAL - 2010-11-28 15:51:03 - re-attempted after any problems have been resolved.
FATAL - 2010-11-28 15:51:03 - Removing temporary directory and files.
FATAL - 2010-11-28 15:51:03 - If you are unsure of what went wrong,you may wish to review the log
FATAL - 2010-11-28 15:51:03 - in /root/virtualmin-install.log
------------------------------------------------------------------------
看日誌發現,yum更新的時候有重複的32位和64位的包:

Dependencies Resolved
================================================================================
 Package            Arch       Version                 Repository          Size
================================================================================
Installing:
 dovecot            x86_64     1.0.7-7.el5             base               1.7 M
 httpd              i386       2.2.16-jason.1          utterramblings     3.0 M
 httpd              x86_64     1:2.2.3-43.3.vm         virtualmin         1.2 M
 mailman            x86_64     3:2.1.9-4.el5           base               9.8 M
 mod_dav_svn        x86_64     1.4.2-4.el5_3.1         base                70 k
 mod_dav_svn        i386       1.4.6-jason.1           utterramblings     201 k
 mod_perl           x86_64     2.0.4-6.el5             base               4.0 M
 mod_perl           i386       2.0.4-7.jason.2         utterramblings     5.4 M

系統是64位的,所以很明顯utterramblings  的yum源32位是有問題的. 我們需要刪除這個utterramblings源.

# cd /etc/yum.repos.d/
# mv utterrambling.repo utterrambling.repo.del

然後我們yum重新安裝virtualmin,終於一切正常了

yum-3.2.29-40.el6.centos.noarch.rpm
yum-metadata-parser-1.1.2-16.el6.i686.rpm
yum-plugin-aliases-1.1.30-14.el6.noarch.rpm
yum-plugin-changelog-1.1.30-14.el6.noarch.rpm
yum-plugin-downloadonly-1.1.30-14.el6.noarch.rpm
yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
yum-plugin-security-1.1.30-14.el6.noarch.rpm
yum-plugin-tmprepo-1.1.30-14.el6.noarch.rpm
yum-plugin-verify-1.1.30-14.el6.noarch.rpm
yum-plugin-versionlock-1.1.30-14.el6.noarch.rpm
yum-presto-0.6.2-1.el6.noarch.rpm
yum-utils-1.1.30-14.el6.noarch.rpm


相關推薦

CentOS 6.6 yum完全配置

本文來自Q群52240781 一  yum 簡介     yum,是"Yellow dog Updater,Modified"的簡稱,是杜克大學為了提高RPM軟體包安裝性而開發的一種軟體包管理器. 起初是由yellow dog這一發行版的開發者Terra Soft研發,用

rhel 6.5 yum配置

    yum 是 yellowdog updater modified 簡稱,說白了就是升級版的rpm, yum的出現主要是由於rpm的那煩人的依賴關係所致, yum能夠自動解決軟體包之間的各種依賴關係(線性依賴, 環形依賴)     yum大致的原理: 當用戶使用yum

Linux yum完全配置

install 計算 args channel 發行版 lemp x86 atomic pac 一、簡介 yum主要功能是更方便的添加/刪除/更新RPM包,自動解決包的依賴性問題,便於管理大量系統的更新問題,其理念是使用一個中心倉庫(repository)管理一部分甚至一

阿里雲centos 6yum配置

#首先備份原來的cent os官方yum源 cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak #獲取阿里的yum源覆蓋本地官方yum源 wget -O /etc/yum.repos.d/Cent

CentOS 6.5下本地yum與網路yum配置使用

一、本地yum源 系統預設已經安裝了可使用yum的軟體包,所以可以直接配置: [[email protected] ~]# cd /etc/yum.repos.d/                        yum源配置檔案放置目錄 [[email&

超詳細的 Linux CentOS yum 配置與使用【轉發+新增】

例如 download sof eas 1.2 rect addons 類型 2個 一、yum 簡介   yum,是Yellow dog Updater, Modified 的簡稱,是杜克大學為了提高RPM 軟件包安裝性而開發的一種軟件包管理器。起初是由yellow dog

CentOS 5.7 yum配置

centos 5.7算是比較老的了,163和阿里都已不支援了,centos官網還是可以用的,具體配置如下: [[email protected] /]# cd /etc/yum.repos.d [[email protected] yum.repos.d

CentOS yum 配置與使用

一、yum 簡介   yum,是Yellow dog Updater, Modified 的簡稱,是杜克大學為了提高RPM 軟體包安裝性而開發的一種軟體包管理器。起初是由yellow dog 這一發行版的開發者Terra Soft 研發,用python 寫成,那時還叫做

Red Hat 7.3 配置使用CentOS 7.3 Yum

redhat 的更新包只對註冊的使用者生效,所以我們自己手動更改成CentOS 的更新包,CentOS幾乎和redhat是一樣的,所以無需擔心軟體包是否可安裝,安裝之後是否有問題,另外CentOS公司去年已經被Redhat 收購了,不說費話了,我們還是來操作吧!

CentOS安裝第三方yumEPEL

linux epel源安裝一、簡介EPEL是企業版 Linux 附加軟件包的簡稱,EPEL是一個由Fedora特別興趣小組創建、維護並管理的,針對 紅帽企業版 Linux(RHEL)及其衍生發行版(比如 CentOS、Scientific Linux、Oracle Enterprise Linux)的一個高質

RHEL7(RedHat 7)本地yum配置

創建文件 測試 配置 檢查 .cn 本地yum源 mon 識別 保存 配置yum 源 1、掛載DVD光盤到/mnt 因為配置時候路徑名裏面不能有空格,否則不能識別 [root@ mnt]# mount /dev/cdrom /mnt 2、在目錄/etc/yum

RedHat 網絡yum配置

oar 鏡像 備份 wget ever 3.2 yum源 卸載 ges 在安裝heartbeat的時候提示不能找到依賴的包,最後發現是yum源的問題。在網上查了很多資料,終於成功配置了yum網絡源,下面分享一下解決的辦法。 解決辦法: 1.卸載EHEL的yum,並下載Cen

redhat7.4修改yum CentOS網易yum

yum centos# 創建目錄 mkdir /data/tools/centos_yumcd /data/tools/centos_yum# 下載軟件包,若地址不對,到此網站上找http://mirrors.163.com/centos/7/os/x86_64/Packages/wget http://mi

修改CentOS默認yum為國內鏡像

detail ack 緩存 ref pda 默認 文檔 extras tails 參考文檔 https://blog.csdn.net/inslow/article/details/54177191 國內主要開源的開源鏡像站點應該是網易和阿裏雲了。 修改為163yum源

Centos搭建本地yum

yum一.準備工作新建一臺VM或者一個PC,安裝linux系統(本人用的是Centos 7.3) 確保機器可以連上Internet. 二.開始安裝1.安裝本地httpd服務yum install httpd2.打開http服務service httpd startservice httpd status

rhel7配置網絡yum配置VNC遠程桌面

17. pro 文件 load text 一個 就是 pos pass rhel7配置VNC遠程桌面實驗環境:安裝了圖形化界面的redhat7.0,IP是192.168.31.201先配置網絡yum源[root@admin201 ~]# wget -O /etc/yum.r

CentOS 7 換yum

com 下載 列表 .so -i 清除 bsp get 阿裏yum源 備份原來的源 sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bk 下載阿裏源 $ cd /e

20181201安裝vm-tools+yum配置

安裝vm-tools+yum源的配置 一.安裝 vm-tools一路回車!!!安裝完成之後,reboot 重啟即可 二.修改主機名(hostname)hostname duoer臨時修改vim /etc/sysconfig/network 永久修改1 NETWORKING=yes2 HOSTNAME=do

CentOS 7更新YUM步驟

國內小夥伴推薦使用阿里雲的源,阿里大法好!真善忍好!可惜馬雲爸爸要退休了 (⊙︿⊙) Step1 找到需要的源 Step2 編輯CentOS7.repo檔案 進入/etc/yum.repos.d,發現我的源還是7.4.1708 [base] name=CentO

LINUX 本地yum 安裝配置

1.插入iso映象 2.掛載到本地指定路徑 mkdir -p /mnt/cdrom mount /dev/cdrom /mnt/cdrom 3.修改預設配置 cd /etc/yum.repos.d/ rename .repo .repo.bak * mv C