そういうのがいいブログ

SIerで働く30代サラリーマンSEがインフラエンジニアに憧れてLinux・クラウド・AWSの勉強をするブログ

CentOS8.2にGitLab13.5 (Community Edition)インストール手順

※[PR]当ブログの記事の中にはプロモーションが含まれています。

CentOS8にGitLab13インストール

・CentOS8にGitLab 13.5 (Community Edition)をインストールしたい。
・ローカルネットワーク内でGitLabサーバを構築したい。
・具体的な手順を教えてほしい。

こういった疑問に答えます。

本記事の内容

  1. CentOS8.2にGitLab 13.5 (Community Edition)をインストールする手順

この記事を書いている私は、某SIerに勤務しながら、
WEB系エンジニア・インフラエンジニアに憧れて、プログラミングおよびインフラ技術の勉強をしています。

こういった私が、解説していきます。

私が実機で試したコマンドや画像を載せて書いています。
記事の信頼性担保に繋がると思います。

CentOS8.2にGitLab 13.5 (Community Edition)をインストールする手順

参考サイト

CentOS8にGitLab13インストール

≫ GitLab公式サイト(英語) https://about.gitlab.com/install/ 

≫ GitLab日本語情報サイト(個人サイト) https://www.gitlab.jp/install/ 

基本的には、上記サイトにあるコマンドを真似して実行していくだけでOKです。

依存パッケージがインストールされているか確認

dnf install curl policycoreutils openssh-server openssh-clients
[root@SV-MARS ~]# dnf install curl policycoreutils openssh-server openssh-clients
メタデータの期限切れの最終確認: 1:12:07 時間前の 20201024140733秒 に実施しました。
パッケージ curl-7.61.1-12.el8.x86_64 はすでにインストールされています。
パッケージ policycoreutils-2.9-9.el8.x86_64 はすでにインストールされています。
パッケージ openssh-server-8.0p1-4.el8_1.x86_64 はすでにインストールされています。
パッケージ openssh-clients-8.0p1-4.el8_1.x86_64 はすでにインストールされています。
依存関係が解決しました。
行うべきことはありません。
完了しました!

SSHサービスの開始

systemctl enable sshd
systemctl start sshd
systemctl status sshd
[root@SV-MARS ~]# systemctl enable sshd
[root@SV-MARS ~]# systemctl start sshd
[root@SV-MARS ~]# systemctl status sshd
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2020-10-24 14:29:36 JST; 51min ago
     Docs: man:sshd(8)
           man:sshd_config(5)
 Main PID: 1136 (sshd)
    Tasks: 1 (limit: 11095)
   Memory: 6.1M
   CGroup: /system.slice/sshd.service
           mq1136 /usr/sbin/sshd -D -oCiphers=aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes256-cb>

1024 14:29:35 SV-MARS systemd[1]: Starting OpenSSH server daemon...
1024 14:29:36 SV-MARS sshd[1136]: Server listening on 0.0.0.0 port 22.
1024 14:29:36 SV-MARS sshd[1136]: Server listening on :: port 22.
1024 14:29:36 SV-MARS systemd[1]: Started OpenSSH server daemon.
1024 15:19:08 SV-MARS sshd[1800]: Accepted password for root from 192.168.1.101 port 57456 ssh2
1024 15:19:08 SV-MARS sshd[1800]: pam_unix(sshd:session): session opened for user root by (uid=0)

ファイアーウォールの設定(HTTPとHTTPSを追加)

現在のファイアーウォールの設定を確認

firewall-cmd --list-all
[root@SV-MARS ~]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens192
  sources:
  services: cockpit dhcpv6-client
  ports:
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

ファイアーウォールにHTTPとHTTPSの許可を追加

firewall-cmd --add-service=http --permanent
firewall-cmd --add-service=https --permanent
firewall-cmd --reload
[root@SV-MARS ~]# firewall-cmd --add-service=http --permanent
success
[root@SV-MARS ~]# firewall-cmd --add-service=https --permanent
success
[root@SV-MARS ~]# firewall-cmd --reload
success

