CentOS使用Yum升級Git到2.1x新版本

使用yum最多隻能安裝到1.8,版本太舊了,下載源碼手動編譯安裝?先不說國內下載官網包2kB/s的速度,就是下載下來了編譯也麻煩啊,包管理是吃乾飯的嘛?

其實只要換個源,重新下載就好了

先卸載舊版

yum remove git

添加新源後安裝新版

yum install -y https://centos7.iuscommunity.org/ius-release.rpm
yum install -y git2u

檢驗

git version    

最後附帶我的安裝過程

root@izwz957qhjacaocedubzjjz /tmp/installGit   [20:43:53] 
> # yum install -y https://centos7.iuscommunity.org/ius-release.rpm
已加載插件:fastestmirror
ius-release.rpm                    | 8.2 kB     00:00     
正在檢查 /var/tmp/yum-root-6VAioA/ius-release.rpm: ius-release-2-1.el7.ius.noarch
/var/tmp/yum-root-6VAioA/ius-release.rpm 將被安裝
正在解決依賴關係
--> 正在檢查事務
---> 軟件包 ius-release.noarch.0.2-1.el7.ius 將被 安裝
--> 正在處理依賴關係 epel-release = 7,它被軟件包 ius-release-2-1.el7.ius.noarch 需要
Loading mirror speeds from cached hostfile
--> 正在檢查事務
---> 軟件包 epel-release.noarch.0.7-12 將被 安裝
--> 解決依賴關係完成

依賴關係解決

==========================================================
 Package       架構    版本           源             大小
==========================================================
正在安裝:
 ius-release   noarch  2-1.el7.ius    /ius-release  4.5 k
爲依賴而安裝:
 epel-release  noarch  7-12           epel           15 k

事務概要
==========================================================
安裝  1 軟件包 (+1 依賴軟件包)

總計:19 k
總下載量:15 k
安裝大小:29 k
Downloading packages:
epel-release-7-12.noarch.rpm         |  15 kB   00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安裝    : epel-release-7-12.noarch              1/2 
警告:/etc/yum.repos.d/epel.repo 已建立爲 /etc/yum.repos.d/epel.repo.rpmnew 
  正在安裝    : ius-release-2-1.el7.ius.noarch        2/2 
  驗證中      : ius-release-2-1.el7.ius.noarch        1/2 
  驗證中      : epel-release-7-12.noarch              2/2 

已安裝:
  ius-release.noarch 0:2-1.el7.ius                        

作爲依賴被安裝:
  epel-release.noarch 0:7-12                              

完畢!
                                                          
root@izwz957qhjacaocedubzjjz /tmp/installGit   [20:44:05] 
> # yum install -y git2u                                 
已加載插件:fastestmirror
ius                                | 1.3 kB     00:00     
ius/x86_64/primary                   | 129 kB   00:01     
Loading mirror speeds from cached hostfile
ius                                               538/538
正在解決依賴關係
--> 正在檢查事務
---> 軟件包 git2u.x86_64.0.2.16.5-1.ius.el7 將被 安裝
--> 正在處理依賴關係 git2u-perl-Git = 2.16.5-1.ius.el7,它被軟件包 git2u-2.16.5-1.ius.el7.x86_64 需要
--> 正在處理依賴關係 git2u-core-doc = 2.16.5-1.ius.el7,它被軟件包 git2u-2.16.5-1.ius.el7.x86_64 需要
--> 正在處理依賴關係 git2u-core = 2.16.5-1.ius.el7,它被軟件包 git2u-2.16.5-1.ius.el7.x86_64 需要
--> 正在處理依賴關係 perl(Git::I18N),它被軟件包 git2u-2.16.5-1.ius.el7.x86_64 需要
--> 正在處理依賴關係 perl(Git),它被軟件包 git2u-2.16.5-1.ius.el7.x86_64 需要
--> 正在處理依賴關係 libsecret-1.so.0()(64bit),它被軟件包 git2u-2.16.5-1.ius.el7.x86_64 需要
--> 正在檢查事務
---> 軟件包 git2u-core.x86_64.0.2.16.5-1.ius.el7 將被 安裝
---> 軟件包 git2u-core-doc.noarch.0.2.16.5-1.ius.el7 將被 安裝
---> 軟件包 git2u-perl-Git.noarch.0.2.16.5-1.ius.el7 將被 安裝
---> 軟件包 libsecret.x86_64.0.0.18.6-1.el7 將被 安裝
--> 解決依賴關係完成

