tech_memo / git / GitLab


tech_memo/git

構築

インストール

  • 前提Packageインストール
    shishimaru@v-cent65% sudo yum install curl openssh-server openssh-clients postfix cronie                                  [~]
     
    Dependencies Resolved
    
    ==============================================================================================================================
     Package                          Arch                    Version                              Repository                Size
    ==============================================================================================================================
    Updating:
     cronie                           x86_64                  1.4.4-16.el6_8.2                     base                      75 k
     curl                             x86_64                  7.19.7-53.el6_9                      updates                  197 k
     openssh-clients                  x86_64                  5.3p1-122.el6                        base                     443 k
     openssh-server                   x86_64                  5.3p1-122.el6                        base                     329 k
     postfix                          x86_64                  2:2.6.6-8.el6                        base                     2.0 M
    Updating for dependencies:
     cronie-anacron                   x86_64                  1.4.4-16.el6_8.2                     base                      31 k
     libcurl                          x86_64                  7.19.7-53.el6_9                      updates                  169 k
     openssh                          x86_64                  5.3p1-122.el6                        base                     277 k
     openssh-askpass                  x86_64                  5.3p1-122.el6                        base                      61 k
    
    Transaction Summary
    ==============================================================================================================================
    Upgrade       9 Package(s)
  • postfix起動
    shishimaru@v-cent65% sudo service postfix start  
    shishimaru@v-cent65% sudo chkconfig postfix on   
  • ファイアウォールを使用している場合は、sshとhttpのポートを解放
    sudo lokkit -s http -s ssh
  • GitLab?ダウンロード、インストール
    shishimaru@v-cent65% curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
    
    Dependencies Resolved
    
    ==============================================================================================================================
     Package                            Arch                    Version                               Repository             Size
    ==============================================================================================================================
    Updating:
     yum-utils                          noarch                  1.1.30-40.el6                         base                  113 k
    Updating for dependencies:
     python-urlgrabber                  noarch                  3.9.1-11.el6                          base                   86 k
     yum                                noarch                  3.2.29-81.el6.centos                  base                  1.0 M
    
    Transaction Summary
    ==============================================================================================================================
    Upgrade       3 Package(s)
    
    
    shishimaru@v-cent65% sudo yum install gitlab-ce                                                                           [~]
    
    Dependencies Resolved
    
    ==============================================================================================================================
     Package                    Arch                    Version                           Repository                         Size
    ==============================================================================================================================
    Installing:
     gitlab-ce                  x86_64                  9.2.2-ce.0.el6                    gitlab_gitlab-ce                  306 M
    
    Transaction Summary
    ==============================================================================================================================
    Install       1 Package(s)
  • GitLab?初期設定&起動
    shishimaru@v-cent65% sudo gitlab-ctl reconfigur
  • 以下にアクセスするとGitLab?の初期設定ページが表示される。初回は管理者ユーザ(?)のパスワード設定の画面が表示される。
    http://[サーバーアドレス]
    • Apacheが動いているとそちらが表示されるので、停止すること(後程ポート番号を変更する)

ポート変更

  • コンフィグ変更前の設定。内容はよくわからない。
    shishimaru@v-cent65% sudo NO_PRIVILEGE_DROP=true USE_DB=false gitlab-rake assets:clean assets:precompile
    rake aborted!
    ExecJS::Error: ExecJS disabled
    /opt/gitlab/embedded/bin/bundle:22:in `load'
    /opt/gitlab/embedded/bin/bundle:22:in `<main>'
    Tasks: TOP => assets:precompile
    (See full trace by running task with --trace)
    [1]    15804 exit 1     sudo NO_PRIVILEGE_DROP=true USE_DB=false gitlab-rake assets:clean
    
    shishimaru@v-cent65% sudo chown -R git:git /var/opt/gitlab/gitlab-rails/tmp/cache
    • 上記のようなエラーが発生したが問題なくポート変更できた。そもそもいらない作業か?
  • 使用ポートを8180に変更(8080にしようとしたが、GitLab?内のプロセスで別途すでに利用されていた)
    shishimaru@v-cent65% sudo vim /etc/gitlab/gitlab.rb
    
    #external_url 'http://v-cent65'
    external_url 'http://v-cent65:8180'
  • 設定反映
    shishimaru@v-cent65% sudo gitlab-ctl reconfigure
  • 再起動 (再起動しなくても8180でアクセスできたのでいらないかも?)
    shishimaru@v-cent65% sudo gitlab-ctl restart