centos 6.5 安装git
环境准备
# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
# yum install gcc perl-ExtUtils-MakeMaker
下载源码包并解压安装
#wget https://www.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz
#tar -zxvf git-2.9.5.tar.gz
#cd git-2.9.5
# make configure
# ./configure --prefix=/usr/local --with-iconv=/usr/local/libiconv
# make
# make install
# sudo vim /etc/profile
在最后一行添加
exportPATH=/usr/local/git/bin:$PATH
保存后使其立即生效
# source /etc/profile
查看是否安装成功
#git --version
遇到问题
undefined reference to`libiconv_open'
undefined reference to`libiconv_close'
undefined reference to`libiconv_open'
解决问题步骤
一.安装libiconv
# cd/usr/local/src
# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
# tar -zxvf libiconv-1.14.tar.gz
# cd libiconv-1.14
# ./configure --prefix=/usr/local/libiconv && make && make install
二.创建一个软链接到/usr/lib
# ln -s /usr/local/lib/libiconv.so /usr/lib
# ln -s /usr/local/lib/libiconv.so.2 /usr/lib
三.回到git目录继续编译
# cd git-2.9.5
# make configure
# ./configure --prefix=/usr/local --with-iconv=/usr/local/libiconv
# make
# make install