Gitlab6.0のインストール

前回のRedmineに引き続き、Gitlab6.0をインストールしてみました。

Gitlabを使えば、GitHubのようなサービスを社内などのクローズドな環境で運用できます。


環境はこちら

OS CentOS release 6.5
Ruby 1.9.3-p484
Mysql 5.1.72
Git 1.8.5.2
Gitlab 6.0
Mysqlにユーザー追加
CREATE USER gitlabhq@localhost IDENTIFIED BY '****';
CREATE DATABASE gitlabhq_production;
GRANT ALL PRIVILEGES ON *.* TO 'gitlabhq'@'localhost' IDENTIFIED BY '****' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Gitユーザーを追加
adduser --comment 'GitLab' --create-home --home-dir /home/git git

mkdir /home/git
chown git:git /home/git
sudo -u git -H mkdir /home/git/.ssh
sudo -u git -H touch /home/git/.ssh/authorized_keys
sudo -u git -H chmod 700 /home/git/.ssh
sudo -u git -H chmod 600 /home/git/.ssh/authorized_keys
sudo -u git -H git config --global user.name  "GitLab"
sudo -u git -H git config --global user.email "gitlab@localhost"
Gitlab Shell のセットアップ
cd /home/git
rbenv local 1.9.3-p484
sudo -u git -H git clone https://github.com/gitlabhq/gitlab-shell.git
cd /home/git/gitlab-shell
sudo -u git -H git checkout -b 1.7.0 v1.7.0
cp -p config.yml.example config.yml
vi config.yml
============
gitlab_url など適時修正
============
sudo -u git -H ./bin/install
Gitlab のセットアップ
cd /home/git
sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab
cd /home/git/gitlab
sudo -u git -H git checkout 6-0-stable
sudo -u git -H mkdir /home/git/gitlab-satellites
sudo -u git -H mkdir tmp/pids/
sudo -u git -H mkdir tmp/sockets/
sudo -u git -H mkdir public/uploads
cp -p config/gitlab.yml.example config/gitlab.yml
cp -p config/unicorn.rb.example config/unicorn.rb
cp -p config/database.yml.mysql config/database.yml
vi config/gitlab.yml
vi config/unicorn.rb
vi config/database.yml
============
url, port, database など適宜修正
============
GEMで各種インストール
cd /home/git/gitlab
sudo -u git -H bundle install --deployment --without development test postgres aws --path vendor/bundler
テーブル作成
sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production

初期ユーザー
============
login.........admin@local.host
password......5iveL!fe
============
起動スクリプトのセットアップ
curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlabhq/6-0-stable/lib/support/init.d/gitlab
chmod +x /etc/init.d/gitlab
起動
/etc/init.d/gitlab start
Gitlabの確認
cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production --trace


以上です。