zhu894532094 发表于 2017-6-3 09:59:15

centos7安装git

  现在在公司基本都转git了,git的好处或者说和svn的区别了,在这里就多说了,使用源码包直接安装。
  卸载centos自带老版本git:yum -y remove git
  源码安装 Git之前需要安装 Git 依赖的库:curl、zlib、openssl、expat,还有libiconv。命令如下:
  sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel


安装必要依赖:

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

为了能够添加更多格式的文档(如 doc, html, info),你需要安装以下的依赖包:

sudo yum install asciidoc xmlto docbook2x





https://github.com/git/git/releases 下载git

  tar -zxvf git-2.12.0.tar.gz
  cd git-2.12.0/
  make configure
  ./configure --prefix=/usr/local/git-2.12.0
  make all doc info
  make install install-doc install-html install-info
  参考文档:https://git-scm.com/book/zh/v2/%E8%B5%B7%E6%AD%A5-%E5%AE%89%E8%A3%85-Git
  期间会报的错误:
  报错1:EGIN failed--compilation aborted at Makefile.PL line 3.

  解决方案:yum install perl-ExtUtils-MakeMaker
  参考文档:http://blog.163.com/hehaifeng1984@126/blog/static/69001136201483101011798/
  报错2:/bin/sh: line 1: docbook2x-texi: command not found
  首先下载docbook2X-0.8.8-17.sdl7.x86_64.rpm
  下载地址:https://centos.pkgs.org/7/puias-unsupported-x86_64/docbook2X-0.8.8-17.sdl7.x86_64.rpm.html
  安装:yum -y install openjade texinfo perlperl-XML-SAX.noarch

rpm -ivh docbook2X-0.8.8-17.sdl7.x86_64.rpm
find / -name db2x_docbook2texi
cd /usr/bin/
ln -s db2x_docbook2texi docbook2x-texi

参考文档:http://www.codeweblog.com/%E5%8E%9F%E5%88%9B-centos6-4-%E4%B8%8B%E6%BA%90%E7%A0%81%E5%AE%89%E8%A3%85-git

vim /etc/profile 添加变量:/usr/local/git-2.12.0/bin
source /etc/profile
页: [1]
查看完整版本: centos7安装git