Compile the basic environment
The code is as follows: |
Copy code |
Yum-y install gcc make
|
Make sure that the dependent package is installed.
The code is as follows: |
Copy code |
Yum install-y curl-devel zlib-devel openssl-devel perl-devel cpio expat-devel gettext-devel
|
Download the latest git package
The code is as follows: |
Copy code |
Wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz Tar xzvf git-latest.tar.gz Cd git-2012-07-05 # Your directory may not be this Autoconf ./Configure Make & make install
|
Check the installed version.
The code is as follows: |
Copy code |
[Root @ cobbler git-2012-07-05] # git -- version Git version 1.7.11.GIT
|
Error message during compilation and solution:
Make [1]: Warning: File 'makefile' has modification time 3e + 06 s in the future
/Usr/bin/perl Makefile. pl prefix = '/usr/local' INSTALL_BASE = ''-- localedir ='/usr/local/share/locale'
Writing perl. mak for Git
Make [1]: warning: Clock skew detected. Your build may be incomplete.
GEN git-add -- interactive
Make [1]: Warning: File 'makefile' has modification time 3e + 06 s in the future
Writing perl. mak for Git
Make [2]: Warning: File 'makefile. Pl' has modification time 3e + 06 s in the future
Use of uninitialized value $ localedir in concatenation (.) or string at Makefile. PL line 52.
Writing perl. mak for Git
Make [2]: *** [perl. mak] Error 1
Make [1]: *** [instlibdir] Error 2
Make: *** [git-add -- interactive] Error 2
I searched for some items on the internet and found that the machine time settings were incorrect based on the error warning .. The system time is earlier than the version time. Therefore, you need to reset the system time.
I use centos6 becauseIn CentOS6, the yum source already has the git version. You can directly use the yum source for installation.
The code is as follows: |
Copy code |
Yum-y install git |
The current git version in yum is as follows:
The code is as follows: |
Copy code |
[Root @ cobbler ~] # Git -- version Git version 1.7.1 |
I encountered a small problem during compilation and installation of git. I will post it for your reference.
1. Download the git version
The code is as follows: |
Copy code |
Wget http://git-core.googlecode.com/files/git-1.7.10.1.tar.gz Wget http://git-core.googlecode.com/files/git-manpages-1.7.10.1.tar.gz |
2. The following error is reported during git compilation by make:
Make [1]: Warning: File 'makefile' has modification time 2.5e + 07 s in the future
/Usr/bin/perl Makefile. pl prefix = '/usr/local'
Writing perl. mak for Git
Make [1]: warning: Clock skew detected. Your build may be incomplete.
GEN git-add -- interactive
Make [1]: Warning: File 'makefile' has modification time 2.5e + 07 s in the future
Writing perl. mak for Git
Make [2]: Warning: File 'makefile. Pl' has modification time 2.5e + 07 s in the future
Writing perl. mak for Git
Make [2]: *** [perl. mak] Error 1
Make [1]: *** [instlibdir] Error 2
Make: *** [git-add -- interactive] Error 2
I searched the internet and found the machine time setting problem based on the error warning. I fixed the problem by resetting the machine time:
The code is as follows: |
Copy code |
Ntpdate time.nist.gov |
3. After installation, the following error is reported if you want to use online help:
The code is as follows: |
Copy code |
[Root @ test ~] # Man git No manual entry for git
|
Decompress git-manpages-1.7.10.1.tar.gz to the/usr/share/man Directory. This package is compiled, not the source code installation package.
The code is as follows: |
Copy code |
Tar zxf git-manpages-1.7.10.1.tar.gz-C/usr/share/man
|
In this way, you can use man git.