「Raspbian StretchにRedmine」の版間の差分
		
		
		
		ナビゲーションに移動
		検索に移動
		
| 編集の要約なし | 編集の要約なし | ||
| (同じ利用者による、間の10版が非表示) | |||
| 2行目: | 2行目: | ||
| RedmineはRubyで動いているらしい | RedmineはRubyで動いているらしい | ||
| <syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
| $ sudo apt | $ sudo apt install -y ruby | ||
| $ ruby -v | $ ruby -v | ||
| ruby 2.3.3p222 (2016-11-21) [arm-linux-gnueabihf] | ruby 2.3.3p222 (2016-11-21) [arm-linux-gnueabihf] | ||
| 13行目: | 13行目: | ||
| </syntaxhighlight> | </syntaxhighlight> | ||
| エラー発生 | エラー発生 | ||
| < | <syntaxhighlight lang="text"> | ||
| ERROR:  Error installing rails: | ERROR:  Error installing rails: | ||
|          ERROR: Failed to build gem native extension. |          ERROR: Failed to build gem native extension. | ||
| 22行目: | 22行目: | ||
| extconf failed, exit code 1 | extconf failed, exit code 1 | ||
| </ | </syntaxhighlight> | ||
| ruby-devをインストールすると解消されるらしい | ruby-devをインストールすると解消されるらしい | ||
| <syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
| $ sudo apt | $ sudo apt install -y ruby-dev | ||
| $ sudo gem install rails | $ sudo gem install rails | ||
| $ rails -v | $ rails -v | ||
| 41行目: | 41行目: | ||
| === Apacheとヘッダファイルのインストール === | === Apacheとヘッダファイルのインストール === | ||
| <syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
| $ sudo apt | $ sudo apt install -y apache2 apache2-dev libapr1-dev libaprutil1-dev | ||
| </syntaxhighlight> | </syntaxhighlight> | ||
| === ImageMagickとヘッダファイル・日本語フォントのインストール === | === ImageMagickとヘッダファイル・日本語フォントのインストール === | ||
| <syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
| $ sudo apt | $ sudo apt install -y imagemagick libmagick++-dev fonts-takao-pgothic | ||
| </syntaxhighlight> | </syntaxhighlight> | ||
| エラー発生 | エラー発生 | ||
| < | <syntaxhighlight lang="text"> | ||
| E: パッケージ fonts-takao-pgothic が見つかりません | E: パッケージ fonts-takao-pgothic が見つかりません | ||
| </ | </syntaxhighlight> | ||
| fonts-takao-pgothicはfonts-takao-gothicに含まれているっぽい | fonts-takao-pgothicはfonts-takao-gothicに含まれているっぽい | ||
| <syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
| $ sudo apt | $ sudo apt install -y imagemagick libmagick++-dev fonts-takao-gothic | ||
| $ ls /usr/share/fonts/truetype/takao-gothic/ | $ ls /usr/share/fonts/truetype/takao-gothic/ | ||
| TakaoGothic.ttf  TakaoPGothic.ttf | TakaoGothic.ttf  TakaoPGothic.ttf | ||
| 61行目: | 61行目: | ||
| === Gitのインストール === | === Gitのインストール === | ||
| <syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
| $ sudo apt | $ sudo apt install -y git | ||
| </syntaxhighlight> | </syntaxhighlight> | ||
| 86行目: | 86行目: | ||
| </syntaxhighlight> | </syntaxhighlight> | ||
| 以下を編集 | 以下を編集 | ||
| < | <syntaxhighlight lang="text"> | ||
| production: | production: | ||
|    adapter: mysql2 |    adapter: mysql2 | ||
| 94行目: | 94行目: | ||
|    password: "<PASSWORD>" |    password: "<PASSWORD>" | ||
|    encoding: utf8 |    encoding: utf8 | ||
| </ | </syntaxhighlight> | ||
| 他はコメントアウト | 他はコメントアウト | ||
| 102行目: | 102行目: | ||
| </syntaxhighlight> | </syntaxhighlight> | ||
| エラー発生 | エラー発生 | ||
| < | <syntaxhighlight lang="text"> | ||
| mysql client is missing. You may need to 'apt-get install libmysqlclient-dev' or 'yum install mysql-devel', and try | mysql client is missing. You may need to 'apt-get install libmysqlclient-dev' or 'yum install mysql-devel', and try | ||
| again. | again. | ||
| 108行目: | 108行目: | ||
| An error occurred while installing mysql2 (0.4.10), and Bundler cannot continue. | An error occurred while installing mysql2 (0.4.10), and Bundler cannot continue. | ||
| Make sure that `gem install mysql2 -v '0.4.10'` succeeds before bundling. | Make sure that `gem install mysql2 -v '0.4.10'` succeeds before bundling. | ||
| </ | </syntaxhighlight> | ||
| <syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
| $ sudo apt | $ sudo apt install -y libmysqlclient-dev | ||
| </syntaxhighlight> | </syntaxhighlight> | ||
| エラー発生 | エラー発生 | ||
| < | <syntaxhighlight lang="text"> | ||
| E: パッケージ 'libmysqlclient-dev' にはインストール候補がありません | E: パッケージ 'libmysqlclient-dev' にはインストール候補がありません | ||
| </ | </syntaxhighlight> | ||
| 代わりにlibmariadbd-devをインストール | 代わりにlibmariadbd-devをインストール | ||
| <syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
| $ sudo apt | $ sudo apt install -y libmariadbd-dev | ||
| </syntaxhighlight> | </syntaxhighlight> | ||
| で、忘れそうになるけど、やりたかったのはこれ | で、忘れそうになるけど、やりたかったのはこれ | ||
| 145行目: | 145行目: | ||
| </syntaxhighlight> | </syntaxhighlight> | ||
| エラー発生 | エラー発生 | ||
| < | <syntaxhighlight lang="text"> | ||
| ... | ... | ||
|   * Checking for Curl development headers with SSL support... |   * Checking for Curl development headers with SSL support... | ||
| 162行目: | 162行目: | ||
|     Please install it with apt-get install libssl-dev |     Please install it with apt-get install libssl-dev | ||
| ... | ... | ||
| </ | </syntaxhighlight> | ||
| libcurl4-openssl-devとlibssl-devをインストールすればいいらしい | libcurl4-openssl-devとlibssl-devをインストールすればいいらしい | ||
| <syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
| $ sudo apt | $ sudo apt install -y libcurl4-openssl-dev libssl-dev | ||
| </syntaxhighlight> | </syntaxhighlight> | ||
| あらためて | あらためて | ||
| 182行目: | 182行目: | ||
| </syntaxhighlight> | </syntaxhighlight> | ||
| === Apacheの設定 === | |||
| <syntaxhighlight lang="bash"> | |||
| $ sudo vim /etc/apache2/conf-available/redmine.conf | |||
| </syntaxhighlight> | |||
| 以下の内容を記載 | |||
| <syntaxhighlight lang="apache"> | |||
| <Directory "<REDMINE_DIR>/public"> | |||
|   Require all granted | |||
| </Directory> | |||
| LoadModule passenger_module /var/lib/gems/2.3.0/gems/passenger-5.1.12/buildout/apache2/mod_passenger.so | |||
| <IfModule mod_passenger.c> | |||
|   PassengerRoot /var/lib/gems/2.3.0/gems/passenger-5.1.12 | |||
|   PassengerDefaultRuby /usr/bin/ruby2.3 | |||
| </IfModule> | |||
| </syntaxhighlight> | |||
| 設定を反映 | |||
| <syntaxhighlight lang="bash"> | |||
| $ sudo a2enconf redmine | |||
| </syntaxhighlight> | |||
| 邪魔なconfをdisableに | |||
| <syntaxhighlight lang="bash"> | |||
| $ sudo a2dissite 000-default.conf | |||
| $ sudo systemctl reload apache2 | |||
| $ sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/<CONF_FILE_NAME>.conf | |||
| $ sudo vim /etc/apache2/sites-available/<CONF_FILE_NAME>.conf | |||
| </syntaxhighlight> | |||
| 以下の内容を記載 | |||
| <syntaxhighlight lang="apache"> | |||
| <VirtualHost *:80> | |||
|         # The ServerName directive sets the request scheme, hostname and port that | |||
|         # the server uses to identify itself. This is used when creating | |||
|         # redirection URLs. In the context of virtual hosts, the ServerName | |||
|         # specifies what hostname must appear in the request's Host: header to | |||
|         # match this virtual host. For the default virtual host (this file) this | |||
|         # value is not decisive as it is used as a last resort host regardless. | |||
|         # However, you must set it for any further virtual host explicitly. | |||
|         ServerName <DOMAIN> | |||
|         ServerAdmin <MAIL_ADDRESS> | |||
|         DocumentRoot <REDMINE_DIR>/public | |||
|         # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, | |||
|         # error, crit, alert, emerg. | |||
|         # It is also possible to configure the loglevel for particular | |||
|         # modules, e.g. | |||
|         #LogLevel info ssl:warn | |||
|         ErrorLog ${APACHE_LOG_DIR}/error.log | |||
|         CustomLog ${APACHE_LOG_DIR}/access.log combined | |||
|         # For most configuration files from conf-available/, which are | |||
|         # enabled or disabled at a global level, it is possible to | |||
|         # include a line for only one particular virtual host. For example the | |||
|         # following line enables the CGI configuration for this host only | |||
|         # after it has been globally disabled with "a2disconf". | |||
|         #Include conf-available/serve-cgi-bin.conf | |||
| </VirtualHost> | |||
| </syntaxhighlight> | |||
| 設定を反映 | |||
| <syntaxhighlight lang="bash"> | |||
| $ sudo a2ensite <CONF_FILE_NAME> | |||
| $ sudo systemctl reload apache2 | |||
| </syntaxhighlight> | |||
| === プラグインの復旧 === | |||
| ==== redmine_absolute_dates ==== | |||
| 日時表記を相対値から絶対値にするやつ | |||
| <syntaxhighlight lang="bash"> | |||
| $ mv <PLUGIN_PATH> <REDMINE_DIR>/plugin/. | |||
| $ touch <REDMINE_DIR>/tmp/restart.txt | |||
| </syntaxhighlight> | |||
| Redmineにアクセスすると再起動完了 | |||
| <syntaxhighlight lang="bash"> | |||
| $ rm <REDMINE_DIR>/tmp/restart.txt | |||
| </syntaxhighlight> | |||
| ==== redmine_issue_templates ==== | |||
| チケット作成時にテンプレートを適用するやつ | |||
| <syntaxhighlight lang="bash"> | |||
| $ mv <PLUGIN_PATH> <REDMINE_DIR>/plugin/. | |||
| $ touch <REDMINE_DIR>/tmp/restart.txt | |||
| </syntaxhighlight> | |||
| Redmineにアクセスすると再起動完了 | |||
| <syntaxhighlight lang="bash"> | |||
| $ rm <REDMINE_DIR>/tmp/restart.txt | |||
| </syntaxhighlight> | |||
| ==== redmine_knowledgebase ==== | |||
| ナレッジベース<br /> | |||
| 新規に追加することはないだろうけど、過去に使ってたから一応 | |||
| <syntaxhighlight lang="bash"> | |||
| $ mv <PLUGIN_PATH> <REDMINE_DIR>/plugin/. | |||
| $ bundle install | |||
| $ touch <REDMINE_DIR>/tmp/restart.txt | |||
| </syntaxhighlight> | |||
| Redmineにアクセスすると再起動完了 | |||
| <syntaxhighlight lang="bash"> | |||
| $ rm <REDMINE_DIR>/tmp/restart.txt | |||
| </syntaxhighlight> | |||
| === ディレクトリの所有者を変更してmigrate === | |||
| <syntaxhighlight lang="bash"> | |||
| $ sudo chown -R www-data:www-data <PARENT_REDMINE_DIR> | |||
| $ cd <REDMINE_DIR> | |||
| $ sudo -u www-data bundle install | |||
| $ sudo -u www-data RAILS_ENV=production bundle exec rake db:migrate | |||
| $ sudo systemctl reload apache2 | |||
| </syntaxhighlight> | |||
| === メール通知の設定 === | |||
| <syntaxhighlight lang="bash"> | |||
| $ sudo -u www-data cp <REDMINE_DIR>/config/configuration.yml.example <REDMINE_DIR>/config/configuration.yml | |||
| $ sudo vim <REDMINE_DIR>/config/configuration.yml | |||
| </syntaxhighlight> | |||
| 以下を記載<br /> | |||
| (outlook.comのサーバーを使用することを想定) | |||
| <syntaxhighlight lang="YAML"> | |||
| production: | |||
|   email_delivery: | |||
|     delivery_method: :smtp | |||
|     smtp_settings: | |||
|       enable_starttls_auto: true | |||
|       address: "<SMTP_SERVER>" | |||
|       port: 587 | |||
|       domain: "<DOMAIN>" | |||
|       authentication: :login | |||
|       user_name: "<USER_NAME>" | |||
|       password: "<PASSWORD>" | |||
| </syntaxhighlight> | |||
| <syntaxhighlight lang="bash"> | |||
| $ sudo -u www-data touch <REDMINE_DIR>/tmp/restart.txt | |||
| </syntaxhighlight> | |||
| Redmineにアクセスすると再起動完了 | |||
| <syntaxhighlight lang="bash"> | |||
| $ sudo -u www-data rm <REDMINE_DIR>/tmp/restart.txt | |||
| </syntaxhighlight> | |||
2025年10月25日 (土) 19:24時点における最新版
Rubyのインストール
RedmineはRubyで動いているらしい
$ sudo apt install -y ruby
$ ruby -v
ruby 2.3.3p222 (2016-11-21) [arm-linux-gnueabihf]
Railsのインストール
Railsというフレームワークを使っているらしい
$ sudo gem install rails
エラー発生
ERROR:  Error installing rails:
        ERROR: Failed to build gem native extension.
    current directory: /var/lib/gems/2.3.0/gems/nokogiri-1.8.1/ext/nokogiri
