LoginSignup
0
1

More than 3 years have passed since last update.

Redmineインストール

Posted at

Redmineのインストール手順を残しておく。
OS:GCP上にインストール済みのDebian(Linux instance-1 4.9.0-8-amd64)

Middleware系のインストール

Ruby関連

sudo apt install ruby-dev ruby bundler

Apache関連

sudo apt install apache2 libapache2-mod-passenger

ImageMagic関連

sudo apt install imagemagick libmagick++-dev

バージョン関連

sudo apt install git subversion

DB関連

sudo apt install mysql-server default-libmysqlclient-dev

DBの準備

今回は、MySQLを使用する。

MySQLの設定変更

Redmineの文字コードは、utf8mb4を使用する。
/etc/mysql/conf.d/redmine.cnf

[mysqld]
innodb_file_format = Barracuda
innodb_file_per_table = 1
innodb_large_prefix
character-set-server = utf8mb4
skip-character-set-client-handshake
collation-server = utf8mb4_general_ci
init-connect = SET NAMES utf8mb4

[mysql]
default-character-set = utf8mb4

[client]
default-character-set = utf8mb4

[mysqldump]
default-character-set = utf8mb4

データベース作成

  • DB: Redmine
  • User: redmine
  • Password: pass
CREATE DATABASE redmine CHARACTER SET utf8mb4;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'pass';
GRANT ALL PRIVILEGES ON redmine.* TO 'user'@'localhost';
FLUSH PRIVILEGES;

※作ったユーザーで、Mysqlが使えることを確認しておくこと。

Redmineインストール

今回使用するバージョンは、3.4-stableを指定。

ディレクトリ作成とダウンロード

sudo mkdir -p /var/www/redmine
sudo chown www-data:www-data /var/www/redmine
sudo -u www-data svn co http://svn.redmine.org/redmine/branches/3.4-stable /var/www/redmine

DB設定ファイルの作成

  • /var/www/redmine/config/database.ymlに以下の内容でファイルを作成する。
production:
  adapter: mysql2
  host: localhost
  database: redmine
  username: redmine
  password: pass
  encoding: utf8mb4
  socket: /var/run/mysqld/mysqld.sock

メール設定ファイルの作成

今回は、メール通知を使用しないため、Sampleをコピーする。

sudo cp /var/www/redmine/config/configuration.yml.example /var/www/redmine/config/configuration.yml

utf8mb4の有効化

  • /var/www/redmine/config/initializers/utf8mb4.rbに以下の内容で作成する
ActiveSupport.on_load :active_record do
  module ActiveRecord::ConnectionAdapters

    class AbstractMysqlAdapter
      def create_table_with_innodb_row_format(table_name, options = {})
        table_options = options.merge(:options => 'ENGINE=InnoDB ROW_FORMAT=DYNAMIC')
        create_table_without_innodb_row_format(table_name, table_options) do |td|
          yield td if block_given?
        end
      end
      alias_method_chain :create_table, :innodb_row_format
    end

  end
end

Redmineインストール開始

find | sudo xargs chown www-data:www-data
sudo -u www-data bundle install -j$(nproc) --without development test postgresql sqlite --path vendor/bundle
sudo -u www-data bundle exec rake generate_secret_token
sudo -u www-data RAILS_ENV=production bundle exec rake db:migrate
sudo -u www-data RAILS_ENV=production REDMINE_LANG=ja bundle exec rake redmine:load_default_data

何もエラーが出なければ、インストール完了

Apacheの設定

今回は、サブディレクトリで使用したいため、VirtualHostに追記

Alias /redmine /var/www/redmine/public
<Location /redmine>
    PassengerBaseURI /redmine
    PassengerAppRoot /var/www/redmine
</Location>
0
1
1

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
0
1