LoginSignup
9
10

More than 3 years have passed since last update.

CentOS7にGit2系をyumでインストール

Posted at

やりたいこと

CentOS7で普通にyumでGitをインストールすると、1.8系がインストールされます。
2系をインストールしたくていくつかのサイトを検索したのですが、書かれたままの方法だと実現できなかったので、記録のために残します。

環境

CentOS 7.8

インストール

IUSリポジトリを登録

まず、IUSリポジトリを登録します。
検索した記事だと以下のコマンドがよく書かれているのですが、Cannot open で上手くいきませんでした。

# yum -y install https://centos7.iuscommunity.org/ius-release.rpm
Loaded plugins: fastestmirror
Cannot open: https://centos7.iuscommunity.org/ius-release.rpm. Skipping.
Error: Nothing to do

IUSのサイトを開き、セットアップ手順通りに実施したところ、上手くいきました。
https://ius.io/setup

# yum install \
https://repo.ius.io/ius-release-el7.rpm \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Gitのインストール

それではGitをインストールします。
以下のコマンドでインストールしようとしたところ、依存関係のエラーが出ました。

# yum install git --enablerepo=ius --disablerepo=base,epel,extras,updates
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package git224.x86_64 0:2.24.2-1.el7.ius will be installed
--> Processing Dependency: perl-Git = 2.24.2-1.el7.ius for package: git224-2.24.2-1.el7.ius.x86_64
--> Processing Dependency: git-core-doc = 2.24.2-1.el7.ius for package: git224-2.24.2-1.el7.ius.x86_64
--> Processing Dependency: git-core = 2.24.2-1.el7.ius for package: git224-2.24.2-1.el7.ius.x86_64
--> Processing Dependency: emacs-filesystem >= 24.3 for package: git224-2.24.2-1.el7.ius.x86_64
--> Processing Dependency: perl(Term::ReadKey) for package: git224-2.24.2-1.el7.ius.x86_64
--> Processing Dependency: perl(Git::I18N) for package: git224-2.24.2-1.el7.ius.x86_64
--> Processing Dependency: perl(Git) for package: git224-2.24.2-1.el7.ius.x86_64
--> Processing Dependency: libsecret-1.so.0()(64bit) for package: git224-2.24.2-1.el7.ius.x86_64
--> Running transaction check
---> Package git224.x86_64 0:2.24.2-1.el7.ius will be installed
--> Processing Dependency: emacs-filesystem >= 24.3 for package: git224-2.24.2-1.el7.ius.x86_64
--> Processing Dependency: perl(Term::ReadKey) for package: git224-2.24.2-1.el7.ius.x86_64
--> Processing Dependency: libsecret-1.so.0()(64bit) for package: git224-2.24.2-1.el7.ius.x86_64
---> Package git224-core.x86_64 0:2.24.2-1.el7.ius will be installed
--> Processing Dependency: libpcre2-8.so.0()(64bit) for package: git224-core-2.24.2-1.el7.ius.x86_64
---> Package git224-core-doc.noarch 0:2.24.2-1.el7.ius will be installed
---> Package git224-perl-Git.noarch 0:2.24.2-1.el7.ius will be installed
--> Processing Dependency: perl(Error) for package: git224-perl-Git-2.24.2-1.el7.ius.noarch
--> Finished Dependency Resolution
Error: Package: git224-2.24.2-1.el7.ius.x86_64 (ius)
           Requires: emacs-filesystem >= 24.3
Error: Package: git224-2.24.2-1.el7.ius.x86_64 (ius)
           Requires: libsecret-1.so.0()(64bit)
Error: Package: git224-2.24.2-1.el7.ius.x86_64 (ius)
           Requires: perl(Term::ReadKey)
Error: Package: git224-perl-Git-2.24.2-1.el7.ius.noarch (ius)
           Requires: perl(Error)
Error: Package: git224-core-2.24.2-1.el7.ius.x86_64 (ius)
           Requires: libpcre2-8.so.0()(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

以下のコマンドで依存パッケージも含めてインストールします。

# yum install git224-2.24.2-1.el7.ius.x86_64

途中でkeyのインストールが聞かれるので y を押します。

 Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-IUS-7
Importing GPG key 0x4B274DF2:
 Userid     : "IUS (7) <dev@ius.io>"
 Fingerprint: c958 7a09 a11f d706 4f0c a0f4 e558 0725 4b27 4df2
 Package    : ius-release-2-1.el7.ius.noarch (@/ius-release-el7)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-IUS-7

is this ok [y/N]:

インストールが成功しました。バージョンを確認します。

# git version
git version 2.24.2

IUSリポジトリを無効にしたい場合は、以下のコマンドを実行します。

# yum-config-manager --disable ius
9
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
10