/usr/bin/ruby2.3 -r ./siteconf20171226-14608-1mjalst.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
ruby-devをインストールすると解消されるらしい
$ sudo apt install -y ruby-dev
$ sudo gem install rails
$ rails -v
Rails 5.1.4
Bundlerのインストール
Redmineが使用するgemパッケージをインストールするのに使われるらしい
$ sudo gem install bundler --no-rdoc --no-ri
$ bundler -v
Bundler version 1.16.1
Apacheとヘッダファイルのインストール
$ sudo apt install -y apache2 apache2-dev libapr1-dev libaprutil1-dev
ImageMagickとヘッダファイル・日本語フォントのインストール
$ sudo apt install -y imagemagick libmagick++-dev fonts-takao-pgothic
エラー発生
E: パッケージ fonts-takao-pgothic が見つかりません
fonts-takao-pgothicはfonts-takao-gothicに含まれているっぽい
$ sudo apt install -y imagemagick libmagick++-dev fonts-takao-gothic
$ ls /usr/share/fonts/truetype/takao-gothic/
TakaoGothic.ttf  TakaoPGothic.ttf
Gitのインストール
$ sudo apt install -y git
DBの作成(MariaDB)
> CREATE DATABASE <DATABASE_NAME>;
> GRANT ALL PRIVILEGES ON <DATABASE_NAME>.* TO <USER_NAME>@<HOST>IDENTIFIED BY '<PASSWORD>';
Redmineのダウンロード
$ cd
$ wget http://www.redmine.org/releases/redmine-3.4.3.tar.gz
$ tar -zxvf redmine-3.4.3.tar.gz
$ sudo mkdir <PARENT_REDMINE_DIR>
$ sudo mv redmine-3.4.3 <PARENT_REDMINE_DIR>
データベースへの接続設定
$ cd <REDMINE_DIR>
$ cp config/database.yml.example config/database.yml
$ vim config/database.yml
以下を編集
production:
  adapter: mysql2
  database: <DATABASE_NAME>
  host: <HOST>
  username: <USER_NAME>
  password: "<PASSWORD>"
  encoding: utf8
