GitLab 6.8 をソースインストール
篠原 隆司
アフィリエイト広告を利用しています
このページの内容が役に立ったら X (旧twitter) でフォローして頂けると励みになります
挨拶や報告は無しで大丈夫です
2014年5月22日(約11年前)の記事となっております。色々ご注意ください。
参考サイト
構成
- yumでインストールしていたgitを削除
- GitLabのデータベースはMySQL
- GitLabのURLはSSL
- webサーバはhttpd
Gitの準備
Gitアンインストール
yum remove git
bash
※もともとyumのgitを使用していたためこの機会に最新版に変更
Gitインストール
cd /tmp wget https://www.kernel.org/pub/software/scm/git/git-1.9.3.tar.gz tar zxvf git-1.9.3.tar.gz cd git-1.9.3 ./configure --prefix=/usr/local make prefix=/usr/local all make prefix=/usr/local install
bash
Gitインストール確認
git --version
bash
bash: /usr/bin/git: そのようなファイルやディレクトリはありません
ln -s /usr/local/bin/git /usr/bin/git git --version
bash
git version 1.9.3
Gitの初期設定
git config --global user.name "GitLab" git config --global user.email "gitlab@git.example.jp"
bash
設定を確認
git config --list
bash
Rubyの準備
ruby インストール
cd /tmp wget http://ftp.ruby-lang.org/pub/ruby/ruby-2.1.2.tar.gz tar zxvf ruby-2.1.2.tar.gz cd ruby-2.1.2 ./configure --disable-install-doc make make install ruby -v
bash
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
bundlerのインストール
gem install bundler gem install charlock_holmes --version '0.6.9'
bash
Passengerのインストール
gem install passenger --no-rdoc --no-ri
bash
PassengerのApache用モジュールのインストール
yum install curl-devel yum install httpd-devel yum install apr-devel yum install apr-util-devel passenger-install-apache2-module
bash
完了後の内容を httpd.conf に記述 (下記は環境により変わる)
LoadModule passenger_module /usr/local/lib/ruby/gems/2.1.0/gems/passenger-4.0.33/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/2.1.0/gems/passenger-4.0.33
PassengerDefaultRuby /usr/local/bin/ruby
もう一度確認するときは、
passenger-install-apache2-module --snippet
bash
ユーザー作成
useradd -c 'GitLab' -s /bin/bash git su - git
bash
cd /home/git mkdir .ssh touch .ssh/authorized_keys chmod 600 .ssh/authorized_keys chmod 700 .ssh
bash
GitLab shellのインストール
su git でgitユーザーとして実行
su - git
bash
cd /home/git git clone https://github.com/gitlabhq/gitlab-shell.git cd gitlab-shell/ git checkout v1.9.4 git checkout -b v1.9.4 cp config.yml.example config.yml vi config.yml
bash
gitlab_url: "http://localhost/" をアクセスしたいURLに変更する
./bin/install
bash
MySQL
MySQLをインストール
既にインストール済みのため省略
mysql -V
bash
mysql Ver 14.14 Distrib 5.5.37, for Linux (x86_64) using readline 5.1
データベースを作成
CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'パスワード'; CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
sql
Redisのインストール
yum install redis /etc/init.d/redis start chkconfig redis on
bash
GitLabのインストール
su - git
bash
cd /home/git git clone https://github.com/gitlabhq/gitlabhq.git gitlab cd gitlab git checkout 6-8-stable
bash
設定変更
cp config/gitlab.yml.example config/gitlab.yml vi config/gitlab.yml
bash
host, port, https, email_from, repos_path, ssh_port など
chown -R git log/ chown -R git tmp/ chmod -R u+rwX log/ chmod -R u+rwX tmp/ mkdir /home/git/gitlab-satellites mkdir tmp/pids/ chmod -R u+rwX tmp/pids/ cp config/unicorn.rb.example config/unicorn.rb
bash
GitLabのDB設定
cp config/database.yml.mysql config/database.yml vi config/database.yml
bash
< username: root
< password: "secure password"
Gemsのインストール
cd /home/git/gitlab bundle install --deployment --without development test postgres
bash
DBの初期化とセットアップ
bundle exec rake gitlab:setup RAILS_ENV=production
bash
InitScriptのインストール
cd /home/git/gitlab cp lib/support/init.d/gitlab /etc/init.d/gitlab cp lib/support/init.d/gitlab.default.example /etc/default/gitlab chmod +x /etc/init.d/gitlab vi /etc/init.d/gitlab
bash
※確認のみ
各種設定
ローテンションログの設定
cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
bash
状態チェック
bundle exec rake gitlab:env:info RAILS_ENV=production
bash
Assetsのビルド
bundle exec rake assets:precompile RAILS_ENV=production
bash
起動とサービス登録
/etc/init.d/gitlab restart chkconfig gitlab on
bash
状態チェック
bundle exec rake gitlab:check RAILS_ENV=production cd /home/git/gitlab chown -R git:git .
bash
httpの設定
httpdにVirtualHost の設定をする
ServerName 設定したURL
DocumentRoot /home/git/gitlab/public
他は通常のPassengerでの設定と同じ
apacheユーザーが/home/git にアクセスできるようにする
gpasswd -a apache git chmod g+rX /home/git cat /etc/group
bash
設定 / 確認
cd /home/git/gitlab vi /home/git/gitlab-shell/config.yml vi config/gitlab.yml
bash
/etc/init.d/gitlab restart
bash
bundle exec rake gitlab:env:info RAILS_ENV=production bundle exec rake gitlab:check RAILS_ENV=production
bash
導入サポート・運用サポート
ということで宣伝です。
弊社ではPHP・MySQL・javascriptを使ったWebサイトを得意としています。
これらは2005年頃から触り続けてきていることもあり得意中の得意です。
Git については2012年頃から、GitLab は2014年頃 GitLab 6.8 のときから使い続けています。
ちなみに Github は取引先の都合で使用することはもちろんあります。
1日で完了する簡単なことから、半年・1年規模のものまで幅広く承っています。
特にプログラム開発が必要になるようなカスタマイズは遠慮なくご相談ください。
フロントの見た目に関わるところはデザイン会社が担当、裏方の技術部分を弊社が担当するケースもあり柔軟に対応することができます。
メールやSNSなどのメッセージで簡単に連絡いただいたあとで、電話していただけると確実です。(お問い合わせ)