LoginSignup
59
36

More than 3 years have passed since last update.

CentOS7 Git2系をyumからインストールする。

Last updated at Posted at 2018-05-20

背景

CentOS7に標準搭載されているGitは未だに1系のバージョンが入っています。
サーバーの環境をする際に最新のGitをインストールします。

私の検索の仕方が悪いのか、ソースからビルドしてインストールする方法はたくさん見つかるものの、
yumからインストールする方法はどうしても見つけられなかったので自分で試すことにしました。

yum からインストールする

# yum -y remove git
# yum -y install https://centos7.iuscommunity.org/ius-release.rpm
# yum -y install git2u yum-utils
# yum-config-manager --disable ius

# git --version
git version 2.17.0

ソースからインストールする

一応、ソースからインストールする方法も書いておきます。

# yum -y remove git

# yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker

# GITVERSION="2.17.0" &&
wget https://www.kernel.org/pub/software/scm/git/git-$GITVERSION.tar.gz &&
tar -zxf git-$GITVERSION.tar.gz &&
cd git-$GITVERSION &&
make prefix=/usr/local all &&
make prefix=/usr/local install &&
cd ../ &&
rm -rf git-$GITVERSION* &&
unset GITVERSION

ソースからビルドする方法はインストールするのに時間がめっちゃかかります。

補足

https://ius.io
IUSリポジトリに新しいRPMパッケージが作成されているそうです。

59
36
1

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
59
36