# Login as git
sudo su git
# Go to home directory
cd /opt/gitlab
# Clone gitlab shell
git clone https://github.com/gitlabhq/gitlab-shell.git
cd gitlab-shell
# switch to right version
git tag -l
git checkout -b v1.9.3 refs/tags/v1.9.3
cp -v config.yml.example config.yml
# Edit config and replace gitlab_url
# gitlab_url: "http://localhost/" ⇒ "[利用FQDN]"
# vim config.yml
# OR
# sed -i 's/localhost/[利用FQDN]/' config.yml
sed -i "s/localhost/`hostname -f`/" config.yml
# repos_path: /var/gitrepo
# auth_file: /opt/gitlab/.ssh/authorized_keys
# Do setup
./bin/install
Mysqlの設定
## DBをdumpする際にユーザが必要なのでredmineインストール時にやったがいいかも
# MySQL の最低限の調整
sudo mysql_secure_installation
# MySQLにログイン
$ mysql -u root -p
# gitlabユーザーを作成($passwordにパスワード)
mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password';
# プロダクション用のデータベースを作成
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
# gitlabユーザーに権限を付与
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
mysql> flush privileges;
mysql> quit
gitlabのインストール
cd /opt/gitlab
# Clone GitLab repository
sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab
# Go to gitlab dir
cd /opt/gitlab/gitlab
# Checkout to stable release
git checkout -b v6.8.0.rc1 refs/tags/v6.8.0.rc1
cd /opt/gitlab/gitlab
# Copy the example GitLab config
cp -v config/gitlab.yml.example config/gitlab.yml
# "localhost" を "利用のFQDN" に
# ちなみにここで設定する "ホスト名" が画面で出てくる、「gitのURL」になります。
# sudo -u git -H vim config/gitlab.yml
# OR
# sudo -u git -H sed -i 's/localhost/[利用FQDN]/' config/gitlab.yml
sudo -u git -H sed -i "s/localhost/`hostname -f`/" config/gitlab.yml
# Make sure GitLab can write to the log/ and tmp/ directories
chmod -R u+rwX log/
chmod -R u+rwX tmp/
# Create directory for satellites
mkdir /opt/gitlab/gitlab-satellites
# Create directories for sockets/pids and make sure GitLab can write to them
chmod -R u+rwX tmp/pids/
chmod -R u+rwX tmp/sockets/
# DBの設定(MySQL)
cp -v config/database.yml.mysql config/database.yml
# DB 情報設定
vim config/database.yml
# 設定情報設定
vim config/gitlab.yml
# repos_path: /var/gitrepo
# install
cd /opt/gitlab/gitlab
gem install charlock_holmes --version '0.6.9'
# gitlab のインストール
bundle install --deployment --without development test postgres
# インストール
bundle exec rake gitlab:setup RAILS_ENV=production
# gitlab の起動
sudo /etc/init.d/gitlab restart
# スクリプトの設置
sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/5-1-stable/init.d/gitlab
sudo chmod +x /etc/init.d/gitlab
# 自動起動設定
sudo update-rc.d gitlab defaults 21
# gitlab の起動
sudo /etc/init.d/gitlab restart
# Uncomment and customize the last line to run in a non-root path
# WARNING: This feature is no longer supported
# Note that three settings need to be changed for this to work.
# 1) In your application.rb file: config.relative_url_root = "/gitlab"
# 2) In your gitlab.yml file: relative_url_root: /gitlab
# 3) In your unicorn.rb: ENV['RAILS_RELATIVE_URL_ROOT']
# 4) In ../gitlab-shell/config.yml: gitlab_url: "http://127.0.0.1/gitlab "
# To update the path, run: sudo -u git -H bundle exec rake assets:precom pile RAILS_ENV=production