1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > linux 的git的安装目录 Linux下Git安装及配置较详细-Go语言中文社区

linux 的git的安装目录 Linux下Git安装及配置较详细-Go语言中文社区

时间:2020-01-20 22:48:02

相关推荐

linux 的git的安装目录 Linux下Git安装及配置较详细-Go语言中文社区

1.下载git源码

2.解压安装包

--解压:tar -zxvf git-2.9.5.tar.gz

--移直目标文件:mv /root/git-2.9.5 /usr/git-2.9.5(使用Xftp操作也可)

--进入解压包目录 cd usr/git-2.9.5

3.安装

--指定安装目录 ./configure --prefix=/usr/git

./configure报错

[root@localhost git-2.9.5]# ./configure --prefix=/home/Git configure: Setting lib to 'lib' (the default) configure: Will try -pthread then -lpthread to enable POSIX Threads. configure: CHECKS for site configuration checking for gcc... no checking for cc... no checking for cl.exe... no configure: error: in `/home/tools/git-2.9.5': configure: error: no acceptable C compiler found in $PATH See `config.log' for more details

执行报错中看出gcc,cc,cl.exe为no。gcc是linux的c语言编译器,说明我的机器中没有安装这些编译器。

分别安装以下gcc,gcc-c++,安装成功之后执行一下git安装命令:

[root@localhost git-2.9.5] # yum install gcc

[root@localhost git-2.9.5] # yum install gcc-c++

[root@localhost git-2.9.5] # ./configure --prefix=/usr/git

--安装 make && make install

make命令报错

[root@localhost git-2.9.5]# make && make install * new build flags CC credential-store.o In file included from credential-store.c:1:0: cache.h:40:18: 致命错误:zlib.h:没有那个文件或目录 #include ^ 编译中断。 make: *** [credential-store.o] 错误 1

缺少zlib的头文件,开发包没装。安装zlib

[root@localhost git-2.9.5]# yum install zlib

[root@localhost git-2.9.5]# yum install zlib-devel

[root@localhost git-2.9.5]# yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker

[root@localhost git-2.9.5]# make && make install

执行后继续报错,错误信息:

MSGFMT po/bg.msg make[1]:*[po/bg.msg] Error 127

解决方式:

yum install tcl build-essential tk gettext

再次执行安装:

[root@localhost git-2.9.5]# make && make install

则安装成功。

4.检查git是否安装完成

进入指定的安装目录,查看git版本

[root@localhost bin]# cd /usr/Git/bin

[root@localhost bin]# ./git --version

git version 2.9.5

5.配置环境变量:

vi /etc/profile

编辑配置文件,在最后追加下面的字符串,指定bin目录地址

$PATH://usr/git/bin

修改完成之后,执行命令,生效配置文件

source /etc/profile

检查是否配置成功,可切换路径到其他目录,执行 git --version。返回git版本则表示环境变量配置完成。

在安装过程中,查到的资料链接如下:

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。