在CentOS上安装Git
2013-06-18 05:55
218 查看
CentOS 5的yum源中没有git,只能自己编译安装,现记录下编译安装的内容及错误解决方法,留给自己备忘。
编译基础环境环境
确保已安装了依赖的包
下载最新的git包
检查下安装的版本,大功告成
编译时遇到错误讯息及解决方法:
![](http://img.m114.org/2012/07/git-error.png)
由于CentOS6中yum源中已经有git的版本了,可以直接使用yum源进行安装
有可能会报错:git: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory
解决方法如下:
不久前升级了iconv库影响。在/usr/local/lib下可以找到libiconv.so.2,把/usr/local/lib加到路径中也不行。
方法一:
在/etc/ld.so.conf中加一行/usr/local/lib,运行ldconfig。再运行apache,OK。
ld.so.conf和ldconfig是维护系统动态链接库的。真不明白为什么iconv库安装时不把这一步也做了
方法二:
ln -sf /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2
CENTOS 下 编译安装 git
1.先给大家说下编译安装方法,安装前准备
yum-yinstall 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.安装git
tar zxf git-latest.tar.gz
cd git-{date} 我这里是git-2012-04-17的版本,所以我的命令是cd git-2012-04-17/
autoconf
./configure
make
make install
make和make install在这里最好分开执行,免得有错不知道.
git --version
git version 1.7.10
编译基础环境环境
1 | yum-y install gcc make |
确保已安装了依赖的包
1 | yum install -y curl curl-devel zlib-devel openssl-devel perl perl-devel cpio expat-devel gettext-devel |
下载最新的git包
1 | wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.[/code]tar.gz |
2 | tar xzvf git-latest. tar .gz |
3 | cd git-2012-07-05 #你的目录可能不是这个 |
4 | autoconf |
5 | ./configure |
6 | make && make install |
检查下安装的版本,大功告成
1 | [root@cobbler git-2012-07-05] # git --version |
2 | git version 1.7.11.GIT |
编译时遇到错误讯息及解决方法:
![](http://img.m114.org/2012/07/git-error.png)
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 在网上搜索了一些,根据出错的warning发现是机器时间设置的问题。。是机器系统的时间比版本的时间早。所以要系统时间重新设置。
由于CentOS6中yum源中已经有git的版本了,可以直接使用yum源进行安装
1 | yum-y install git |
2 |
3 | 目前yum源中的git版本如下 |
4 | [root@cobbler ~] # git --version |
解决方法如下:
不久前升级了iconv库影响。在/usr/local/lib下可以找到libiconv.so.2,把/usr/local/lib加到路径中也不行。
方法一:
在/etc/ld.so.conf中加一行/usr/local/lib,运行ldconfig。再运行apache,OK。
ld.so.conf和ldconfig是维护系统动态链接库的。真不明白为什么iconv库安装时不把这一步也做了
方法二:
ln -sf /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2
CENTOS 下 编译安装 git
1.先给大家说下编译安装方法,安装前准备
yum-yinstall 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.安装git
tar zxf git-latest.tar.gz
cd git-{date} 我这里是git-2012-04-17的版本,所以我的命令是cd git-2012-04-17/
autoconf
./configure
make
make install
make和make install在这里最好分开执行,免得有错不知道.
git --version
git version 1.7.10
相关文章推荐
- CentOS下安装Git2.9
- centos6.5编译安装git
- 如何在centos6.4上安装git How To Install Git on a CentOS 6.4 VPS
- CentOS下Git的服务器版安装和使用
- CentOS下用yum安装git
- 在CentOS上安装Git
- centOS上安装最新git 2.4.0
- centos安装git
- Centos下git安装
- centos git安装教程
- git 源码安装 在centos6.5
- centos 编译安装最新版 Git
- CentOS和RHEL使用源码包安装git
- Centos安装(更新)git(亲测有效)
- Centos 6.7 下安装git 各种累心折腾
- centos+git+gitolite 安装和部署
- centos 6&7 更新&安装最新版git
- git 2.18.0 在CentOS 7下安装
- 在CentOS下安装Git
- CentOS 6.X 安装git客户端