変更後のファイアーウォールの設定を確認

firewall-cmd --list-all
[root@SV-MARS ~]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens192
  sources:
  services: cockpit dhcpv6-client http https
  ports:
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

GitLabパッケージのリポジトリへの追加

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash
[root@SV-MARS ~]# curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash
Detected operating system as centos/8.
Checking for curl...
Detected curl...
Downloading repository file: https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/config_file.repo?os=centos&dist=8&source=script
done.
Installing yum-utils...
gitlab_gitlab-ce-source                                                                 299  B/s | 862  B     00:02
gitlab_gitlab-ce-source                                                                 3.5 kB/s | 3.1 kB     00:00
GPG 鍵 0x51312F3F をインポート中:
 Userid     : "GitLab B.V. (package repository signing key) <packages@gitlab.com>"
 Fingerprint: F640 3F65 44A3 8863 DAA0 B6E0 3F01 618A 5131 2F3F
 From       : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
gitlab_gitlab-ce-source                                                                 5.1 kB/s | 3.8 kB     00:00
GPG 鍵 0xF27EAB47 をインポート中:
 Userid     : "GitLab, Inc. <support@gitlab.com>"
 Fingerprint: DBEF 8977 4DDB 9EB3 7D9F C3A0 3CFC F9BA F27E AB47
 From       : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
gitlab_gitlab-ce-source                                                                  70  B/s | 296  B     00:04
依存関係が解決しました。
========================================================================================================================
 パッケージ                  アーキテクチャー         バージョン                         リポジトリー             サイズ
========================================================================================================================
インストール中:
 yum-utils                   noarch                   4.0.12-4.el8_2                     BaseOS                    66 k

トランザクションの概要
========================================================================================================================
インストール  1 パッケージ

ダウンロードサイズの合計: 66 k
インストール済みのサイズ: 20 k
パッケージのダウンロード:
yum-utils-4.0.12-4.el8_2.noarch.rpm                                                     695 kB/s |  66 kB     00:00
------------------------------------------------------------------------------------------------------------------------
合計                                                                                    153 kB/s |  66 kB     00:00
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
  準備              :                                                                                               1/1
  インストール中    : yum-utils-4.0.12-4.el8_2.noarch                                                               1/1
  scriptlet の実行中: yum-utils-4.0.12-4.el8_2.noarch                                                               1/1
  検証              : yum-utils-4.0.12-4.el8_2.noarch                                                               1/1

インストール済み:
  yum-utils-4.0.12-4.el8_2.noarch

完了しました!
Generating yum cache for gitlab_gitlab-ce...
GPG 鍵 0x51312F3F をインポート中:
 Userid     : "GitLab B.V. (package repository signing key) <packages@gitlab.com>"
 Fingerprint: F640 3F65 44A3 8863 DAA0 B6E0 3F01 618A 5131 2F3F
 From       : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
GPG 鍵 0xF27EAB47 をインポート中:
 Userid     : "GitLab, Inc. <support@gitlab.com>"
 Fingerprint: DBEF 8977 4DDB 9EB3 7D9F C3A0 3CFC F9BA F27E AB47
 From       : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
Generating yum cache for gitlab_gitlab-ce-source...

The repository is setup! You can now install packages.

GitLabパッケージをインストール

EXTERNAL_URL="http://gitlab.example.com" dnf install gitlab-ce

http://gitlab.example.com の部分は自分の環境に合わせて変更します。

[root@SV-MARS ~]# EXTERNAL_URL="http://gitlab.sv-mars.com" dnf install gitlab-ce
メタデータの期限切れの最終確認: 0:03:01 時間前の 20201024152700秒 に実施しました。
依存関係が解決しました。
========================================================================================================================
 パッケージ                          Arch          バージョン                             リポジトリー            サイズ
