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

三、到官网去下载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 <sub-command> 命令查看。实际上,即使不安装 Git 文档,也可以使用 man 手册查看 Git 帮助,使用命令githelp <sub-command>或git <sub-command> --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[1]: *** [git-add.1] Error 127
make[1]: Leaving directory `/home/soft/git-1.8.5/Documentation'
make: *** [doc] Error 2
解决:
安装xmlto
#yum –y insgtall xmlto
错误二:
/bin/sh: line 1: docbook2x-texi: commandnot found
make[1]: *** [user-manual.texi] Error 127
make[1]: Leaving directory`/home/soft/git-1.8.5/Documentation'
make: *** [info] 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
# cp  contrib/completion/git-completion.bash /etc/bash_completion.d/
# source /etc/bash_completion

Git 的详细介绍:请点这里
Git 的下载地址:请点这里

推荐阅读:

Fedora通过Http Proxy下载Git

在Ubuntu Server上安装Git

服务器端Git仓库的创建(Ubuntu)

Linux下Git简单使用教程(以Android为例)

Git权威指南 PDF高清中文版

相关内容