zoukankan      html  css  js  c++  java
  • 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
    
  • 相关阅读:
    POJ 2159 Ancient Cipher 难度:0
    POJ 3299 Humidex 难度:0
    POJ 1503 Integer Inquiry 大数 难度:0
    POJ 2262 Goldbach's Conjecture 数学常识 难度:0
    POJ 1083 Moving Tables 思路 难度:0
    PAT 甲级 1126 Eulerian Path
    Java 大数运算
    PAT 甲级 1010 Radix
    PAT 甲级 1137 Final Grading
    PAT 甲级 1064 Complete Binary Search Tree
  • 原文地址:https://www.cnblogs.com/inkyi/p/14537680.html
Copyright © 2011-2022 走看看