Installing Git on CentOS

Source: Internet
Author: User

CentOS 5 's Yum source does not have git, can only compile the installation itself, now record the content of the compilation and installation and error resolution, left to their own memo.
Compiling a basic Environment environment

1 Yum-y Installgccmake


Ensure that the dependent packages are installed

1 Yum install-y Curl curl-devel zlib-devel openssl-devel perl perl-devel cpio expat-devel Gettext-devel


Download the latest Git package

1 wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz
2 Tar xzvf git-latest.tar.gz
3 CD git-2012-07-05 # Your directory may not be this
4 Autoconf
5 ./configure
6 Make && make install


Check the installed version, done

1 [Root@cobbler git-2012-07-05]# git--version
2 git version 1.7.11.GIT



Compile with error message and workaround:

MAKE[1]: Warning:file ' Makefile ' have modification time 3e+06 s in the future
/usr/bin/perl makefile.pl prefix= '/usr/l Ocal ' install_base= '--localedir= '/usr/local/share/locale '
Writing perl.mak for Git
make[1]: Warning:  Clock skew detected.  Your build may incomplete.
    GEN git-add--interactive
make[1]: Warning:file ' Makefile ' have modification time 3e+06 s in the future
Writing per L.mak for Git
make[2]: Warning:file ' makefile.pl ' have modification time 3e+06 s in the future use of
Uninitialize D value $localedir in concatenation (.) or string at makefile.pl line.
Writing Perl.mak for Git
make[2]: * * [Perl.mak] Error 1
make[1]: * * * [Instlibdir] Error 2 Make
: * * * [git-a Dd--interactive] Error 2

on the web search for some, according to the error of warning discovery is the machine time setting problem. The time of the machine system is earlier than the version time. So you have to reset the system time.



Since there is already a git version in the Yum source in CentOS6, you can install it directly using the Yum source

1 Yum-y Installgit
2
3 The current git version in Yum source is as follows
4 [Root@cobbler ~]# git--version
There may be an error: Git:error while loading shared libraries:libiconv.so.2:cannot open Shared object file:no such file or directory

Here's how to fix it:
Recently upgraded the Iconv library impact. Under/usr/local/lib can find libiconv.so.2, add/usr/local/lib to the path also not.

Method One:

Add a row of/usr/local/lib in/etc/ld.so.conf and run Ldconfig. Run Apache,ok again.
Ld.so.conf and Ldconfig are maintenance system dynamic link libraries. I don't understand why the Iconv library does not take this step when it is installed.

Method Two:

Ln-sf/usr/local/lib/libiconv.so.2/usr/lib/libiconv.so.2


Build and install Git under CENTOS

1. First of all, the compilation and installation method, preparation before installation
Yum-y Install Zlib-devel openssl-devel perl cpio expat-devel gettext-devel OpenSSL zlib Curl autoconf tk
wget http://git-core.googlecode.com/files/git-1.7.10.tar.gz

2. Install git
Tar zxf git-latest.tar.gz
CD Git-{date} I am here for the git-2012-04-17 version, so my command is CD git-2012-04-17/
Autoconf
./configure
Make
Make install
Make and make install is best done separately here, lest there is any mistake.
Git--version
git version 1.7.10

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.