> CentOS > CentOS教程 >

CentOS6.x 源码编译安装Git

CentOS自带的Git版本比较老,经常不能满足功能需要。

最新的版本只能源码安装。记录下, 以免忘记:


0) 安装epel源

32位系统选择:
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

64位系统选择:
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

导入key:
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5

别忘了安装
yum install yum-priorities

1) 安装依赖

 

 
  1. sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel  
  2. sudo yum install openssl-devel gettext asciidoc xmlto docbook2x  
  3.   
  4. ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi  

 

 

2) 源码编译安装git

 

 
  1. git clone https://github.com/git/git  
  2. cd git  
  3. make configure  
  4. ./configure --prefix=/usr (或者./configure --prefix=/usr --with-curl --with-expat)  
  5. make all doc  
  6. make install install-doc install-html  


(责任编辑:IT)