发表于 2018-9-18 09:02:00

CentOS 6.5 mini 安装Git-core

  在使用Centos yum 源里面git 同步谷歌android 源码时,发现版本太低。无法从google 服务器同步代码。下面就是关于在Centos 6.5 mini 版中安装git 最新版本。
  一、服务器安装
  CentOS 6.5 mini 化安装最小操作系统,并对系统软件进行升级
# yum update  二、安装开发软件包等软件
# yum-y install vim openssh-clients setuptoolntsysv system-config-securitylevel-tui system-config-network-tui wget man gccgcc-c++ gcc-g77 flex autoconfig automake bison zlib-devel bzip2-develncurses-devel libtool libtool-ltdl openssl openssl-devel pam-devellibtermcap-devel curl-devel libxml2-devel libevent libevent-devel gettext-develexpat-devel perl-devel expat-devel  三、到官网去下载git 源码、并解压
# wget https://git-core.googlecode.com/files/git-1.8.5.tar.gz  
# tar zxvf git-1.8.5.tar.gz
  四、安装git
  安装方法写在INSTALL文件中,参照其中的指示即可完成安装。INSTALL 文档默认安装路径在/usr/下,这里我们安装到/usr/local 里。下面的命令将 Git 安装在/usr/local/bin中。(非完整安装)
# cd git-1.8.5  
# make prefix=/usr/local all
  
# make prefix=/usr/local install
  五、安装Git 文档(可选)
  编译的文档主要是 HTML格式的文档,方便通过git help -w命令查看。实际上,即使不安装 Git 文档,也可以使用 man 手册查看 Git 帮助,使用命令githelp 或git--help即可。
  编译文档依赖asciidoc,因此需要先安装 asciidoc(如果尚未安装的话),然后编译文档。在编译文档时要花费很多时间,要有耐心。
#yum -y install asciidoc  
#make prefix=/usr/local all doc info
  
#make prefix=/usr/local install-doc install-html install-info
  注:安装文档时候会出现一下错误
  错误一:
  /bin/sh: line 1: xmlto: command not found
  make: *** Error 127
  make: Leaving directory `/home/soft/git-1.8.5/Documentation'
  make: *** Error 2
  解决:
安装xmlto  
# yum –y install xmlto
  错误二:
  /bin/sh: line 1: docbook2x-texi: commandnot found
  make: *** Error 127
  make: Leaving directory`/home/soft/git-1.8.5/Documentation'
  make: *** Error 2
  这是因为git完整安装需要asciidoc,docbook2X,运行命令
# yum -y install texinfo  
# rpm -ivh http://mirror.1000mbps.com/fedora-epel/6Server/x86_64/docbook2X-0.8.8-1.el6.x86_64.rpm
  
# cd /usr/bin
  
# ln -s db2x_docbook2texi docbook2x-texi
  附:安装git命令补齐功能
# rpm –ivh http://mirror.1000mbps.com/fedora-epel/6Server/x86_64/bash-completion-1.3-7.el6.noarch.rpm  
# cpcontrib/completion/git-completion.bash /etc/bash_completion.d/
  
# source /etc/bash_completion


页: [1]
查看完整版本: CentOS 6.5 mini 安装Git-core