Centos7升级Git版本
centos 升级 Git 版本
问题描述
centos7 系统默认的 git 安装版本是 1.8,但是在项目构建中发现 git 版本过低,于是用源码编译的方式进行升级.同时该文章也适用于安装新的 git,相信大家对 git 都有一定的了解了,在文章过程中有的步骤也就不细细讲了.
操作环境
centos7.0
软件准备
安装流程
1、第一步卸载原有的 git。
yum remove git
2、安装相关依赖
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc
yum install gcc perl-ExtUtils-MakeMaker
3、安装 git
将压缩包解压到/usr/local/src目录
tar -C /usr/local/src -vxf git-2.7.3.tar.xz
cd git-2.7.3
// 编译
make prefix=/usr/local/git all
// 安装
make prefix=/usr/local/git install
// 写入到环境变量中(方法一)
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile && source /etc/profile
// 写入到环境变量中(方法二)
export PATH=$PATH:/usr/local/bin/git
// 查看是否已经安装成功
git --version
问题解决
正常的流程就是按照上面的流程进行安装即可,下面总结一些在安装过程中遇到的几个问题.
1、make prefix=/usr/local/git all 进行编译的时候提示如下错误
LINK git-credential-store
libgit.a(utf8.o): In function `reencode_string_iconv':
/usr/src/git-2.8.3/utf8.c:463: undefined reference to `libiconv'
libgit.a(utf8.o): In function `reencode_string_len':
/usr/src/git-2.8.3/utf8.c:502: undefined reference to `libiconv_open'
/usr/src/git-2.8.3/utf8.c:521: undefined reference to `libiconv_close'
/usr/src/git-2.8.3/utf8.c:515: undefined reference to `libiconv_open'
collect2: ld returned 1 exit status
make: *** [git-credential-store] Error 1
这个问题主要是系统缺少 libiconv 库导致的。根据上面提供的链接,下载 libiconv 即可。
cd /usr/local/src
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar -zxvf libiconv-1.14.tar.gz
cd libiconv-1.14
配置
./configure --prefix=/usr/local/libiconv
编译
make
安装
make install
建立软连接
ln -s /usr/local/lib/libiconv.so /usr/lib
ln -s /usr/local/lib/libiconv.so.2 /usr/lib
这时候还 libiconv 库已经安装完成,下面进入我们的 git 安装目录,按照下面的方式进行安装
make configure
./configure --prefix=/usr/local --with-iconv=/usr/local/libiconv
编译
make
安装
make install
加入环境变量
export PATH=$PATH:/usr/local/bin/git
检测版本号
git --version
2、在安装 libiconv 时会遇到./stdio.h:1010:1: error: 'gets' undeclared here (not in a function)的错误提示,进行下面的操作即可解决.
进入错误文件路径
cd libiconv-1.14/srclib
编辑文件stdio.in.h找到698行的样子,内容是_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
将这一行注释掉(注意注释一定要用/**/来进行注释),替换为下面的内容
#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif
本文由博客一文多发平台 OpenWrite 发布!
Centos7升级Git版本的更多相关文章
- centOS7升级git版本到2.7.3
CentOS 自带的git版本太低,需要升级到2.1.2版本以上才能使用gitea. 升级方法: 1.安装所需软件包 yum install curl-devel expat-devel gettex ...
- 06.升级git版本及命令学习
博客为日常工作学习积累总结: 1.升级git版本: 参考博客:https://blog.csdn.net/yuexiahunone/article/details/78647565由于新的版本可以使用 ...
- centos下升级git版本的操作记录
在使用git pull.git push.git clone的时候,或者在使用jenkins发版的时候,可能会报类似如下的错误: error: The requested URL returned e ...
- centos6下升级git版本的操作记录
编译go_ethereum的时候出现了错误 然后发现是自己的git没有升级成功 因为编译需要高版本的git版本 所以会编译不成功 之后执行 root@uatjenkins01 ~]# git - ...
- 转:centos下升级git版本的操作记录
https://www.cnblogs.com/kevingrace/p/8252517.html 在使用git pull.git push.git clone的时候,或者在使用jenkins发版的时 ...
- centos7 升级 git(2.14.3) 版本
下载 wget https://www.kernel.org/pub/software/scm/git/git-2.14.3.tar.gz 安装依赖包 yum install curl-devel ...
- Centos7升级gcc版本方法之一使用scl软件集
Centos7 gcc版本默认4.8.3,Red Hat 为了软件的稳定和版本支持,yum 上版本也是4.8.3,所以无法使用yum进行软件更新,所以使用scl. scl软件集(Software Co ...
- CentOS7 升级gcc版本
CentOS7自带的GCC版本是4.8.5,如下所示: # cat /etc/redhat-release CentOS Linux release 7.6.1810 (Core) # which g ...
- centos7 升级php版本
centos7 默认PHP5.4,版本太低,很多要求至少PHP5.5 1.查看已经安装的PHP组件 yum list installed| grep php php.x86_64 -.el7 @bas ...
随机推荐
- Netty源码分析 (八)----- write过程 源码分析
上一篇文章主要讲了netty的read过程,本文主要分析一下write和writeAndFlush. 主要内容 本文分以下几个部分阐述一个java对象最后是如何转变成字节流,写到socket缓冲区中去 ...
- Android开发必看知识
奇艺高清UI界面源代码 http://www.eoeandroid.com/thread-160824-1-1.html 搜索关键字飞入飞出效果 http://www.eoeandroid.com/t ...
- TLC5615
#include <reg51.h> #include "TLC5615.c" code uchar seven_seg[] = {0xc0, 0xf9, 0xa4, ...
- IBM MQ reason code list
The reason code parameter (Reason) is a qualification to the completion code parameter (CompCode). I ...
- linux 操作系统级别监控 nmon命令
nmon是IBM公司开发的Linux性能监控工具,可以实时展示系统性能情况,也可以将监控数据写入文件中,并使用nmon分析器做数据展示 实时监控 命令 ./nmon c 代表CPU m 代表Memor ...
- Anroid逆向学习从编写so到静动态调试分析arm的一次总结
Anroid逆向学习从编写so到静动态调试分析arm的一次总结 一.前言 最近跟着教我兄弟学逆向这篇教程学习Android逆向,在第七课后作业反复折腾了好几天,正好在折腾的时候对前面的学习总结一波,动 ...
- OAuth2.0 RFC 6749 中文
英文原版:https://tools.ietf.org/html/rfc6749 转自:https://github.com/jeansfish/RFC6749.zh-cn 一.简介 在传统的客户端- ...
- oracle 11g 下载安装 使用记录
Oracle 11g 使用记录 1.下载oracle快捷安装版: (1)下载连接:https://pan.baidu.com/s/1ClC0hQepmTw2lSJ2ODtL7g 无提取码 (2)去 ...
- SQL数据库各种查询建表插入集合-待续持续更新
创建表 drop table student; DROP table Course; DROP table sc; CREATE TABLE student ( sid integer PRIMARY ...
- Android系统开发实务实训
实训项目 : Android系统开发实务实训 项目成品名称: 绝地坦克 ...