The current project uses GIT for version management, so it is appropriate to learn how to install GIT. This article describes how to compile and install git1.9.0. Although it is now 2.6.
Run all the commands under root.
Step 1: install the dependency package.
Before you start to compile and install git, you should first install the necessary dependency packages to avoid various problems during the installation process.
# Yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
Step 2: Download and compile git.
You can download the desired version from kernel.org or 1.9.0 as I do.
Switch to the src Directory, download and decompress the git source code.
# Cd/usr/src
Wget https://www.kernel.org/pub/software/scm/git/git-1.9.0.tar.gz
Tar xzf git-1.9.0.tar.gz
Go to the decompressed git directory and execute the compilation.
# Cd git-1.9.0
# Make prefix =/usr/local/git all
# Make prefix =/usr/local/git install
# Echo "export PATH = $ PATH:/usr/local/git/bin">/etc/bashrc
# Source/etc/bashrc
Step 3: Complete.
Now that you have successfully installed git, you can run the following command to view the git version.
# Git -- version
The current fedora22 already comes with git2.4 and later versions.
Possible problems during installation
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 .) <span class = "goog_qs-tidbit goog_qs-tidbit-0"> at Makefile. PL line 3.
BEGIN failed -- compilation aborted at Makefile. PL line 3.
This error occurs because the perl-ExtUtils-MakeMaker dependency is not successfully installed. Run the following command to reinstall the installation.
Yum install perl-ExtUtils-MakeMaker