========================================================================================================================
インストール中:
 gitlab-ce                           x86_64        13.5.1-ce.0.el8                        gitlab_gitlab-ce        803 M
依存関係のインストール中:
 checkpolicy                         x86_64        2.9-1.el8                              BaseOS                  348 k
 policycoreutils-python-utils        noarch        2.9-9.el8                              BaseOS                  251 k
 python3-audit                       x86_64        3.0-0.17.20191104git1c2f876.el8        BaseOS                   86 k
 python3-libsemanage                 x86_64        2.9-2.el8                              BaseOS                  127 k
 python3-policycoreutils             noarch        2.9-9.el8                              BaseOS                  2.2 M
 python3-setools                     x86_64        4.2.2-2.el8                            BaseOS                  601 k

トランザクションの概要
========================================================================================================================
インストール  7 パッケージ

ダウンロードサイズの合計: 807 M
インストール済みのサイズ: 1.7 G
これでよろしいですか? [y/N]: y
パッケージのダウンロード:
(1/7): python3-audit-3.0-0.17.20191104git1c2f876.el8.x86_64.rpm                         788 kB/s |  86 kB     00:00
(2/7): policycoreutils-python-utils-2.9-9.el8.noarch.rpm                                1.9 MB/s | 251 kB     00:00
(3/7): python3-libsemanage-2.9-2.el8.x86_64.rpm                                         2.4 MB/s | 127 kB     00:00
(4/7): checkpolicy-2.9-1.el8.x86_64.rpm                                                 1.8 MB/s | 348 kB     00:00
(5/7): python3-policycoreutils-2.9-9.el8.noarch.rpm                                     5.6 MB/s | 2.2 MB     00:00
(6/7): python3-setools-4.2.2-2.el8.x86_64.rpm                                           1.6 MB/s | 601 kB     00:00
(7/7): gitlab-ce-13.5.1-ce.0.el8.x86_64.rpm                                             9.0 MB/s | 803 MB     01:28
------------------------------------------------------------------------------------------------------------------------
合計                                                                                    8.9 MB/s | 807 MB     01:30
警告: /var/cache/dnf/gitlab_gitlab-ce-7b189aab552daa48/packages/gitlab-ce-13.5.1-ce.0.el8.x86_64.rpm: ヘッダー V4 RSA/SHA256 Signature、鍵 ID f27eab47: NOKEY
gitlab_gitlab-ce                                                                        3.6 kB/s | 3.1 kB     00:00
GPG 鍵 0x51312F3F をインポート中:
 Userid     : "GitLab B.V. (package repository signing key) <packages@gitlab.com>"
 Fingerprint: F640 3F65 44A3 8863 DAA0 B6E0 3F01 618A 5131 2F3F
 From       : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
これでよろしいですか? [y/N]: y
鍵のインポートに成功しました
gitlab_gitlab-ce                                                                        5.1 kB/s | 3.8 kB     00:00
GPG 鍵 0xF27EAB47 をインポート中:
 Userid     : "GitLab, Inc. <support@gitlab.com>"
 Fingerprint: DBEF 8977 4DDB 9EB3 7D9F C3A0 3CFC F9BA F27E AB47
 From       : https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
これでよろしいですか? [y/N]: y
鍵のインポートに成功しました
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
  準備              :                                                                                               1/1
  インストール中    : python3-setools-4.2.2-2.el8.x86_64                                                            1/7
  インストール中    : python3-libsemanage-2.9-2.el8.x86_64                                                          2/7
  インストール中    : python3-audit-3.0-0.17.20191104git1c2f876.el8.x86_64                                          3/7
  インストール中    : checkpolicy-2.9-1.el8.x86_64                                                                  4/7
  インストール中    : python3-policycoreutils-2.9-9.el8.noarch                                                      5/7
  インストール中    : policycoreutils-python-utils-2.9-9.el8.noarch                                                 6/7
  scriptlet の実行中: gitlab-ce-13.5.1-ce.0.el8.x86_64                                                              7/7
  インストール中    : gitlab-ce-13.5.1-ce.0.el8.x86_64                                                              7/7
  scriptlet の実行中: gitlab-ce-13.5.1-ce.0.el8.x86_64                                                              7/7
