CentOS6.6源码安装git-2.3.0

分类:CentOS教程 阅读:80433 次

(1) 添加rpmforge源

wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm

sudo rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt

sudo rpm -i rpmforge-release-0.5.3-1.el6.rf.i686.rpm

(2) 安装依赖的包

sudo yum update

sudoyum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gccperl-ExtUtils-MakeMaker

(3) 下载git源码并解压缩

wget https://www.kernel.org/pub/software/scm/git/git-2.3.0.tar.gz

tar -zxvf git-2.3.0.tar.gz

cd git-2.3.0

(4) 编译安装

make prefix=/usr/local/git all

sudo make prefix=/usr/local/git install

(5) 将git安装路径添加到PATH变量

sudo vim /etc/bashrc

在最后一行添加 export PATH=/usr/local/git/bin:$PATH 保存退出

(6) 验证是否安装成功

source /etc/bashrc

git --version

(7) 配置git

git config --global user.name "username"

git config --global user.email "user@mail.com"