Linux 配置YUM

pursuer.chen發表於2015-11-07

標籤:MYSQL/linux

概述  

文章主要介紹配置163,mysql,epel這三個yum源。

目錄

步驟

安裝163源

注意:我這裡的163的源是32位CPU的,如果是64位的要下載x86_64

我當前的伺服器版本的redhat6,所以下載的安裝包也應該是對應linux6的安裝包,這裡配置的是163的yum源。

 

wget http://mirrors.163.com/centos/6/os/i386/Packages/yum-3.2.29-69.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpm
wget http://mirrors.163.com/centos/6/os/i386/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

解除安裝自帶的yum

rpm -aq|grep yum|xargs rpm -e --nodeps

安裝yum包

注意順序

rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm 

rpm -ivh yum-metadata-parser-1.1.2-16.el6.i686.rpm 

--注意後面兩個是一起安裝
rpm -ivh yum-3.2.29-69.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm 

 

新增yum

 切換路徑

cd /etc/yum.repos.d/

下載檔案

wget  http://mirrors.163.com/.help/CentOS6-Base-163.repo

編輯檔案

vim CentOS6-Base-163.repo

內容如下

# 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-6 - Base - 163.com
baseurl=http://mirrors.163.com/centos/6/os/i386/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#released updates 
[updates]
name=CentOS-6 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6/updates/i386/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-6 - Extras - 163.com
baseurl=http://mirrors.163.com/centos/6/extras/i386/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/6/centosplus/i386/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-6 - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/6/contrib/i386/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
匯入key
rpm --import http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
 
清理yum快取
yum clean all

測試是否安裝成功

yum install perl-DBI

 

64位

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-69.el6.centos.noarch.rpm

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm

wget  http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
# 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-6 - Base - 163.com
baseurl=http://mirrors.163.com/centos/6/os/x86_64/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#released updates 
[updates]
name=CentOS-6 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6/updates/x86_64/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-6 - Extras - 163.com
baseurl=http://mirrors.163.com/centos/6/extras/x86_64/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/6/centosplus/x86_64/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-6 - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/6/contrib/x86_64/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

 

 

新增mysqlYUM

下載yum包

wget http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm

安裝yum包

rpm -ivh mysql-community-release-el6-5.noarch.rpm

檢視yum原始檔

cd /etc/yum.repos.d/

 

安裝epel源

下載epel安裝檔案

wget http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm

32位:http://mirrors.ustc.edu.cn/fedora/epel/6/i386/epel-release-6-6.noarch.rpm

64位:http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm

安裝

rpm -ivh epel-release-6-8.noarch.rpm 

檢視是否安裝成功

rpm -q epel-release

匯入KEY

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

 

安裝yum-priorities

查詢是否安裝了

rpm -q yum-plugin-priorities

安裝

yum istall yum-priorities

yum源優先順序的一個檔案。
是yum-plugin-priroites這個外掛的一個檔案。
用來給yum源分優先順序的。
比如你在centos下有centos,epel,rpmfusion三個yum源。
三個yum源中可能含有相同的軟體,補丁之類的東西。
yum管理器為了分辨更新系統或者安裝軟體的時候用那個yum源的軟體所以才有這麼個東西。
如果說,設定centos官方的yum源優先順序最高,epelyum源第二,rpmfusion第三。(用1到99來表示,1最高)
那在安裝程式的時候,先尋找centos的yum源,如果源裡面有要的程式,那就停止尋找,直接安裝找到的,如果沒有找到,就依次尋找epel和rpmfusion的源。
如果說三個yum源都含有同一個軟體,那就安裝優先順序最高的yum源的。

總結

 epel源裡面的軟體是最全的,所以我一般將epel源設為優先源。

 

 文章如果對大家有幫助,請幫忙推薦,謝謝!!!

 

備註:

    作者:pursuer.chen

    部落格:http://www.cnblogs.com/chenmh

本站點所有隨筆都是原創,歡迎大家轉載;但轉載時必須註明文章來源,且在文章開頭明顯處給明連結,否則保留追究責任的權利。

《歡迎交流討論》

 

---恢復內容結束---

相關文章