Loading... 双十一前后又购入了两三台服务器,跟着上次写的[一个新的ContOS服务器折腾过程](https://www.seesharper.cn/archives/3.html)操作一番之后,环境问题基本就解决了,不过在使用某个软件(虽然后来也不用那个了)的时候,被要求安装2.x的Git,但是在CentOs7环境下,Git的最新版本只有`1.8.3.1`,而Git官方的版本已经更新到`2.33.1`了,有些软件也需要2.X版本的Git才能支持,所以需要更新。 ### 1.查看当前仓库里的版本信息 ### yum search git ![当前Git包][1] ### 2.安装`IUS`软件源 ### 查看[官方文档](https://git-scm.com/download/linux),可以看到一段说明如何去更新新版本Git: > ### Red Hat Enterprise Linux, Oracle Linux, CentOS, Scientific Linux, et al. > RHEL and derivatives typically ship older versions of git. You can [download a tarball](https://www.kernel.org/pub/software/scm/git/) and build from source, or use a 3rd-party repository such as [the IUS Community Project](https://ius.io/) to obtain a more recent version of git. 前往`IUS`社区,按照提示安装即可。 yum install \ https://repo.ius.io/ius-release-el7.rpm \ https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm ### 3.再次查看当前仓库里的版本信息 ### yum search git ![安装IUS之后包列表][2] ### 4.卸载原有Git,如未安装则跳过 ### yum remove git -y ### 5.安装新版本 ### yum install git224 -y ### 6.查看安装结果 ### git --version ![git安装结果][3] [1]: https://cdn.liudank.cn/youzy/image-20211104144316379.png [2]: https://cdn.liudank.cn/youzy/image-20211104144421484.png [3]: https://cdn.liudank.cn/youzy/image-20211104144632428.png 最后修改:2021 年 12 月 07 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 0 如果觉得我的文章对你有用,请随意赞赏