CentOS6.5下源码安装git2.3
最近在折腾CentOS,感觉并不比 ubuntu来的顺利,时不时就报个错,yum安装git后clone代码又有提示,百度了才知道版本不对(v1.7.1),于是尝试用新版的git源码安装
最近在折腾CentOS,感觉并不比 ubuntu来的顺利,时不时就报个错,yum安装git后clone代码又有提示,百度了才知道版本不对(v1.7.1),于是尝试用新版的git源码安装:
(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 sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-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"
在git编译的过程中可能会报错: Can't locate ExtUtils/MakeMaker.pm ,可以这么做:
yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
运行后重新make,后面就正常了。
很赞哦! ( 0
)