Git 离线安装/升级
概要: CentOS 7自带git版本低于2.0,已经落后于主流版本需要升级。但是yum无法直接检测升级,此处介绍离线编译升级方法。
创建时间: 2022.10.12 23:08:27
更新时间: 2023.12.01 00:05:58
前置准备
安装必备工具包
Bash |
---|
| yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc \
gcc perl-ExtUtils-MakeMaker autoconf automake libtool xmlto wget
|
移除旧版本
下载解压git
获取新版本
Bash |
---|
| wget https://www.kernel.org/pub/software/scm/git/git-2.32.0.tar.gz
|
解压缩
Bash |
---|
| tar zxvf git-2.32.0.tar.gz
cd git-2.32.0
|
本地编译git
Bash |
---|
| make configure
./configure --prefix=/usr/local/git --with-iconv=/usr/local/libiconv
make all doc
make install install-doc install-html
|
后续操作
添加到系统可执行路径
Bash |
---|
| echo "export PATH=/usr/local/git/bin:$PATH" >> ~/.zshrc
source ~/.zshrc
|
查看版本信息
参考