html5lib 安装命令,centos编译安装 Git

centos安装Git有两种方式,一种通过源安装,通过如下命今,即可一键安装成功:

yum -y install git

但是通过源安装的Git,目前最高版本是1.7,想要使用更多新功能、更新版本的Git,就只能通过编译安装的方式来进行安装了,下面就来具体介绍这种安装过程。

1、先安装依赖包

yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel

2、下载Git源码包,并解压

cd /usr/local/src

wget https://github.com/git/git/archive/v1.9.5.tar.gz

tar -zxvf git-1.9.5.tar.gz

3、编译并安装

cd git-1.9.5

make configure

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

make && make install

安装过程中,可能会出现如下错误:

LINK git-credential-store

libgit.a(utf8.o): In function `reencode_string_iconv':

/opt/git-master/utf8.c:530: undefined reference to `libiconv'

libgit.a(utf8.o): In function `reencode_string_len':

/opt/git-master/utf8.c:569: undefined reference to `libiconv_open'

/opt/git-master/utf8.c:588: undefined reference to `libiconv_close'

/opt/git-master/utf8.c:582: undefined reference to `libiconv_open'

collect2: ld 返回 1

make: *** [git-credential-store] 错误 1

分析问题原因是找不到libiconv扩展包,包装libiconv包即可解决:

cd /usr/local/src

#请勿下载更新版的libiconv包,1.14版本已经够用,

#否则在运行Git时,会出现“/usr/local/bin/git: undefined symbol: locale_charset ”的错误

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

libiconv安装成功后,再切回到git目录下面:

cd /usr/loca/src/git-1.9.5

然后重新执行“步骤3”,Git基本安装完成。

4、查看Git版本

git --version

通过如上命令查看Git版本,系统却提示:

bash: /usr/bin/git: No such file or directory

说明在“/usr/bin/”目录里,并没有Git的执行程序。

通过命令查找Git执行程序的目录:

which git

发现Git执行程序的目录在:

/usr/local/bin/git

通过如下命令,将之与“/usr/bin/”目录建立软链接:

sudo ln -s /usr/local/bin/git /usr/bin/git

再查看下版本:

git --version

如下图所示,Git即完全安装成功!

949adbb39fec572912aa0b4e52cfc6b8.png

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值