他はコメントアウト
gemパッケージのインストール
$ bundle install --without development test
エラー発生
mysql client is missing. You may need to 'apt-get install libmysqlclient-dev' or 'yum install mysql-devel', and try
again.
...
An error occurred while installing mysql2 (0.4.10), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.4.10'` succeeds before bundling.
$ sudo apt install -y libmysqlclient-dev
エラー発生
E: パッケージ 'libmysqlclient-dev' にはインストール候補がありません
代わりにlibmariadbd-devをインストール
$ sudo apt install -y libmariadbd-dev
で、忘れそうになるけど、やりたかったのはこれ
$ bundle install --without development test
セッション改ざん防止用秘密鍵の作成
$ bundle exec rake generate_secret_token
バックアップデータをDBに流す
$ mysql -u <USER_NAME> -p<PASSWORD> -D <DATABASE_NAME> < <FILE_NAME>
Passengerのインストール
$ sudo gem install passenger --no-rdoc --no-ri
PassengerのApache用モジュールのインストール
$ sudo passenger-install-apache2-module --auto --languages ruby
エラー発生
...
 * Checking for Curl development headers with SSL support...
      Found: no
      Error: Cannot find the `curl-config` command.
...
 * Checking for OpenSSL development headers...
      Found: no
...
Installation instructions for required software
 * To install Curl development headers with SSL support:
   Please run apt-get install libcurl4-openssl-dev or libcurl4-gnutls-dev, whichever you prefer.
 * To install OpenSSL development headers:
   Please install it with apt-get install libssl-dev
