ソース管理、バックアップ用に自分専用のgitサーバー構築をしてみました。
技術メモとして記載させていただきますので、ご参考になればと思います。
パッケージのインストール
Gitlabの公式サイトを参考にパッケージのインストール
https://about.gitlab.com/downloads/
Gitlab Omnibusはgitlabサーバー構築に必要なミドルウェアが用意されています。
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
続いてインスートールします
sudo yum install gitlab-ce
gitサーバURLの設定
gitlabの設定は /etc/gitlab/gitlab.rb に記載されていますので
GitLabのWebGUIやGitリポジトリへアクセスするときに使うURLを指定します。
$ sudo vim /etc/gitlab/gitlab.rb
external_url "http://gitlab.example.com"
セットアップ
gitlab-ctl reconfigure
セットアップするとGitLab用のディレクトリ (/opt/gitlab/sv/ ) に下記記載のミドルウェアがインストールされます。
logrotate
nginx
postgresql
redis
sidekiq
unicorn
パッケージのGitlab Omnibusはデフォルトでnginxで動作します。
Webサーバーは一般的に80番ポートが使われるので、既にWebサーバーが稼働しているシステム(apacheなど)にGitLabをインストールしたいときは衝突しないよう調整する必要があります。
自分はすでにapacheをインストール済みでホームページを公開していましたので衝突しました。。。
衝突した場合はポートを指定してやります。
$ sudo vim /etc/gitlab/gitlab.rb
external_url "http://gitlab.example.com:88"
再度、セットアップしてあげれば、変更内容が反映されます。
webサーバーのVirtualHost設定
gitlabはローカルで起動しているので
apacheでリバースプロシキの設定をしてやります。
$ sudo vim /etc/httpd/conf.d/gitlab.example.com.conf
<VirtualHost *:80>
ServerName gitlab.example.com
DocumentRoot "/opt/gitlab/embedded/service/gitlab-rails/public"
ProxyPass / http://localhost:88/
ProxyPassReverse / http://localhost:88/
ErrorLog /var/log/httpd/gitlab.example.com_error_log
CustomLog /var/log/httpd/gitlab.example.com_access_log combined
AddDefaultCharset UTF-8
<Directory "/opt/gitlab/embedded/service/gitlab-rails/public">
Allow from all
</Directory>
</VirtualHost>
apacheを再起動
こんな画面が出たらとりあえずインストールは完了です
■参考サイト
http://biokids.org/?%A4%C9%A4%D6%A4%AA%2F%B3%AB%C8%AF%A4%B7%A4%E8%A4%A6%A1%AA%2FGitLab%207.3.2%A4%CE%A5%A4%A5%F3%A5%B9%A5%C8%A1%BC%A5%EB
http://ez-net.jp/article/6F/ULEm_R1H/-ZBF5BCCmpC2/
http://urashita.com/archives/3074