centos 安装git
标签 : Linux
yum源安装
yum install git
源码安装
-
下载源码包
yum install wget
//需要安装wget工具
wget http://codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.xz
-
解压源码包
mkdir -p /home/wtf0215/git
xz -d git-latest.tar.xz
tar xvf git-latest.tar -C /home/wtf0215/git
-
安装源码
cd /home/wtf0215/git/git-latest/
yun install autoconf
//需要安装autoconf工具
autoconf
//此命令会生成configure
文件
./configure --prefix=/git_install_dir
//此命令是指定安装路径
可能出现不成功,是因为没有安装gcc
工具
yum install gcc
重复上一条安装指定路径命令
make
make install
出现错误一:
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 2
make: *** [perl/perl.mak] Error 2
yum install perl-ExtUtils-MakeMaker package
用此命令解决
出现错误二:
/bin/sh: msgfmt: command not found
yum install gettext-devel
用此命令解决
4. 将git添加进PATH
vi /etc/profile
export GIT_HOME=/git_install_dir
export PATH=$PATH:$GIT_HOME/bin
这样随时随地可以使用git
5. 查看git版本
git --version
git version 1.8.0
//此时表示git安装成功