Linux yum源詳解

軟件包安裝方式


    0.默認從官網下載包(國內,雅虎,網易,阿里雲)
        cat /etc/yum.repos.d/rhel-source.repo  【yum文件目錄--redhat6版】html

【搜狐】http://mirrors.sohu.com/help/CentOS-Base-sohu.repo
【網易】http://mirrors.163.com/.help/CentOS6-Base-163.repo
【阿里】https://mirrors.aliyun.com/help/centos   

   1.yum :  Linux包管理器 ,解決依賴問題,方便快捷shell

        yum install XXX -y 
        yum groupinstall XXX 包組的列表  -y
        yum grouplist 裏面選擇包組,而後yum groupinstall "包組" -y
        yum search  包名
        yum search all  查詢全部
        yum remove tree -y  刪除命令(不建議用,由於yum能夠解決依賴問題,刪除會刪除全部包的依賴)
        yum update; 安裝全部軟件到最新版本

   2. rpm安裝:centos

        rpm -ivh 包名  i==install h==human 人可讀
        rpm -ivh 包名 安裝軟件
        rpm -qa  包名 查詢包名
        最大的問題:就是安裝包的依賴問題(a->b->c->d)


     3.源碼安裝: less

 /configure; make; make install  源代碼安裝方式

在線安裝配置yum源

# 查看操做系統版本
cat /etc/redhat-release
# 查看操做系統32/64位
uname -m
# 進入yum文件目錄
cd /etc/yum.repos.d
# 備份源文件
cp CentOS-Base.repo CentOS-Base.repo.bak 
# 下載網易yum源
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo 【網易】
#【可選】下載阿里yum源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo  【阿里】
# 更改權限和屬組
chmod 644 CentOS6-Base-163.repo
chown root.root CentOS6-Base-163.repo
附[可選]:若是仍是用不了yum,能夠替換文件內的版本信息爲你當前操做系統的版本,通常沒問題的
# 替換文件的版本信息
sed -i 's/$releasever/6/g' CentOS6-Base-163.repo  

 

配置yum安裝保存安裝包

# 更改配置文件
sed -i 's#keepcache=0#keepcache=1#g' /etc/yum.conf 
# 進入路徑下查看安裝包
cd /var/cache/yum/*/6/base/packages/
# 查看更改後的文件信息

grep 'keep' /etc/yum.conf


附網易yum源:ide

 1 # CentOS-Base.repo
 2 #
 3 # The mirror system uses the connecting IP address of the client and the
 4 # update status of each mirror to pick mirrors that are updated to and
 5 # geographically close to the client.  You should use this for CentOS updates
 6 # unless you are manually picking other mirrors.
 7 #
 8 # If the mirrorlist= does not work for you, as a fall back you can try the 
 9 # remarked out baseurl= line instead.
10 #
11 #
12 
13 [base]
14 name=CentOS-$releasever - Base - 163.com
15 baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
16 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
17 gpgcheck=1
18 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
19 
20 #released updates 
21 [updates]
22 name=CentOS-$releasever - Updates - 163.com
23 baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
24 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
25 gpgcheck=1
26 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
27 
28 #additional packages that may be useful
29 [extras]
30 name=CentOS-$releasever - Extras - 163.com
31 baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
32 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
33 gpgcheck=1
34 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
35 
36 #additional packages that extend functionality of existing packages
37 [centosplus]
38 name=CentOS-$releasever - Plus - 163.com
39 baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
40 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
41 gpgcheck=1
42 enabled=0
43 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
44 
45 #contrib - packages by Centos Users
46 [contrib]
47 name=CentOS-$releasever - Contrib - 163.com
48 baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/
49 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
50 gpgcheck=1
51 enabled=0
52 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
View Code

附阿里配置文件this

 1 # CentOS-Base.repo
 2 #
 3 # The mirror system uses the connecting IP address of the client and the
 4 # update status of each mirror to pick mirrors that are updated to and
 5 # geographically close to the client.  You should use this for CentOS updates
 6 # unless you are manually picking other mirrors.
 7 #
 8 # If the mirrorlist= does not work for you, as a fall back you can try the 
 9 # remarked out baseurl= line instead.
10 #
11 #
12  
13 [base]
14 name=CentOS-$releasever - Base - mirrors.aliyun.com
15 failovermethod=priority
16 baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
17         http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
18 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
19 gpgcheck=1
20 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
21  
22 #released updates 
23 [updates]
24 name=CentOS-$releasever - Updates - mirrors.aliyun.com
25 failovermethod=priority
26 baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
27         http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
28 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
29 gpgcheck=1
30 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
31  
32 #additional packages that may be useful
33 [extras]
34 name=CentOS-$releasever - Extras - mirrors.aliyun.com
35 failovermethod=priority
36 baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
37         http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
38 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
39 gpgcheck=1
40 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
41  
42 #additional packages that extend functionality of existing packages
43 [centosplus]
44 name=CentOS-$releasever - Plus - mirrors.aliyun.com
45 failovermethod=priority
46 baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
47         http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
48 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
49 gpgcheck=1
50 enabled=0
51 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
52  
53 #contrib - packages by Centos Users
54 [contrib]
55 name=CentOS-$releasever - Contrib - mirrors.aliyun.com
56 failovermethod=priority
57 baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
58         http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
59 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
60 gpgcheck=1
61 enabled=0
62 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
View Code
相關文章
相關標籤/搜索