サイトマップ 連絡先 最初に戻る 戻る 次へ進む
$Date: 2018-07-07 06:49:13 +0900 (2018/07/07 (土)) $
$Revision: 1347 $

Redmine 3.3 のインストール (Fedora 24)

概要

Redmine のインストール方法を解説します。

必要なもの

インストール手順

ファイアーフォールの設定

http サービスの許可
[root@localhost ~]# firewall-cmd --permanent --add-service=http
success
[root@localhost ~]# firewall-cmd --reload
success

開発ツールのインストール

[root@localhost ~]# dnf -y groupinstall 'Development Tools'
[root@localhost ~]# dnf -y install gcc-c++

apache の有効化

[root@localhost ~]# systemctl start httpd.service
[root@localhost ~]# systemctl enable httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

Maria DB (MySQL) のインストール

[root@localhost ~]# dnf install -y mariadb-server mariadb-devel
[root@localhost ~]# vi /etc/my.cnf.d/mariadb-server.cnf
/etc/my.cnf.d/mariadb-server.cnf
# this is only for the mysqld standalone daemon
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mysqld/mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld]
character-set-server=utf8
.........
[root@localhost ~]# vi /etc/my.cnf.d/mysql-clients.cnf
/etc/my.cnf.d/mysql-clients.cnf
[mysql]
default-character-set=utf8
.........
Maria DB の起動、有効化設定
[root@localhost ~]# systemctl start mariadb
[root@localhost ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
データベースの初期設定
[root@localhost ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
データベースの設定とパスワードの設定
[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 10.1.14-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database redmine default character set utf8;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on redmine.* to redmine@localhost identified by 'password';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit;
Bye
文字コードの確認
[root@localhost ~]# mysql -u root --password
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 10.1.14-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show variables like 'character_set%';
+--------------------------+------------------------------+
| Variable_name            | Value                        |
+--------------------------+------------------------------+
| character_set_client     | utf8                         |
| character_set_connection | utf8                         |
| character_set_database   | utf8                         |
| character_set_filesystem | binary                       |
| character_set_results    | utf8                         |
| character_set_server     | utf8                         |
| character_set_system     | utf8                         |
| character_sets_dir       | /usr/share/mariadb/charsets/ |
+--------------------------+------------------------------+
8 rows in set (0.00 sec)

MariaDB [(none)]> exit;
Bye

Redmine の入手および設定

[root@localhost ~]# svn co http://svn.redmine.org/redmine/branches/3.3-stable /var/lib/redmine
[root@localhost ~]# cd /var/lib/redmine
[root@localhost redmine]# cp config/database.yml.example config/database.yml
[root@localhost redmine]# vi config/database.yml
config/database.yml
production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: password
  encoding: utf8
[root@localhost redmine]# chown -R apache:apache /var/lib/redmine
[root@localhost redmine]# dnf install -y ruby-devel rubygem-bundler
[root@localhost redmine]# dnf install -y libxml2-devel libxslt-devel ImageMagick-devel
[root@localhost redmine]# dnf install -y ipa-pgothic-fonts
[root@localhost redmine]# dnf install -y ipa-pgothic-fonts
[root@localhost redmine]# dnf -y install openssl-devel readline-devel zlib-devel curl-devel libyaml-devel libffi-devel
[root@localhost redmine]# dnf install -y redhat-rpm-config
[root@localhost redmine]# gem install nokogiri -v '1.6.8'
[root@localhost redmine]# bundle install
[root@localhost redmine]# bundle exec rake generate_secret_token
/usr/local/share/gems/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb:465: warning: key "inodot" is duplicated and overwritten on line 466

root@localhost redmine]# RAILS_ENV=production bundle exec rake db:migrate
apxs などのインストール
[root@localhost redmine]# dnf install -y httpd-devel.x86_64
passenger のインストール
[root@localhost redmine]# gem install passenger
passenger の Apache Module のインストール
[root@localhost redmine]# passenger-install-apache2-module --auto
passenger の設定の表示
[root@localhost redmine]# passenger-install-apache2-module --snippet
<IfModule mod_passenger.c>
  PassengerRoot /usr/local/share/gems/gems/passenger-5.0.29
  PassengerDefaultRuby /usr/bin/ruby
</IfModule>
[root@localhost redmine]# vi /etc/httpd/conf.d/redmine.conf
[root@localhost redmine]# cat /etc/httpd/conf.d/redmine.conf
LoadModule passenger_module /usr/local/share/gems/gems/passenger-5.0.29/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
  PassengerRoot /usr/local/share/gems/gems/passenger-5.0.29
  PassengerDefaultRuby /usr/bin/ruby
</IfModule>

<Directory "/var/lib/redmine/public">
  Require all granted
</Directory>

専用サーバーで動かす

/etc/httpd/conf/httpd.conf
#DocumentRoot "/var/www/html"
DocumentRoot "/var/lib/redmine/public"
[root@localhost redmine]# systemctl restart httpd.service

サブディレクトリで動かす

redmine のサブディレクトリで動かす方法
[root@localhost redmine]# cat /etc/httpd/conf.d/redmine.conf
LoadModule passenger_module /usr/local/share/gems/gems/passenger-5.0.29/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
  PassengerRoot /usr/local/share/gems/gems/passenger-5.0.29
  PassengerDefaultRuby /usr/bin/ruby
</IfModule>

<Directory "/var/lib/redmine/public">
  Require all granted
</Directory>

RackBaseURI /redmine
ドキュメントルートの設定変更 /etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/html"
ドキュメントルートのサブディレクトリにシンボリックリンクを張る
[root@localhost redmine]# ln -s /var/lib/redmine/public /var/www/html/redmine
Apache の再起動
[root@localhost redmine]# systemctl restart httpd.service