阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

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

33次阅读
没有评论

共计 2120 个字符,预计需要花费 6 分钟才能阅读完成。

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

如何在最小化安装的 CentOS 7.5 上编译安装 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 协议,具体方法如图:

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

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

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

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

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

# 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 
 ^
编译中断。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

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

阿里云 2 核 2G 服务器 3M 带宽 61 元 1 年,有高配

腾讯云新客低至 82 元 / 年,老客户 99 元 / 年

代金券:在阿里云专用满减优惠券

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2024-07-25发表,共计2120字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中