手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

最小化安装的CentOS 7.5上编译安装Git2.19

[日期:2018-09-26] 来源:Linux社区  作者:huxingwei [字体: ]

VMware Workstation已经采用最小化安装CentOS7,显示版本为CentOS7.5,准备采用yum安装git。采用yum list git发现可安装的GIT软件包版本1.8.3.1,新的版本已经是2.19了,因此,我决定编译安装git2.19。

由于采用最小化安装系统,编译时出现一些问题,这里对处理过程作一下备忘:

1、首先在git官网上下载最新的版本,下载地址:https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.19.0.tar.gz

2、由于采用win10操作系统下载的文件,需要上传到CentOS7上,操作方式我一般通过SecureCRT采用SSH2协议登录,

上传文件也通过SecureCRT工具中的SFTP协议,具体方法如图:

注意:上传的文件会在登录用户的home目录下,可以通过lpwd查看本地目录,pwd查看远端目录

3、对文件解压:tar  xzvf  git-2.19.0.tar.gz

4、进入解压后的git目录后,安装方式参考:https://github.com/git/git/blob/master/INSTALL或目录下的INSTALL,这里采用建议步骤:

# make configure ;# as yourself
# ./configure --prefix=/usr ;# as yourself
# make all doc ;# as yourself
# make install install-doc install-html;# as root

5、首先执行make configure,开始就出错了,提示:

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 `/opt/git-2.19.0':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

通过yum provides gcc和 yum provides cc查询到c编译器没有安装,yum -y install gcc安装gcc包及对应的依赖。

6、再次执行make configure,再次出现如下错误:

GIT_VERSION = 2.19.0
 GEN configure
/bin/sh: autoconf: 未找到命令
make: *** [configure] 错误 127

通过yum provides autoconf查询到没有安装autoconf,yum -y install autoconf安装包及对应的依赖。

7、再一次执行make configure,正常了,接下来 ./configure很顺利。

8、执行make all doc,又出现错误:

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

错误指出没有zlib,yum -y install zlib安装,发现已经安装,zlib.h应该是对应的开发包没有,yum -y install zlib-devel安装开发包

9、再执行make all doc,再出现错误:

/bin/sh:行1: asciidoc: 未找到命令
make[1]: *** [git-init-db.html] 错误 127
make[1]: 离开目录“/opt/git-2.19.0/Documentation”
make: *** [doc] 错误 2

没有asciidoc命令,yum list asciidoc发现包没有安装,yum -y install asciidoc安装该包。

10、再一次执行make all doc,仍出现错误:

/bin/sh:行1: xmlto: 未找到命令
make[1]: *** [git-init-db.1] 错误 127
make[1]: 离开目录“/opt/git-2.19.0/Documentation”
make: *** [doc] 错误 2

思路一样,没有xmlto命令,yum list xmlto发现包没有安装, yum -y install xmlto安装该包,执行make all doc这下很顺利。

11、执行make install install-doc install-html,这下安装很顺利,没有再提示错误。

12、测试一下,执行git --version正常显示:

git version 2.19.0

终于安装成功了,可以正常使用。

Linux公社的RSS地址https://www.linuxidc.com/rssFeed.aspx

本文永久更新链接地址https://www.linuxidc.com/Linux/2018-09/154412.htm

linux
相关资讯       CentOS编译安装Git  编译安装Git 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款