「Raspbian StretchにRedmine」の版間の差分
提供: オレッジベース
182行目: | 182行目: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | === Apacheの設定 === | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | $ sudo vim /etc/apache2/conf-available/redmine.conf | ||
+ | </syntaxhighlight> | ||
+ | 以下の内容を記載 | ||
+ | <syntaxhighlight lang="apache"> | ||
+ | <Directory "/var/www/redmine/redmine-3.4.3/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 <DMAIN>: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 <DMAIN> | ||
+ | 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> | ||
[[Category:RaspBerryPi]] | [[Category:RaspBerryPi]] |
2017年12月28日 (木) 00:21時点における版
目次
- 1 Rubyのインストール
- 2 Railsのインストール
- 3 Bundlerのインストール
- 4 Apacheとヘッダファイルのインストール
- 5 ImageMagickとヘッダファイル・日本語フォントのインストール
- 6 Gitのインストール
- 7 DBの作成(MariaDB)
- 8 Redmineのダウンロード
- 9 データベースへの接続設定
- 10 gemパッケージのインストール
- 11 セッション改ざん防止用秘密鍵の作成
- 12 バックアップデータをDBに流す
- 13 Passengerのインストール
- 14 PassengerのApache用モジュールのインストール
- 15 Apache用設定内容の確認
- 16 Apacheの設定
Rubyのインストール
RedmineはRubyで動いているらしい
$ sudo apt-get 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-get 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-get install -y apache2 apache2-dev libapr1-dev libaprutil1-dev
ImageMagickとヘッダファイル・日本語フォントのインストール
$ sudo apt-get install -y imagemagick libmagick++-dev fonts-takao-pgothic
エラー発生
E: パッケージ fonts-takao-pgothic が見つかりません
fonts-takao-pgothicはfonts-takao-gothicに含まれているっぽい
$ sudo apt-get install -y imagemagick libmagick++-dev fonts-takao-gothic
$ ls /usr/share/fonts/truetype/takao-gothic/
TakaoGothic.ttf TakaoPGothic.ttf
Gitのインストール
$ sudo apt-get 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-get install -y libmysqlclient-dev
エラー発生
E: パッケージ 'libmysqlclient-dev' にはインストール候補がありません
代わりにlibmariadbd-devをインストール
$ sudo apt-get 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-get 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 "/var/www/redmine/redmine-3.4.3/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 <DMAIN>: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 <DMAIN>
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