AmazonLinux2023でGitLabCEのリポジトリを2022から2023に更新する

はじめに

AmazonLinux2023にインストールした際に、GitLabの命名がAmazonLinux2022だった名残で、リポジトリを更新しないといけなかった。
その時の備忘録を書いておく。

環境

AmazonLinux 2023

準備

GitLabをすでにAWSにインストール済み。

インストール手順

  1. GitLab パッケージ リポジトリを追加し、パッケージをインストールする
wget https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh
sudo bash script.rpm.sh os=amzn dist=2022
  1. GitLabのインストール
sudo dnf install -y gitlab-ce

確認と更新

リポジトリの確認

まずは、現在のリポジトリを確認する。

dnf repolist --all
repo id                                                                           repo name                                                                                                 status
amazonlinux                                                                       Amazon Linux 2023 repository                                                                              enabled
amazonlinux-debuginfo                                                             Amazon Linux 2023 repository - Debug                                                                      disabled
amazonlinux-source                                                                Amazon Linux 2023 repository - Source packages                                                            disabled
gitlab_gitlab-ce                                                                  gitlab_gitlab-ce                                                                                          enabled
gitlab_gitlab-ce-source                                                           gitlab_gitlab-ce-source                                                                                   enabled
dnf repolist -v
Repo-id            : gitlab_gitlab-ce
Repo-name          : gitlab_gitlab-ce
Repo-updated       : Thu Aug 31 17:38:39 2023
Repo-pkgs          : 53
Repo-available-pkgs: 53
Repo-size          : 64 G
Repo-baseurl       : https://packages.gitlab.com/gitlab/gitlab-ce/amazon/2022/x86_64
Repo-expire        : 300 second(s) (last: Fri Sep  8 12:56:07 2023)
Repo-filename      : /etc/yum.repos.d/gitlab_gitlab-ce.repo

Repo-id            : gitlab_gitlab-ce-source
Repo-name          : gitlab_gitlab-ce-source
Repo-updated       : Mon Apr  6 23:02:30 2020
Repo-pkgs          : 0
Repo-available-pkgs: 0
Repo-size          : 0
Repo-baseurl       : https://packages.gitlab.com/gitlab/gitlab-ce/amazon/2022/SRPMS
Repo-expire        : 300 second(s) (last: Fri Sep  8 12:56:10 2023)
Repo-filename      : /etc/yum.repos.d/gitlab_gitlab-ce.repo
Total packages: 15028
dnf search gitlab-ce --showduplicates

下記のバージョンが利用可能。

Last metadata expiration check: 0:00:52 ago on Fri Sep  8 12:56:10 2023.
================================================================================= Name Exactly Matched: gitlab-ce ==================================================================================
gitlab-ce-15.10.0-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.10.1-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.10.2-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.10.3-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.10.4-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.10.5-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.10.6-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.10.7-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.10.8-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.11.0-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.11.1-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.11.10-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.11.11-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.11.12-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.11.13-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.11.2-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.11.3-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.11.4-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.11.5-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.11.6-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.11.7-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.11.8-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.11.9-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.9.0-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.9.1-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.9.2-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.9.3-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.9.4-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.9.5-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.9.6-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.9.7-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-15.9.8-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.0.0-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.0.1-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.0.2-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.0.3-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.0.4-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.0.5-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.0.6-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.0.7-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.0.8-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.1.0-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.1.1-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.1.2-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.1.3-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.1.4-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.1.5-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.2.0-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.2.1-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.2.2-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.2.3-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.2.4-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.2.5-ce.0.amazon2022.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)

リポジトリの更新

wget https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh
sudo bash script.rpm.sh os=amzn dist=2023
dnf repolist -v

20222023 になっている。

Repo-id            : gitlab_gitlab-ce
Repo-name          : gitlab_gitlab-ce
Repo-updated       : Tue Sep  5 15:33:12 2023
Repo-pkgs          : 3
Repo-available-pkgs: 3
Repo-size          : 3.6 G
Repo-baseurl       : https://packages.gitlab.com/gitlab/gitlab-ce/amazon/2023/x86_64
Repo-expire        : 300 second(s) (last: Fri Sep  8 12:58:03 2023)
Repo-filename      : /etc/yum.repos.d/gitlab_gitlab-ce.repo

Repo-id            : gitlab_gitlab-ce-source
Repo-name          : gitlab_gitlab-ce-source
Repo-updated       : Mon Apr  6 23:02:30 2020
Repo-pkgs          : 0
Repo-available-pkgs: 0
Repo-size          : 0
Repo-baseurl       : https://packages.gitlab.com/gitlab/gitlab-ce/amazon/2023/SRPMS
Repo-expire        : 300 second(s) (last: Fri Sep  8 12:58:05 2023)
Repo-filename      : /etc/yum.repos.d/gitlab_gitlab-ce.repo
Total packages: 14978
dnf search gitlab-ce --showduplicates
Last metadata expiration check: 0:00:44 ago on Fri Sep  8 12:58:05 2023.
================================================================================= Name Exactly Matched: gitlab-ce ==================================================================================
gitlab-ce-16.3.0-ce.0.amazon2023.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.3.1-ce.0.amazon2023.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)
gitlab-ce-16.3.2-ce.0.amazon2023.x86_64 : GitLab Community Edition (including NGINX, Postgres, Redis)

新しいバージョンが利用できるようになっている↑

これで

dnf install -y gitlab-ce

すれば最新が入る。

参考

おわりに

業務で利用しているGitLabを最新にしようとしたら、最新が入らなかったのでなんでだろう~と思ったら amzn2022 のリポジトリから入れているのを見たので調べてみた。
2022 になっていた期間は短いのでハマる人は少なそう。

Hugo で構築されています。
テーマ StackJimmy によって設計されています。