Redmine 3.2 インストール(CentOS 7)


ライブラリ インストール

sudo firewall-cmd --zone=public --add-service=http --permanent
sudo firewall-cmd --reload
sudo firewall-cmd --zone=public --list-services
sudo yum -y groupinstall "Development Tools"
sudo yum -y install openssl-devel readline-devel zlib-devel curl-devel libyaml-devel libffi-devel
sudo yum -y install postgresql-server postgresql-devel
sudo yum -y install httpd httpd-devel
sudo yum -y install ImageMagick ImageMagick-devel ipa-pgothic-fonts
sudo /etc/init.d/vboxadd setup
sudo systemctl stop firewalld
sudo systemctl disable firewalld
sudo systemctl start httpd
sudo systemctl enable firewalld
sudo systemctl start firewalld

HTML用ディレクトリ 書き換え可能設定

sudo vi /etc/httpd/conf/httpd.conf

<Directory />
  AllowOverride All
  Require all granted
</Directory>

wget https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.3.tar.gz
tar xvf ruby-2.2.3.tar.gz
cd ruby-2.2.3
./configure --disable-install-doc
make
sudo make install
sudo ln -s /usr/local/bin/ruby /usr/bin/ruby
sudo ln -s /usr/local/bin/gem /usr/bin/gem
sudo gem install bundler --no-rdoc --no-ri
sudo ln -s /usr/local/bin/bundle /usr/bin/bundle

データベース 初期設定

sudo postgresql-setup initdb
sudo vi /var/lib/pgsql/data/pg_hba.conf

# Put your actual configuration here
# ----------------------------------
#
# If you want to allow non-local connections, you need to add more
# "host" records. In that case you will also need to make PostgreSQL
# listen on a non-local interface via the listen_addresses
# configuration parameter, or via the -i or -h command line switches.
host redmine redmine 127.0.0.1/32 md5
host redmine redmine ::1/128 md5

sudo service postgresql start
sudo systemctl enable postgresql

sudo -u postgres psql

#CREATE ROLE redmine LOGIN CREATEDB PASSWORD 'redmine';
#\\q

su -
cd /var/lib/pgsql
sudo -u postgres createdb -E UTF-8 -l ja_JP.UTF-8 -O redmine -T template0 redmine
sudo -u postgres createdb -E UTF-8 -l ja_JP.UTF-8 -O redmine -T template0 redmine_development
sudo -u postgres createdb -E UTF-8 -l ja_JP.UTF-8 -O redmine -T template0 redmine_test
exit

sudo gem install bundler --no-rdoc --no-ri

Redmineソースコード ダウンロード

sudo svn co http://svn.redmine.org/redmine/branches/3.2-stable /var/lib/redmine
cd /var/lib/redmine/config/
sudo cp database.yml.example database.yml
sudo cp configuration.yml.example configuration.yml
sudo chmod 777 database.yml
sudo chmod 777 configuration.yml

cd /var/lib/redmine
vi config/database.yml

production:
  adapter: postgresql
  database: redmine
  host: localhost
  username: redmine
  password: "redmine"
  encoding: utf8

 

development:
  adapter: postgresql
  database: redmine_development
  host: localhost
  username: redmine
  password: "redmine"
  encoding: utf8

 

test:
  adapter: postgresql
  database: redmine_test
  host: localhost
  username: redmine
  password: "redmine"
  encoding: utf8

vi config/configuration.yml

production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: "localhost"
      port: 25
      domain: "example.com"

  rmagick_font_path: /usr/share/fonts/truetype/takao-gothic/TakaoPGothic.ttf

sudo bundle install --without development test --path vendor/bundle
sudo bundle exec rake generate_secret_token
sudo RAILS_ENV=production bundle exec rake db:migrate
sudo RAILS_ENV=production REDMINE_LANG=ja bundle exec rake redmine:load_default_datafault_data

sudo gem install passenger
sudo ln -s /usr/local/bin/passenger-install-apache2-module /usr/bin/passenger-install-apache2-module
sudo passenger-install-apache2-module --auto

Apache事前設定

sudo passenger-install-apache2-module --snippet

sudo touch /etc/httpd/conf.d/redmine.conf
sudo vi /etc/httpd/conf.d/redmine.conf

# Redmineの画像ファイル・CSSファイル等へのアクセスを許可する設定。
# Apache 2.4のデフォルトではサーバ上の全ファイルへのアクセスが禁止されている。
<Directory "/var/lib/redmine/public">
  AllowOverride All
  Require all granted
</Directory>

# Passengerの基本設定。
# passenger-install-apache2-module --snippet で表示された設定を記述。
# 環境によって設定値が異なるため以下の5行はそのまま転記せず、必ず
# passenger-install-apache2-module --snippet で表示されたものを使用すること。
#
LoadModule passenger_module /usr/local/lib/ruby/gems/2.2.0/gems/passenger-5.1.4/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
  PassengerRoot /usr/local/lib/ruby/gems/2.2.0/gems/passenger-5.1.4
  PassengerDefaultRuby /usr/local/bin/ruby
</IfModule>

# 必要に応じてPassengerのチューニングのための設定を追加(任意)。
# 詳しくはPhusion Passenger users guide(https://www.phusionpassenger.com/library/config/apache/reference/)参照。
PassengerMaxPoolSize 20
PassengerMaxInstancesPerApp 4
PassengerPoolIdleTime 864000
PassengerStatThrottleRate 10

Header always unset "X-Powered-By"
Header always unset "X-Runtime"

Alias /redmine /var/lib/redmine/public
<Location /redmine>
  PassengerBaseURI /redmine
  PassengerAppRoot /var/lib/redmine
</Location>

sudo chmod 755 config/database.yml
sudo chmod 755 config/configuration.yml
sudo chown -R apache:apache /var/lib/redmine

sudo service httpd configtest
sudo systemctl enable httpd
sudo service httpd restart

Redmine起動確認

Redmineインストールマシンを再起動後

ブラウザ上で
<Redmineインストール サーバーIPアドレス>/redmine
と入力します。

(動画では、vagrant private IPアドレス 192.168.33.10と入力)