Linux 配置YUM


標簽: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

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

《歡迎交流討論》

 

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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM