LoginSignup
16

More than 5 years have passed since last update.

Ubuntu 12.04.2 LTSにGitLab5.2をインストール

Last updated at Posted at 2013-05-27

公式通りでインストール出来た

動作環境

  • Ubuntu 12.04.2 LTS
  • Ruby 1.9.3-p429
  • GitLab 5.2

インストール手順

  • パッケージを最新に更新する
$ apt-get update
$ apt-get upgrade
  • 依存パッケージをインストールする
$ sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl git-core openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev postfix
  • 古いRubyをアンインストール
$ sudo apt-get remove ruby1.8
  • Ruby 1.9.3-p429をインストール
$ mkdir /tmp/ruby && cd /tmp/ruby
$ curl --progress http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p429.tar.gz | tar xz
$ cd ruby-1.9.3-p429
$ ./configure
$ make
$ sudo make install
  • Bundlerをインストール
$ sudo gem install bundler
  • Gitlabを動かすgitユーザーを作成する
$ sudo adduser --disabled-login --gecos 'GitLab' git
  • Gitリポジトリを操作するGitLab shellをインストールする
$ sudo su git
$ cd /home/git
$ git clone https://github.com/gitlabhq/gitlab-shell.git
$ cd gitlab-shell
$ git checkout -b v1.4.0 v1.4.0
$ cp config.yml.example config.yml
$ vim config.yml // ドメインを変更する
$ ./bin/install
  • データベースの設定 (MySQL)
$ sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
$ mysql -u root -p
テーブルの作成
mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password';
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
mysql> GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
mysql> \q
接続の確認
$ sudo -u git -H mysql -u gitlab -p -D gitlabhq_production
  • GitLabをインストールする
$ cd /home/git
$ sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab
$ cd /home/git/gitlab
$ sudo -u git git checkout -b v5.2.0 v5.2.0
  • GitLabの設定を行う
$ cd /home/git/gitlab
$ sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml
$ sudo -u git -H vim config/gitlab.yml
$ sudo -u git -H vim config/gitlab.yml // host名を変更する
$ sudo chown -R git log/
$ sudo chown -R git tmp/
$ sudo chmod -R u+rwX  log/
$ sudo chmod -R u+rwX  tmp/
$ sudo -u git -H mkdir tmp/pids/
$ sudo -u git -H mkdir tmp/sockets/
$ sudo chmod -R u+rwX  tmp/pids/
$ sudo chmod -R u+rwX  tmp/sockets/
$ sudo -u git -H mkdir public/uploads
$ sudo chmod -R u+rwX  public/uploads
$ sudo -u git -H cp config/puma.rb.example config/puma.rb
$ sudo -u git -H git config --global user.name "GitLab"
$ sudo -u git -H git config --global user.email "gitlab@localhost"
  • データベースの設定
$ sudo -u git cp config/database.yml.mysql config/database.yml
  • Gemのインストール
$ cd /home/git/gitlab
$ sudo gem install charlock_holmes --version '0.6.9.4'
$ sudo -u git -H bundle install --deployment --without development test postgres
  • データベースの初期データ投入
sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
  • 起動スクリプトのインストール
$ sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
$ sudo chmod +x /etc/init.d/gitlab
$ sudo update-rc.d gitlab defaults 21
  • インストール確認
$ sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
$ sudo -u git -H bundle exec rake sidekiq:start RAILS_ENV=production
  • GitLabの起動
$ sudo /etc/init.d/gitlab start
  • Nginxのインストール
$ sudo apt-get install nginx
  • 設定ファイル
$ sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlab
$ sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab
$ sudo vim /etc/nginx/sites-available/gitlab // ドメインを書きかえる
  • Nginxの起動
$ sudo service nginx restart
  • 初期アカウント
admin@local.host
5iveL!fe

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16