我想在 CentOS 7.4 上安装最新的可用 git (git-2.17.1),因为一些应用程序对此有抱怨,而且不仅仅是这样。
我正在尝试安装git-2.17.1从源头开始CentOS 7.4。
这些是我尝试过的方法:
- 使用以下命令(仅)卸载旧的 git:
A)rpm -e --nodeps git
git-2.17.1.zip
下载并解压文件/home/myusername/temp/
在本例中更改为提取文件的目录
/home/myusername/temp/git-2.17.1/
作为超级用户,使用以下命令安装了所有可能需要的依赖项:
a) yum install docbook2X-0.8.8-17.el7.x86_64.rpm
(下载此软件包后)
b)yum install dh-autoreconf curl-devel expat-devel gettext-devel openssl-devel perl-devel zlib-devel asciidoc xmlto gengetopt autoconf libcurl-devel gcc kernel-headers debhelper intltool perl-Git po-debconf
- 按照 git-scm 网站上的说明创建了符号链接,使用:
A) ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi
作为普通用户,运行以下命令:
./configure CFLAGS='-I/usr/local/openssl/include' LDFLAGS='-L/usr/local/openssl/lib' --prefix=/usr/local/git --with-openssl=/usr/local/bin/openssl
make all doc info
再次,作为超级用户,运行以下命令:
make install install-doc install-html install-info
最后一步出现问题,输出如下:
install -m 644 git.info gitman.info /usr/local/git/share/info
if test -r /usr/local/git/share/info/dir; then \
install-info --info-dir=/usr/local/git/share/info git.info ;\
install-info --info-dir=/usr/local/git/share/info gitman.info ;\
else \
echo "No directory found in /usr/local/git/share/info" >&2 ; \
fi
No directory found in /usr/local/git/share/info
mak
e[1]: Leaving directory `/home/myusername/temp/git-2.17.1/Documentation'
我成功地将 openssl 版本升级到今天可用的最新版本(openssl 1.1.0h)。
答案1
这不是错误,您可以echo $?
运行后检查它make install-info
。目标install-info
看起来Documentation/Makefile
像这样:
install-info: info
$(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
$(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
if test -r $(DESTDIR)$(infodir)/dir; then \
$(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
$(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) gitman.info ;\
else \
echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
fi
名为正确的程序install
在 中创建信息页面
/usr/local/git/share/info/
,您可以检查它:
$ ls -lh /usr/local/git/share/info/
total 2.3M
-rw-r--r-- 1 root root 218K Jun 13 21:46 git.info
-rw-r--r-- 1 root root 2.1M Jun 13 21:46 gitman.info
目标install-info
是在提交中引入的4739809c
,并表示:
如果信息目标目录尚未包含“dir”文件,则不会创建目录条目。
名为的文件dir
是以下内容的一部分GNU texinfo
但这不是必需的。
另请注意,除非您有,否则您/usr/local/git/bin/
无法$PATH
在按照您的方式安装后git
简单地键入git
内容来开始,您必须这样做:
$ /usr/local/git/bin/git --version
git version 2.17.1
答案2
如何在 CentOS 7 上从源代码正确安装 Git 2.17.1
可能构建“2.17.1”软件包,并使用 yum 安装所需的软件包。
$ rpm -i git-2.17.1-2.fc28.src.rpm
# yum install libcurl-devel libsecret-devel pcre2-devel tk cvs cvsps \
httpd mod_dav_svn subversion subversion-perl perl-DBD-SQLite perl-CPAN
# cpan
cpan[1]> install IO::Pty
cpan[2]> install Test::More
$ cd rpms/SPECS/
$ rpmbuild -bb git.spec
.
Wrote: /home/knudfl/rpms/RPMS/x86_64/git-2.17.1-2.el7.x86_64.rpm
Wrote: /home/knudfl/rpms/RPMS/noarch/git-all-2.17.1-2.el7.noarch.rpm
Wrote: /home/knudfl/rpms/RPMS/x86_64/git-core-2.17.1-2.el7.x86_64.rpm
Wrote: /home/knudfl/rpms/RPMS/noarch/git-core-doc-2.17.1-2.el7.noarch.rpm
Wrote: /home/knudfl/rpms/RPMS/noarch/git-cvs-2.17.1-2.el7.noarch.rpm
Wrote: /home/knudfl/rpms/RPMS/x86_64/git-daemon-2.17.1-2.el7.x86_64.rpm
Wrote: /home/knudfl/rpms/RPMS/noarch/git-email-2.17.1-2.el7.noarch.rpm
Wrote: /home/knudfl/rpms/RPMS/noarch/gitk-2.17.1-2.el7.noarch.rpm
Wrote: /home/knudfl/rpms/RPMS/noarch/gitweb-2.17.1-2.el7.noarch.rpm
Wrote: /home/knudfl/rpms/RPMS/noarch/git-gui-2.17.1-2.el7.noarch.rpm
Wrote: /home/knudfl/rpms/RPMS/noarch/git-p4-2.17.1-2.el7.noarch.rpm
Wrote: /home/knudfl/rpms/RPMS/noarch/perl-Git-2.17.1-2.el7.noarch.rpm
Wrote: /home/knudfl/rpms/RPMS/noarch/perl-Git-SVN-2.17.1-2.el7.noarch.rpm
Wrote: /home/knudfl/rpms/RPMS/x86_64/git-subtree-2.17.1-2.el7.x86_64.rpm
Wrote: /home/knudfl/rpms/RPMS/x86_64/git-svn-2.17.1-2.el7.x86_64.rpm
Wrote: /home/knudfl/rpms/RPMS/x86_64/git-debuginfo-2.17.1-2.el7.x86_64.rpm
16个套餐https://drive.google.com/drive/folders/1PRxoicjzHWunFZW-hhXT9JsFk_PQIoLs?usp=sharing