依賴關係解決

==========================================================
 Package         架構    版本                 源     大小
==========================================================
正在安裝:
 git2u           x86_64  2.16.5-1.ius.el7     ius   1.1 M
爲依賴而安裝:
 git2u-core      x86_64  2.16.5-1.ius.el7     ius   5.5 M
 git2u-core-doc  noarch  2.16.5-1.ius.el7     ius   2.4 M
 git2u-perl-Git  noarch  2.16.5-1.ius.el7     ius    68 k
 libsecret       x86_64  0.18.6-1.el7         base  153 k

事務概要
==========================================================
安裝  1 軟件包 (+4 依賴軟件包)

總下載量:9.2 M
安裝大小:42 M
Downloading packages:
警告:/var/cache/yum/x86_64/7/ius/packages/git2u-2.16.5-1.ius.el7.x86_64.rpm: 頭V4 RSA/SHA256 Signature, 密鑰 ID 4b274df2: NOKEY
git2u-2.16.5-1.ius.el7.x86_64.rpm 的公鑰尚未安裝
(1/5): git2u-2.16.5-1.ius.el7.x86_64 | 1.1 MB   00:02     
(2/5): git2u-core-doc-2.16.5-1.ius.e | 2.4 MB   00:00     
(3/5): git2u-core-2.16.5-1.ius.el7.x | 5.5 MB   00:03     
(4/5): libsecret-0.18.6-1.el7.x86_64 | 153 kB   00:00     
(5/5): git2u-perl-Git-2.16.5-1.ius.e |  68 kB   00:00     
----------------------------------------------------------
總計                         2.6 MB/s | 9.2 MB  00:03     
從 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-IUS-7 檢索密鑰
導入 GPG key 0x4B274DF2:
 用戶ID     : "IUS (7) <[email protected]>"
 指紋       : c958 7a09 a11f d706 4f0c a0f4 e558 0725 4b27 4df2
 軟件包     : ius-release-2-1.el7.ius.noarch (installed)
 來自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-IUS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安裝    : git2u-core-2.16.5-1.ius.el7.x86_64    1/5 
  正在安裝    : git2u-core-doc-2.16.5-1.ius.el7.noa   2/5 
  正在安裝    : libsecret-0.18.6-1.el7.x86_64         3/5 
  正在安裝    : git2u-perl-Git-2.16.5-1.ius.el7.noa   4/5 
  正在安裝    : git2u-2.16.5-1.ius.el7.x86_64         5/5 
  驗證中      : git2u-2.16.5-1.ius.el7.x86_64         1/5 
  驗證中      : git2u-core-doc-2.16.5-1.ius.el7.noa   2/5 
  驗證中      : git2u-core-2.16.5-1.ius.el7.x86_64    3/5 
  驗證中      : git2u-perl-Git-2.16.5-1.ius.el7.noa   4/5 
  驗證中      : libsecret-0.18.6-1.el7.x86_64         5/5 

已安裝:
  git2u.x86_64 0:2.16.5-1.ius.el7                         

作爲依賴被安裝:
  git2u-core.x86_64 0:2.16.5-1.ius.el7                    
  git2u-core-doc.noarch 0:2.16.5-1.ius.el7                
  git2u-perl-Git.noarch 0:2.16.5-1.ius.el7                
  libsecret.x86_64 0:0.18.6-1.el7                         

完畢!
                                                          
root@izwz957qhjacaocedubzjjz /tmp/installGit   [20:44:22] 
> # git version                                       

git version 2.16.5
感謝https://www.cnblogs.com/jhxxb/p/10571227.html
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章