Linux安装源码git

1、下载、解压、安装依赖软件包、编译

wget https://github.com/git/git/archive/refs/tags/v2.34.1.zip
unzip v2.34.1.zip
cd git-2.34.1/
yum -y install gcc openssl-devel.x86_64 curl-devel expat-devel libtool
yum -y remove git
cd /usr/local/src/
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz
tar -zxvf libiconv-1.15.tar.gz 
cd libiconv-1.15/
./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
cd /opt/git-2.34.1/
make configure
./configure --prefix=/usr/local/git --with-iconv=/usr/local/libiconv
make && make install

2、配置环境变量

echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profilr
source /etc/profilr

3、查看git是否成功安装

git --version

你可能感兴趣的:(Linux安装源码git)