Linux関連/gitlabのセットアップ

最終更新: 2018-09-04

gitlabのセットアップ

インストール

1. yum install -y curl policycoreutils-python openssh-server
1. systemctl enable sshd
1. systemctl start sshd
1. firewall-cmd --permanent --add-service=http
1. systemctl reload firewalld

今回はpostfixを使わないので次の項目は省略

1. yum install postfix
1. systemctl enable postfix
1. systemctl start postfix

本体のインストールは

1. curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash
1. EXTERNAL_URL="http://ドメイン名" yum install -y gitlab-ce

で終了。 (yumコマンドは結構時間かかります! 途中で止めてしまわないように注意)

大体これで使えるようになります。 簡単ですね!

データディレクトリを引っ越す方法

標準だと気にくわない人向け

gitのデータ

/etc/gitlab/gitlab.rbのgit_data_dirsを設定します。([公式ドキュメント])

git_data_dirs({
  "default" => {
    "path" => "/data/gitlab/git-data"
  }
})

これを実行した後、gitlab-ctl reconfigureすれば勝手に変更されます。

本当はlfsとかも動かした方が良いかもしれませんが、まぁ今回はパス

DB(PostgreSQL)のデータ

/var/opt/gitlab/postgresql/dataが本体っぽいので、どっかに移動してしまいましょう

1. gitlab-ctl stop
1. mkdir -p /data/gitlab/postgresql/
1. mv /var/opt/gitlab/postgresql/data /data/gitlab/postgresql/data
1. ln -s /data/gitlab/postgresql/data /var/opt/gitlab/postgresql/data
1. gitlab-ctl start