Alibaba Cloud Linux 2 安装 Git 2.30.x

Alibaba Cloud Linux 2 支持yum命令

所以我们去Git官网进入Download for Linux and Unix页面

找到Red等安装选项

Red Hat Enterprise Linux, Oracle Linux, CentOS, Scientific Linux, et al.

进入 download a tarball

直接安装最新的版本,我选择安装在opt/inkyi/目录下,这个目录自己决定。

1.创建一个src目录,存放下载的源码文件

cd /opt
mkdir -p inkyi/src
cd /inkyi/src/

2.下载源码

wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.30.2.tar.gz

3.解压

tar -xzvf git-2.30.2.tar.gz

4.进入解压后的源码目录,执行make configure,生成配置文件

cd git-2.30.2/
make configure

遇到问题

[root@iZ8vb5ujtcvii1eaf1mffuZ git-2.30.2]# make configure
GEN configure
/bin/sh: autoconf: command not found
make: *** [configure] Error 127

缺少autoconf ,解决方案:

yum install autoconf automake libtool
# 安装完成后,再次执行
make configure

5.配置configure ,生成Makefile

#指定安装目录/opt/inkyi/git-2.30.2/
./configure --prefix=/opt/inkyi/git-2.30.2/

6.执行预编译

make

遇到问题,缺少zlib-devel

* new build flags
CC fuzz-commit-graph.o
In file included from object-store.h:4:0,
from commit-graph.h:5,
from fuzz-commit-graph.c:1:
cache.h:21:18: fatal error: zlib.h: No such file or directory
#include <zlib.h>
                  ^
compilation terminated.
make: *** [fuzz-commit-graph.o] Error 1

解决方案

yum install zlib-devel

7.执行安装

make install

8.添加环境变量

echo "export PATH=$PATH:/opt/inkyi/git-2.30.2/bin" >> /etc/profile
# 刷新
source /etc/profile
posted @   InkYi  阅读(909)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 通过 API 将Deepseek响应流式内容输出到前端
· AI Agent开发,如何调用三方的API Function,是通过提示词来发起调用的吗
点击右上角即可分享
微信分享提示