...
libcurl4-openssl-devとlibssl-devをインストールすればいいらしい
$ sudo apt install -y libcurl4-openssl-dev libssl-dev
あらためて
$ sudo passenger-install-apache2-module --auto --languages ruby
Apache用設定内容の確認
$ passenger-install-apache2-module --snippet
LoadModule passenger_module /var/lib/gems/2.3.0/gems/passenger-5.1.12/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
  PassengerRoot /var/lib/gems/2.3.0/gems/passenger-5.1.12
  PassengerDefaultRuby /usr/bin/ruby2.3
</IfModule>
Apacheの設定
$ sudo vim /etc/apache2/conf-available/redmine.conf
以下の内容を記載
<Directory "<REDMINE_DIR>/public">
  Require all granted
</Directory>
LoadModule passenger_module /var/lib/gems/2.3.0/gems/passenger-5.1.12/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
  PassengerRoot /var/lib/gems/2.3.0/gems/passenger-5.1.12
  PassengerDefaultRuby /usr/bin/ruby2.3
</IfModule>
設定を反映
$ sudo a2enconf redmine
邪魔なconfをdisableに
$ sudo a2dissite 000-default.conf
$ sudo systemctl reload apache2
$ sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/<CONF_FILE_NAME>.conf
$ sudo vim /etc/apache2/sites-available/<CONF_FILE_NAME>.conf
以下の内容を記載
<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName <DOMAIN>
        ServerAdmin <MAIL_ADDRESS>
        DocumentRoot <REDMINE_DIR>/public
        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>
