Install the latest version of git on CentOS

Source: Internet
Author: User
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, see Debian/Ubuntu $ apt-getinstallgitFedora $ yuminstallgitGentoo $ emerge -- ask -- verbosedev-vc.

Git is available in many Linux system libraries and can be directly installed using command lines.

For example, you can directly use yum install git 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 is officially available in version 2.x. 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

Yum groupinstall "Development Tools"

2. download the dependency package

Yum install zlib-devel perl-ExtUtils-MakeMaker asciidoc xmlto openssl-devel

3. download the source code of the latest version of git.

Wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz

Or

Wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.xz

4. extract the source file

Tar-zxvf git-latest.tar.gz

Or

Xz-d git-latest.tar.xz

Tar-xvf git-latest.tar

5. Compile and install

Autoconf

./Configure

Make-jn & make-jn install

Here, n in make-j n 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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.