不明原因, ius已经拉胯, 不支持git2 -- 2023.04.03
用ius的发行库来搞, 粘贴复制命令如下:
yum -y install epel-release cat > /etc/yum.repos.d/ius.repo <<-EOF [ius] name = IUS for Enterprise Linux 7 - $basearch baseurl = https://repo.ius.io/7/$basearch/ enabled = 1 repo_gpgcheck = 0 gpgcheck = 1 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-IUS-7 [ius-debuginfo] name = IUS for Enterprise Linux 7 - $basearch - Debug baseurl = https://repo.ius.io/7/$basearch/debug/ enabled = 0 repo_gpgcheck = 0 gpgcheck = 1 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-IUS-7 [ius-source] name = IUS for Enterprise Linux 7 - Source baseurl = https://repo.ius.io/7/src/ enabled = 0 repo_gpgcheck = 0 gpgcheck = 1 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-IUS-7 EOF
有时候会发现$basearch失效, 导致后续的404 bug.
那么只能把上述命令改为, 假设你服务器架构是x86_64的:
cat > /etc/yum.repos.d/ius.repo <<-EOF [ius] name = IUS for Enterprise Linux 7 - x86_64 baseurl = https://repo.ius.io/7/x86_64/ enabled = 1 repo_gpgcheck = 0 gpgcheck = 1 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-IUS-7 [ius-debuginfo] name = IUS for Enterprise Linux 7 - x86_64 - Debug baseurl = https://repo.ius.io/7/x86_64/debug/ enabled = 0 repo_gpgcheck = 0 gpgcheck = 1 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-IUS-7 [ius-source] name = IUS for Enterprise Linux 7 - Source baseurl = https://repo.ius.io/7/src/ enabled = 0 repo_gpgcheck = 0 gpgcheck = 1 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-IUS-7 EOF
我想知道服务器架构怎么看?
rpm -qi centos-release
搜索yum现有库里的git 2.x版本安装包名
yum search git
看控制台返回啥包名?
根据包名安装
yum install -y gitxxxx
完工
第二种方法: 手动安装git
官方下载(举例版本号是2.40.0):
有时候github官网的鬼子会脑抽去改地址, 这个时候需要你找找, 或者在下方留言纠错。
https://github.com/git/git/releases/tag/v2.40.0
下载里面的source code包, 把.tar.gz的down下来
放到服务器上解压:
tar -zxvf git-2.40.0.tar.gz
安装依赖包:
yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel yum install -y gcc perl-ExtUtils-MakeMaker
升级 解决 SSL connect error
yum update -y nss curl libcurl mkdir -p /usr/local/git make prefix=/usr/local/git all make prefix=/usr/local/git install
编辑profile:
vi /etc/profile
在里面写入:
export PATH=$PATH:/usr/local/git/bin
保存文件, 让profile立即生效:
source /etc/profile