Install git in Linux and gitLinux

Source: Internet
Author: User

Install git in Linux and gitLinux

Reference: https://git-scm.com/book/zh/v1/%E8%B5%B7%E6%AD%A5-%E5% AE %89%E8%A3%85-Git

Git needs to call the code of libraries such as curl, zlib, openssl, expat, and libiconv. Therefore, install these dependency tools first.

 

$ yum install curl-devel expat-devel gettext-devel \openssl-devel zlib-devel$ apt-get install libcurl4-gnutls-dev libexpat1-dev gettext \libz-dev libssl-dev

 



Then, download the latest source code from the following Git official site:

Http://git-scm.com/download
Then compile and install:

$ tar -zxf git-1.7.2.2.tar.gz$ cd git-1.7.2.2$ make prefix=/usr/local all$ sudo make prefix=/usr/local install

 

If an error occurs during compilation:

usr/bin/perl Makefile.PL PREFIX='/usr/local/git' INSTALL_BASE='' --localedir='/usr/local/git/share/locale'Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 3.BEGIN failed--compilation aborted at Makefile.PL line 3.make[1]: *** [perl.mak] Error 2make: *** [perl/perl.mak] Error 2

 

Run the following command:

yum install perl-ExtUtils-MakeMaker 

After the installation is complete, the git command is located under/usr/local/bin. If you enter the git -- version command, the bash:/usr/bin/git: No such file or directory error occurs, add the bin directory to the path environment variable in/etc/profile.

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.