美文网首页
centos7下搭建git及报错解决方案

centos7下搭建git及报错解决方案

作者: 枫叶鱼水 | 来源:发表于2017-12-21 18:05 被阅读0次

系统:centos7

安装依赖:

# yum -y install  curl-devel expat-devel gettext-devel openssl-devel zlib-develperl-devel

git安装

步骤2.卸载旧的git版本(如果之前有安装rpm包)

# yum remove git

步骤3.下载&解压

# cd /usr/src

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

# tar -zxvf git-2.15.0.tar.gz

或# wget https://github.com/git/git/archive/v2.15.0.tar.gz下载

GRANT ALL PRIVILEGES ON *.* TO 'git'@'%' IDENTIFIED BY 'Git@#14' WITH GRANT OPTION;

步骤4.编译安装

# cd git-2.15.0

#yum install perl-ExtUtils-MakeMaker package

#yum install perl-ExtUtils-MakeMaker package

# make prefix=/usr/local/git all

# make prefix=/usr/local/git install

# echo  "export PATH=$PATH:/usr/local/git/bin">> /etc/bashrc

# source /etc/bashrc

编译时出现如下异常:

libgit.a(utf8.o): Infunction`reencode_string_iconv‘:/root/git-2.9.0/utf8.c:463: undefined reference to `libiconv‘libgit.a(utf8.o): Infunction`reencode_string_len‘:/root/git-2.9.0/utf8.c:502: undefined reference to `libiconv_open‘/root/git-2.9.0/utf8.c:521: undefined reference to `libiconv_close‘/root/git-2.9.0/utf8.c:515: undefined reference to `libiconv_open‘collect2:ld返回1make: *** [git-credential-store] 错误1

下载并安装libiconv

# cd ..

# 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&&makeinstall

返回git在此编译安装

cd ../git-2.9.0makeclean

./configure --prefix=/usr/local --with-iconv=/usr/local/libiconv/makeinstall

查看安装是否正确及安装的版本:

# git --version

git version2.9.0

此时说明git已经安装成功

相关文章

网友评论

      本文标题:centos7下搭建git及报错解决方案

      本文链接:https://www.haomeiwen.com/subject/ojeawxtx.html