Install the latest version of git on CentOS
Git is available in many Linux system libraries and can be directly installed using command lines.
For example, you can directly use yuminstallgit in Fedora. For details, refer:
Debian/Ubuntu $ apt-get install gitFedora $ yum install gitGentoo $ emerge -- ask -- verbose dev-vcs/gitArch Linux $ pacman-S gitopenSUSE $ zypper install gitFreeBSD $ cd/usr/ports /devel/git
$ Make installSolaris 11 Express $ pkg install developer/versioning/gitOpenBSD $ pkg_add git
The new version of CentOS later seems to support this function, but this method is simple, but the version updates in the general repository are not timely. For example, the latest version of git in the CentOS repository is 1.7.1, however, git has officially reached 2. x version. For systems that want to obtain the latest git, only the rpm package or source code can be used.
The procedure is as follows:
1. Download the compilation tool
Yumgroupinstall "DevelopmentTools"
2. Download the dependency package
Yuminstallzlib-develperl-ExtUtils-MakeMakerasciidocxmltoopenssl-devel
3. Download the source code of the latest version of git.
Wgethttp: // www.codemonkey.org. uk/projects/git-snapshots/GitHub/git-latest.tar.gz
Or
Wgethttp: // www.codemonkey.org. uk/projects/git-snapshots/GitHub/git-latest.tar.xz
4. Extract the source file
Tar-zxvfgit-latest.tar.gz
Or
Xz-dgit-latest.tar.xz
Tar-xvfgit-latest.tar
5. Compile and install
Autoconf
./Configure
Make-jn & make-jninstall
Here, n in make-jn is the specified number of threads. For multi-core processors, this can speed up compilation and installation.
6. Add link
Ln-s/usr/local/bin/git/usr/bin/
This step is very important for systems with old git versions in the original system. It will be reported that the Link already exists. In this case, delete the original Link, namely/usr/bin/git, and then execute Step 6.
7. Check the version number
Git -- version
If the old version of git exists in the system, after the new git is installed, it is still displayed as the old version after git -- version is used, because I ignores step 6, which is very important!