CentOS7.6升级Git版本

安装centos7最小化系统,再安装VIM插件coc.nvim出现
Error: javascript bundle not found, please compile code ~ | of coc.nvim by esbuild.
或者出现:
please compile coc.nvim by: npm run build

不管怎样就是安装不上,查资料也不管,最后重新装系统都不行,有的说是升级git,升级后再安装确实管用,但也不一定是这个问题。记录一下git升级

CentOS7上的Git版本太陈旧,在使用过程中会遇到问题,因此需要升级git版本。

git --version

git version 1.8.3.1
  系统版本:(CentOS 7.6)

安装依赖
  源代码安装和编译git,需安装一些依赖。

yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc
yum install gcc perl-ExtUtils-MakeMaker

卸载旧版本
yum remove git

编译安装Git
  Git软件包可在此获取:https://mirrors.edge.kernel.org/pub/software/scm/git/

  我们选择最新版的:

git-2.23.0.tar.xz 16-Aug-2019 20:17 5M

安装步骤
复制代码

cd /usr/local/src/
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.23.0.tar.xz
tar -xvf git-2.23.0.tar.xz
cd git-2.23.0/
mv git-2.23.0 git
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

验证版本
[root@localhost ~]# git --version
git version 2.23.0

非root用户使用
如果是非root用户使用git,则需要配置下该用户下的环境变量。

$ echo "export PATH=$PATH:/usr/local/git/bin" >> ~/.bashrc
$ source ~/.bashrc

centos6.5换可用yum源

源进入/etc/yum.repos.d,备份一下cp CentOS-Base.repo CentOS-Base.repo_bak
方法一:应该是用不了
首先去阿里下载yum
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
然后编辑CentOS-Base.repo用vi替换命令
:%s/$releasever/6.10
:%s/centos/6.10/centos-vault/6.10
修改完以后
yum clean all
yum makecache
方法二:

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-6.10 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/
        http://mirrors.aliyuncs.com/centos-vault/6.10/os/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos-vault/6.10/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-6.10 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/
        http://mirrors.aliyuncs.com/centos-vault/6.10/updates/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos-vault/6.10/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-6.10 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/
        http://mirrors.aliyuncs.com/centos-vault/6.10/extras/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos-vault/6.10/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.10 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/centosplus/$basearch/
        http://mirrors.aliyuncs.com/centos-vault/6.10/centosplus/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos-vault/6.10/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-6.10 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/contrib/$basearch/
        http://mirrors.aliyuncs.com/centos-vault/6.10/contrib/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos-vault/6.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6

修改完以后
yum clean all
yum makecache

摘自:https://blog.csdn.net/qq_36667170/article/details/118616497