Starting Chef Infra Client, version 15.14.0
resolving cookbooks for run list: ["gitlab"]
Synchronizing Cookbooks:
Running handlers:
Running handlers complete
Chef Infra Client finished, 569/1538 resources updated in 21 minutes 18 seconds
gitlab Reconfigured!

       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********
   ,,,,,,,,,***********,,,,,,,,,
  ,,,,,,,,,,,*********,,,,,,,,,,,
  .,,,,,,,,,,,*******,,,,,,,,,,,,
      ,,,,,,,,,*****,,,,,,,,,.
         ,,,,,,,****,,,,,,
            .,,,***,,,,
                ,*,.



     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/


Thank you for installing GitLab!
GitLab should be available at http://gitlab.sv-mars.com

For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md


  検証              : checkpolicy-2.9-1.el8.x86_64                                                                  1/7
  検証              : policycoreutils-python-utils-2.9-9.el8.noarch                                                 2/7
  検証              : python3-audit-3.0-0.17.20191104git1c2f876.el8.x86_64                                          3/7
  検証              : python3-libsemanage-2.9-2.el8.x86_64                                                          4/7
  検証              : python3-policycoreutils-2.9-9.el8.noarch                                                      5/7
  検証              : python3-setools-4.2.2-2.el8.x86_64                                                            6/7
  検証              : gitlab-ce-13.5.1-ce.0.el8.x86_64                                                              7/7

インストール済み:
  checkpolicy-2.9-1.el8.x86_64                            gitlab-ce-13.5.1-ce.0.el8.x86_64
  policycoreutils-python-utils-2.9-9.el8.noarch           python3-audit-3.0-0.17.20191104git1c2f876.el8.x86_64
  python3-libsemanage-2.9-2.el8.x86_64                    python3-policycoreutils-2.9-9.el8.noarch
  python3-setools-4.2.2-2.el8.x86_64

完了しました!

GitLab インストール後の初回ログイン

GitLabインストール直後の初回ログインでrootユーザのパスワード設定

インストール時に指定したURLにアクセスします。

http://gitlab.example.com

CentOS8にGitLab13インストール

「rootユーザー」のパスワードを登録します。

CentOS8にGitLab13インストール

rootユーザーでサインイン

CentOS8にGitLab13インストール

rootユーザーのパスワードを入力して「Sign in」ボタンをクリック。

CentOS8にGitLab13インストール

サインインできました。

CentOS8にGitLab13インストール

日本語化

アカウントのマークから「Settings」をクリック。

CentOS8にGitLab13インストール

左のメニューから「Preferences」をクリック。

CentOS8にGitLab13インストール

「Localization」の「Language」で「Japanese - 日本語」を選択して「Save changes」をクリック。

CentOS8にGitLab13インストール

日本語表示になりました。

CentOS8にGitLab13インストール

まとめ

今回は、CentOS8.2にGitLab 13.5 (Community Edition)をインストールする手順を紹介しました。

souiunogaii.hatenablog.com

souiunogaii.hatenablog.com

インフラエンジニアの勉強ができるオンライン学習サイト

Udemy (オンライン動画学習サイト)

Udemy(ユーデミー)は、オンラインで動画で学習できるサービスです。
ITエンジニア系の講座もたくさん公開されています。

≫Udemy 世界最大級のオンライン学習サイト

Udemyの特徴
  • ユーザー登録すれば、第1回の講座は無料で視聴できる
  • 無料のコンテンツもある
  • 過去に受講した人の人数や、受講した人の評価も表示されるので選びやすい

≫Udemy 世界最大級のオンライン学習サイト

開発の人気オンラインコース