設定を反映
$ sudo a2ensite <CONF_FILE_NAME>
$ sudo systemctl reload apache2
プラグインの復旧
redmine_absolute_dates
日時表記を相対値から絶対値にするやつ
$ mv <PLUGIN_PATH> <REDMINE_DIR>/plugin/.
$ touch <REDMINE_DIR>/tmp/restart.txt
Redmineにアクセスすると再起動完了
$ rm <REDMINE_DIR>/tmp/restart.txt
redmine_issue_templates
チケット作成時にテンプレートを適用するやつ
$ mv <PLUGIN_PATH> <REDMINE_DIR>/plugin/.
$ touch <REDMINE_DIR>/tmp/restart.txt
Redmineにアクセスすると再起動完了
$ rm <REDMINE_DIR>/tmp/restart.txt
redmine_knowledgebase
ナレッジベース
新規に追加することはないだろうけど、過去に使ってたから一応
$ mv <PLUGIN_PATH> <REDMINE_DIR>/plugin/.
$ bundle install
$ touch <REDMINE_DIR>/tmp/restart.txt
Redmineにアクセスすると再起動完了
$ rm <REDMINE_DIR>/tmp/restart.txt
ディレクトリの所有者を変更してmigrate
$ sudo chown -R www-data:www-data <PARENT_REDMINE_DIR>
$ cd <REDMINE_DIR>
$ sudo -u www-data bundle install
$ sudo -u www-data RAILS_ENV=production bundle exec rake db:migrate
$ sudo systemctl reload apache2
メール通知の設定
$ sudo -u www-data cp <REDMINE_DIR>/config/configuration.yml.example <REDMINE_DIR>/config/configuration.yml
$ sudo vim <REDMINE_DIR>/config/configuration.yml
以下を記載
(outlook.comのサーバーを使用することを想定)
production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      enable_starttls_auto: true
      address: "<SMTP_SERVER>"
      port: 587
      domain: "<DOMAIN>"
      authentication: :login
      user_name: "<USER_NAME>"
      password: "<PASSWORD>"
$ sudo -u www-data touch <REDMINE_DIR>/tmp/restart.txt
Redmineにアクセスすると再起動完了
$ sudo -u www-data rm <REDMINE_DIR>/tmp/restart.txt