0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Redmineの検証・開発環境を構築する

Last updated at Posted at 2019-10-13

前の記事でRedmineの検証・開発環境が必要になったため、必要な手順をメモしてみました。インストール手順はRedmine.JPのBlogで紹介されていますが、このQiitaの記事では小さなRedmine開発環境を手早く構築することに主眼をおいた手順になっています。

動作環境のバージョン

動作環境は前の記事と同じ環境になります。

  • CentOS-7
  • Ruby2.6.5p114
  • MariaDB 5.5.64
  • Redmine-4.0.4(2019/10/06時点での最新版)

必要なパッケージのインストール

Rubyのインストール(というかrbenvによるRubyビルド)とRedmineの動作に必要なパッケージをあらかじめインストールしておきます。

$ # rbenvでRubyをインストールする際に必要となるパッケージ。
$ sudo yum install -y git bzip2 gcc make openssl-devel readline-devel zlib-devel sqlite sqlite-devel
$
$ # Redmineをインストールする際に必要となるパッケージ。
$ sudo yum install -y ImageMagick ImageMagick-devel mariadb-server mariadb-devel subversion

Rubyのインストール(rbenv)

最新版のRubyを使用したいので、CentOSのパッケージからではなくrbenvを利用してRubyをインストールします。

$ # rbenvのセットアップ
$ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
$
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile

rbenvの準備が完了したのち、以下の手順でRubyをインストールします。今回のケースではRuby-2.6.5を選択しています。

$ # インストール可能なRubyのバージョンを確認する。
$ rbenv install --list
  ...中略...
  2.6.5
$
$ CONFIGURE_OPTS="--disable-install-doc --disable-install-rdoc" rbenv install 2.6.5
$ rbenv global 2.6.5
$ rbenv version
2.5.0 (set by /home/seigo/.rbenv/version)

データベースの設定(MySQL/MariaDB)

データベースはMySQL(ここではMariaDB)を使用します。 /etc/my.cnf の設定手順は以下の記事に記載しています。具体的には文字コードをUTF-8に変更するという手順になります。

MariaDBを起動したのち、Redmineが参照するデータベースを作成します。

$ sudo systemctl start mariadb.service
$ mysql -u root -p 
Enter password: 
...中略...
MariaDB [(none)]> CREATE DATABASE redmine CHARACTER SET UTF8 ;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> \q
Bye
$ 

Redmineのインストール

今回は他のPCからもRedmineにアクセスしたい+閉じたネットワークでの検証用のみであるため、いったんfirewalldを停止しておきます。

$ sudo systemctl stop firewalld

以下の手順でRedmineのソースコード取得と必要な設定を行います。

$ svn co https://svn.redmine.org/redmine/tags/4.0.4/ ./redmine-4.0.4
$ cd redmine-4.0.4
$ cp config/database.yml.example config/database.yml
$ bundle install --without development test --path vendor/bundle
$ bundle exec rake generate_secret_token
$ RAILS_ENV=production bundle exec rake db:migrate
$ RAILS_ENV=production REDMINE_LANG=ja bundle exec rake redmine:load_default_data

Redmineを起動します。起動後 http://localhost:3000/ でRedmineにアクセスできます。

$ RAILS_ENV=production REDMINE_LANG=ja bundle exec rails server

インストール後の初期設定は以下を参照してください。

まとめ

Redmineの検証・開発環境の構築手順を紹介しました。この手順で手元に小さなRedmine環境が構築できるので、ちょっとした検証だけでなく、Redmineの REST APIやテーマの作成、機能追加の実験といった用途にも応用できそうです。

参考URL

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?