Linux(centos7)安裝Git
阿新 • • 發佈:2017-12-27
git1、最新git源碼下載地址:
https://github.com/git/git/releases
https://www.kernel.org/pub/software/scm/git/
可以手動下載下來在上傳到服務器上面
2 移除舊版本git
centos自帶Git,7.x版本自帶git 1.8.3.1(應該是,也可能不是),
安裝新版本之前需要使用yum remove git卸載(安裝後卸載也可以)。
[root@Git ~]# git --version ## 查看自帶的版本git version 1.8.3.1[root@Git ~]# yum remove git ## 移除原來的版本
3 安裝所需軟件包
[root@Git ~]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel [root@Git ~]# yum install gcc-c++ perl-ExtUtils-MakeMaker
下載&安裝
[root@Git ~]# cd /usr/src[root@Git ~]# wget https://www.kernel.org/pub/software/scm/git/git-2.7.3.tar.gz
5 解壓
[root@Git ~]# tar xf git-2.7.3.tar.gz
6 配置編譯安裝
[root@Git ~]# cd git-2.7.3[root@Git ~]# make configure[root@Git ~]# ./configure --prefix=/usr/git ##配置目錄[root@Git ~]# make profix=/usr/git[root@Git ~]# make install
7 加入環境變量
[root@Git ~]# echo "export PATH=$PATH:/usr/git/bin" >> /etc/profile[root@Git ~]# source /etc/profile
8 檢查版本
[root@Git git-2.7.3]# git --version git version 2.7.3
Linux(centos7)安裝Git