CentOS7.8マシンでgitv1.8を実行しています。 gitを最新バージョンにアップグレードしたいのですが。コマンドyum install git
常にv1.8がすでにインストールされており、先に進むことができないことを通知します。以下は私のサーバーの詳細のスナップショットです。
[root@loyalty ~]# yum install git Package git-1.8.3.1-23.el7_8.x86_64 already installed and latest version Nothing to do [root@loyalty ~]# git --version git version 1.8.3.1 [root@loyalty ~]# more /etc/redhat-release CentOS Linux release 7.8.2003 (Core)
CentOSでgitを最新バージョンにアップグレードする方法
古いgitを削除する
まず、古いgitを削除する必要があります。
[root@loyalty ~]# yum remove git-* Removed: git.x86_64 0:1.8.3.1-23.el7_8 Dependency Removed: gettext-devel.x86_64 0:0.19.8.1-3.el7 intltool.noarch 0:0.50.2-7.el7 perl-Git.noarch 0:1.8.3.1-23.el7_8 Complete!
リポジトリのインストール
Gitの公式サイトで発表されたサードパーティのリポジトリであるIUSリポジトリをインストールします。
[root@loyalty ~]# yum install https://repo.ius.io/ius-release-el7.rpm https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
[root@loyalty ~]# yum list git git.x86_64 1.8.3.1-23.el7_8 base git222.x86_64 2.22.5-1.el7.ius ius git224.x86_64 2.24.4-1.el7.ius ius> IUSリポジトリにはGitv2.24が含まれています
ただし、IUSリポジトリにはgitバージョン2.24が含まれており、現在の最新バージョンは2.34です!
最新バージョンのgitv2.34をインストールするには、エンドポイントから別のサードパーティリポジトリを使用できます。
[root@loyalty ~]# yum -y install https://packages.endpointdev.com/rhel/7/os/x86_ 64/endpoint-repo.x86_64.rpm Installed: endpoint-repo.x86_64 0:1.10-1 Complete!
[root@loyalty ~]# yum list git git.x86_64 1.8.3.1-23.el7_8 base git222.x86_64 2.22.5-1.el7.ius ius git224.x86_64 2.24.4-1.el7.ius ius git.x86_64 2.34.1-1.ep7 endpoint外部リポジトリを信用しないでください!
これは、外部のサードパーティリポジトリを使用することがどれほど悪いかを説明する記事です。本番サーバーでは、標準/公式リポジトリのみを使用することをお勧めします。ただし、それが開発サーバーであり、少しリスクを冒す準備ができている場合は、サードパーティのリポジトリを試してください。
gitをインストール
[root@loyalty ~]# yum install git Installed: git.x86_64 0:2.34.1-1.ep7 Dependency Installed: git-core.x86_64 0:2.34.1-1.ep7 git-core-doc.noarch 0:2.34.1-1.ep7 pcre2.x86_64 0:10.23-2.el7 perl-Git.noarch 0:2.34.1-1.ep7 Complete!
gitバージョンを確認する
[root@loyalty ~]# git --version git version 2.34.1