LoginSignup
0
0

More than 3 years have passed since last update.

【CentOS8に最新バージョンのRedmineとGitLabを構築する】GitLab構築

Last updated at Posted at 2021-03-28

GitLab構築

この記事では、Official Linux package (recommended installation) をベースにして、CentOS8上に最新バージョンのGitLabを構築する。

ソフトウェア バージョン
OS CentOS 8.3
gitlab-ee 13.9.4-ee.0.el8

関連記事

【CentOS8に最新バージョンのRedmineとGitLabを構築する】事前調査
【CentOS8に最新バージョンのRedmineとGitLabを構築する】Redmine構築

1.依存パッケージのインストールと設定

[doshi@centos8 ~]$ sudo dnf install -y curl policycoreutils openssh-server perl

2.Omnibus GitLabパッケージのインストール

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

[doshi@centos8 ~]$ sudo curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash

リポジトリを確認すると、gitlab_gitlab-eeが追加されている。

[doshi@centos8 ~]$ dnf repolist
repo id                                                             repo の名前
appstream                                                           CentOS Linux 8 - AppStream
baseos                                                              CentOS Linux 8 - BaseOS
epel                                                                Extra Packages for Enterprise Linux 8 - x86_64
epel-modular                                                        Extra Packages for Enterprise Linux Modular 8 - x86_64
extras                                                              CentOS Linux 8 - Extras
gitlab_gitlab-ee                                                    gitlab_gitlab-ee
gitlab_gitlab-ee-source                                             gitlab_gitlab-ee-source
powertools                                                          CentOS Linux 8 - PowerTools

GitLabパッケージをインストールする。指定したURLhttp://centos8-dev/gitlabでGitLabが起動するように設定する。

[doshi@centos8 ~]$ sudo EXTERNAL_URL="http://centos8-dev/gitlab" dnf install -y gitlab-ee

インストールに成功したら、以下が表示される。


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



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


Thank you for installing GitLab!

3.nginxのポート番号変更

Apacheが80番ポートで起動しているため、nginxは8081番ポートで起動させる。

/etc/gitlab/gitlab.rbを開く。

[doshi@centos8 ~]$ sudo vi /etc/gitlab/gitlab.rb

listen_portに8081を設定する。

/etc/gitlab/gitlab.rb
nginx['listen_port'] = 8081

GitLabの再構成を実行する。

[doshi@centos8 ~]$ sudo gitlab-ctl reconfigure

4.Apacheのリバースプロキシ設定

Apahceへの80番ポートでのアクセスhttp://centos8-dev/gitlab/を、nginxへの8081番ポートでのアクセスhttp://localhost:8081/gitlab/にプロキシする。

/etc/httpd/conf.d/gitlab.confを開く。

[doshi@centos8 ~]$ sudo vi /etc/httpd/conf.d/gitlab.conf

以下を設定する。

/etc/httpd/conf.d/gitlab.conf
<Location /gitlab>
 ProxyPass http://localhost:8081/gitlab
 ProxyPassReverse http://localhost:8081/gitlab
</Location>
<Location /assets>
 ProxyPass http://localhost:8081/assets
 ProxyPassReverse http://localhost:8081/assets
</Location>

Apacheを再起動する。

[doshi@centos8 ~]$ sudo systemctl restart httpd.service

5.運用

Redmineのログローテーション

logrotate のとおり、デフォルトでログローテートの設定がされている。

Omnibus GitLabのバックアップとリストア

Backup and restore Omnibus GitLab configuration を参考にする。

アップグレード

Update GitLab installed with the Omnibus GitLab package を参考にする。

ディレクトリ

データの蓄積するディレクトリは以下のとおり。

ディレクトリ 用途
/var/opt/gitlab/ GitLabのデータが配置されるディレクトリ

おわりに

ご指摘・アドバイス等あればご遠慮なくお願いいたします。

参考文献

この記事は以下の情報を参考にした。

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