linux redhat安装git
注:写下该文章是因为在linux redhat中安装时百度的结果是apt-get install git但是在使用过程中没有apt-get也没有找到直接的安装包。如果你的系统适合更方便的安装方式请你选择,当没有选择时下列方法可以通过代码直接生成。
由于git安装需要第三方库的支持,所以需要安装zlib,curl,openssl
1. 安装zlib
在官网http://www.zlib.net中找到最新安装包右键获取下载链接
依次执行如下命令:
wget http://www.zlib.net/zlib-1.2.11.tar.gz
tar -xvzf zlib-1.2.11.tar.gz
cd zlib-*
./configure --prefix=/usr/local
make
make install#如果非root用户需要使用sudo make install
2.安装openssl
在官网https://www.openssl.org/source/中找到最新安装包右键获取下载链接
右键获取下载链接
依次执行如下命令:
wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz
tar -xvzf openssl-1.1.0f.tar.gz
cd openssl-*
./config --prefix=/usr/local
make
make install#如果非root用户需要使用sudo make install
在root用户下执行
ln -s /usr/local/lib64/libssl.so.1.1 /usr/lib64/libssl.so.1.1
ln -s /usr/local/lib64/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1
3.安装curl
在官网https://curl.haxx.se/download.html中找到最新安装包右键获取下载链接
右键获取下载链接
依次执行如下命令:
wget https://curl.haxx.se/download/curl-7.56.1.tar.gz
tar-xvzf curl-7.56.1.tar.gz
cd curl-*
./config --prefix=/usr/local –-with-ssl=/usr/local
make
make install#如果非root用户需要使用sudo make install
安装完后执行命令:curl–V
如果打印出了https则正常,否则会影响后续git的使用
4.安装git
在官网https://www.kernel.org/pub/software/scm/git/中找到最新安装包右键获取下载链接
右键获取下载链接
依次执行如下命令:
wget http://kernel.org/pub/software/scm/git/git-1.7.2.3.tar.gz
tar -xvzf git-1.7.2.3.tar.gz
cd git-*
./configure --prefix=/usr/local
make
make install#如果非root用户需要使用sudo make install
下载代码命令:git clone 路径