1
3

More than 3 years have passed since last update.

GitLabをバージョン指定してインストールする

Posted at

はじめに

GitLabサーバーの構築を行おうと思いますが、最新バージョンのインストールであれば以下のサイトを参照すれば問題ないです。

なので、今回はバージョン指定してインストールを行うことにします。

情報

サーバー情報です。

Name Ver.
OS CentOS 7
GitLab 12.2.5

インストール

今回は Community Edition をインストールします。

まず、GtLabに必要なパッケージのインストールを行います。

ベースバッケージ
$ sudo yum install -y curl policycoreutils-python openssh-server

もし、FWが動いている場合はサービスを許可しておきます。

FW許可
$ sudo firewall-cmd --permanent --add-service=http
$ sudo firewall-cmd --permanent --add-service=https
$ sudo systemctl reload firewalld

インストールするためのリポジトリを追加します。

リポジトリ追加
$ curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
Detected operating system as centos/7.
Checking for curl...
Detected curl...
Downloading repository file: https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/config_file.repo?os=centos&dist=7&source=script
done.
Installing pygpgme to verify GPG signatures...
読み込んだプラグイン:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp-srv2.kddilabs.jp
 * epel: fedora.cs.nctu.edu.tw
 * extras: ftp-srv2.kddilabs.jp
 * updates: ftp-srv2.kddilabs.jp
gitlab_gitlab-ce-source/signature                                                                                                                                  |  862 B  00:00:00     
https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey から鍵を取得中です。
Importing GPG key 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
https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg から鍵を取得中です。
gitlab_gitlab-ce-source/signature                                                                                                                                  |  951 B  00:00:00 !!! 
gitlab_gitlab-ce-source/primary                                                                                                                                    |  175 B  00:00:01     
パッケージ pygpgme-0.3-9.el7.x86_64 はインストール済みか最新バージョンです
何もしません
Installing yum-utils...
読み込んだプラグイン:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp-srv2.kddilabs.jp
 * epel: fedora.cs.nctu.edu.tw
 * extras: ftp-srv2.kddilabs.jp
 * updates: ftp-srv2.kddilabs.jp
パッケージ yum-utils-1.1.31-54.el7_8.noarch はインストール済みか最新バージョンです
何もしません
Generating yum cache for gitlab_gitlab-ce...
Importing GPG key 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
Generating yum cache for gitlab_gitlab-ce-source...

The repository is setup! You can now install packages.

リポジトリが追加されたら yum でバージョンを指定すればOKです。

gitlabインストール
$ sudo yum install gitlab-ce-12.2.5-ce.0.el7.x86_64
読み込んだプラグイン:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp-srv2.kddilabs.jp
 * epel: fedora.cs.nctu.edu.tw
 * extras: ftp-srv2.kddilabs.jp
 * updates: ftp-srv2.kddilabs.jp
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ gitlab-ce.x86_64 0:12.2.5-ce.0.el7 を インストール
--> 依存性解決を終了しました。

依存性を解決しました

==========================================================================================================================================================================================
 Package                                   アーキテクチャー                       バージョン                                       リポジトリー                                      容量
==========================================================================================================================================================================================
インストール中:
 gitlab-ce                                 x86_64                                 12.2.5-ce.0.el7                                  gitlab_gitlab-ce                                 630 M

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

総ダウンロード容量: 630 M
インストール容量: 1.4 G
Is this ok [y/d/N]: y
Downloading packages:
警告: /var/cache/yum/x86_64/7/gitlab_gitlab-ce/packages/gitlab-ce-12.2.5-ce.0.el7.x86_64.rpm: ヘッダー V4 RSA/SHA1 Signature、鍵 ID f27eab47: NOKEY====-]  11 MB/s | 630 MB  00:00:00 ETA 
gitlab-ce-12.2.5-ce.0.el7.x86_64.rpm の公開鍵がインストールされていません
gitlab-ce-12.2.5-ce.0.el7.x86_64.rpm                                                                                                                               | 630 MB  00:00:58     
https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey から鍵を取得中です。
Importing GPG key 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
https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg から鍵を取得中です。
Importing GPG key 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
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  インストール中          : gitlab-ce-12.2.5-ce.0.el7.x86_64                                                                                                                          1/1 
It looks like GitLab has not been configured yet; skipping the upgrade script.

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



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


Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
  sudo gitlab-ctl reconfigure

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

  検証中                  : gitlab-ce-12.2.5-ce.0.el7.x86_64                                                                                                                          1/1 

インストール:
  gitlab-ce.x86_64 0:12.2.5-ce.0.el7                                                                                                                                                      

完了しました!

インストールが完了しました。
ですが、このままだとURLの設定ができていません。

URL修正
$ vim /etc/gitlab/gitlab.rb

以下の external_url のURLを設定したいドメインに変更します。

gitlab.rb
## GitLab URL
##! URL on which GitLab will be reachable.
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
external_url 'http://gitlab.example.com'

あとは再構築して完了です。

reconfigure
$ gitlab-ctl reconfigure
Starting Chef Client, version 14.13.11
resolving cookbooks for run list: ["gitlab"]
Synchronizing Cookbooks:
  - gitlab (0.0.1)
  - package (0.1.0)
  - postgresql (0.1.0)
  - redis (0.1.0)
  - monitoring (0.1.0)
  - registry (0.1.0)
  - mattermost (0.1.0)
  - consul (0.1.0)
  - gitaly (0.1.0)
  - letsencrypt (0.1.0)
  - runit (4.3.0)
  - nginx (0.1.0)
  - acme (4.0.0)
  - crond (0.1.0)
Installing Cookbook Gems:
~~ 省略 ~~
    - restart service service[grafana]

Running handlers:
Running handlers complete
Chef Client finished, 524/1396 resources updated in 02 minutes 35 seconds
gitlab Reconfigured!

設定したURLへアクセスすると以下のように表示されます。

スクリーンショット 2021-03-11 23.12.26.png

最後にリポジトリを無効化もしておきます。

無効化
$ yum-config-manager --disable gitlab_gitlab-ce

おわりに

一般利用目的であれば最新バージョンをインストールするのが良いと思います。
ですが、サーバーの移行やバージョンアップ検証を行う際に、バージョン指定のインストールは活用できると思います。

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