Environment Introduction:
System version: CentOS 6.4
Software Warehouse: Yum-base,yum-epel
git version: Git 2.8.1
Installation Method: Source code compilation
Delete git version 1.7 from the original Yum source
# yum Remove git-y
2. Install dependent environment
# yum Install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-extutils-makemaker# yum install ASCII Doc Xmlto Docbook2x-y
3. Download git source code
Git latest version of source hosted in Github:https://github.com/git/git
# wget-o Git_2.8.1.zip # unzip git_2.8.1.zip-d git/
4. Compiling and installing Git
# CD git# Cat Install # View Installation Instructions Documentation
Because the new version of the GIT source installation does not require the./configure step, the makefile file is directly attached to the source file, so you can install it directly.
However, according to the installation instructions, it will be installed in the/USR directory by default. This is not conducive to post-collation and version upgrades.
So I'm using a directory to install Git.
View the makefile file, which defines some of the installation paths in line No. 415.
# make Prefix=/usr/local/git mandir=/usr/share/man infodir=/usr/share/info sharedir=/usr/share htmldir=/usr/share/ Doc/git-doc Install Install-doc install-info install-html
This installs the GIT to the specified directory, but the man document can also be viewed normally.
5. Some problems in the installation process
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7E/87/wKiom1cDZtWTwRrfAAA7X-gxGHQ708.png "title=" 16.png "alt=" Wkiom1cdztwtwrrfaaa7x-gxghq708.png "/>
The Docbook2x-texi command was not found during the installation process.
The tool needs to be installed DOCBOOK2X, which is mentioned earlier in this article.
However, (there is always one but 650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0066.gif "alt=" J_0066.gif "/>" After installing the package Still prompt for command not found.
Let's take a look at the files that the Baoseng has just installed.
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7E/84/wKioL1cDaB2wwd7cAAAky86TlOc204.png "title=" 17.png "alt=" Wkiol1cdab2wwd7caaaky86tloc204.png "/>
The red box file seems a bit strange, perhaps the new version of the command path is adjusted.
Let's make a soft connection (fake) and try to get through.
# ln-s/usr/bin/db2x_docbook2texi/usr/bin/docbook2x-texi
Then compile the installation again.
This time it's over! 650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0063.gif "alt=" J_0063.gif "/>
6. Finishing work
To add a git path to an environment variable:
# vim/etc/profile Add an export path= $PATH:/usr/local/git/bin/Save exit # source/etc/profile See if it works git# git--version if not, Then re-login to the shell and try again!
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7E/87/wKiom1cDabvDJzd8AAAQhma8uzY917.png "title=" 16.png "alt=" Wkiom1cdabvdjzd8aaaqhma8uzy917.png "/>
Also, if you are a regular command-line operator, you can customize your command line prompt, referring to the article I wrote earlier:
http://professor.blog.51cto.com/996189/1737500 Personalize your Git command line prompt
。
This article is from the "Professor" blog, please be sure to keep this source http://professor.blog.51cto.com/996189/1760455
CentOS 6 compile and install git 2.8.1