1
0

More than 3 years have passed since last update.

CentOS 8(CentOS 8 Stream)にdnfでGoをインストールする

Last updated at Posted at 2021-02-05

What's?

CentOS 8に、Goをdnfでインストールしたい、ということで。

結果的に、CentOS 8 Streamに変換することになりましたが。

環境

確認した環境は、こちらです。

$ cat /etc/redhat-release
CentOS Linux release 8.3.2011


$ uname -srvmpio
Linux 4.18.0-240.10.1.el8_3.x86_64 #1 SMP Mon Jan 18 17:05:51 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

CentOS 8にインストールできるGoの情報

Goのダウンロードページには、Linux向けのtar.gzファイルが取得できるようになっています。

Download and install

一方で、GoのGitHubリポジトリのWikiには各プラットフォーム向けの情報があるのですが、ここにCentOSやRHELのものはありません。

Platform Specific Information

image.png

とりあえず、現時点でのCentOS 8でGoのパッケージ情報を見てみます。

$ sudo dnf info golang
Last metadata expiration check: 0:05:50 ago on 2021年02月05日 03時23分42秒.
Available Packages
Name         : golang
Version      : 1.14.12
Release      : 1.module_el8.3.0+605+410c5674
Architecture : x86_64
Size         : 703 k
Source       : golang-1.14.12-1.module_el8.3.0+605+410c5674.src.rpm
Repository   : appstream
Summary      : The Go Programming Language
URL          : http://golang.org/
License      : BSD and Public Domain
Description  : The Go Programming Language.

Go 1.14ですね。現在のGoが1.15.8なので、もう少し新しい方がいいかなと。

ここで、rpmfind.netgolangを探してみます。

RPM resource golang

よーく見ると、CentOS 8 Streamに変換すればGo 1.15が入りそうです…。

CentOS 8 StreamにGoをインストールする

というわけで、CentOS 8をCentOS 8 Streamに変換します。

$ sudo dnf install centos-release-stream
$ sudo dnf swap centos-{linux,stream}-repos
$ sudo dnf distro-sync

パッケージのインストールを実行し、しばらく待つとCentOS 8 Streamになります。

$ cat /etc/redhat-release 
CentOS Stream release 8


$ uname -srvmpio
Linux 4.18.0-269.el8.x86_64 #1 SMP Tue Jan 12 17:55:05 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

golangのパッケージの情報が、1.15.5になりました。これくらいならよいでしょう。

$ sudo dnf info golang
メタデータの期限切れの最終確認: 0:07:12 時間前の 2021年02月05日 03時38分51秒 に実施しました。
利用可能なパッケージ
名前         : golang
バージョン   : 1.15.5
リリース     : 1.module_el8.4.0+586+97b59638
Arch         : x86_64
サイズ       : 707 k
ソース       : golang-1.15.5-1.module_el8.4.0+586+97b59638.src.rpm
リポジトリー : appstream
概要         : The Go Programming Language
URL          : http://golang.org/
ライセンス   : BSD and Public Domain
説明         : The Go Programming Language.

インストール。

$ sudo dnf install golang

確認。

$ go version
go version go1.15.5 linux/amd64

というわけで、CentOS 8にGoをインストールするつもりが、dnfを使ってインストールする場合に1.15を選ぼうとするとCentOS 8 Streamになりました、と。

1
0
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
1
0