Oracle Linux 7 にRedmine-4.2.2をインストール

Tech > 各種技術情報

Redmineの導入のメモ、現時点でOL8は標準ruby2.5が入っているのですがRoRまわりが足りなそうだったので回避、CentOS7の情報は沢山あったのであえてOL7でお試しです。

環境

OSは最小構成でインストール、SELinuxはdisabledへ設定。

項番 パッケージ バージョン 備考
1 Ruby 2.5
2 Redmine 4.2.2 オフィシャルからDL
3 Ruby on Rails 5.0.8 oracle-softwarecollection-7
4 Apache 2.4 oracle-softwarecollection-7
5 Passenger 4.0.50 oracle-softwarecollection-7
6 PostgreSQL 9.2

OSCリポジトリの追加

外部リポジトリoracle-softwarecollectionを追加

shell root > yum install -y oracle-softwarecollection-release-el7

開発パッケージ

bundle installでビルドが必要なため開発ツールをいれる、面倒なのでgroupinstallする。

shell root > yum -y groupinstall "Development Tools"

Rubyインストール

shell root > yum install -y rh-ruby25-ruby rh-ruby25-ruby-devel rh-ruby25-rubygem-bundler

パスを設定しておく

必要なユーザーの.bash_profileのPATHへ追記する

/opt/rh/rh-ruby25/root/usr/bin
shell > source .bash_profile

共有ライブラリ読み込みの設定

ldconfigのファイルを作成し、ライブラリのパスを設定する

/etc/ld.so.conf.d/rh-ruby25.conf
shell root > # ldconfig
shell root > # ruby --version
ruby 2.5.9p229 (2021-04-05 revision 67939) [x86_64-linux]

Apacheインストール

shell root > yum install -y httpd24

Passengerインストール

httpd24用のmod_passengerをインストールする

shell root > yum install -y rh-passenger40-mod_passenger

Ruby on Railsインストール

shell root > yum install -y rh-ror50

PostgreSQLインストール

shell root > yum install -y postgresql-server postgresql-devel

データベース初期化

postgresユーザーで実行する

shell root > su - postgres
shell postgres > initdb -D /var/lib/pgsql/data/ -E UTF-8

postgresql.conf修正

datestyleはディフォルトを利用する

listen_addresses = 'localhost'
datestyle = 'iso, ymd'
lc_messages = 'ja_JP.UTF-8'

postgresql service起動

shell root > systemctl start postgresql
shell root > systemctl enableo postgresql

Redmineインストール

shell root > cd /var/lib/
shell root > tar -xzvf redmine-4.2.2.tar.gz
shell root > chown -R apache:apache redmine-4.2.2
shell root > ln -s redmine-4.2.2 redmine

Redmineコンフィグレーション設定

メール等送信する場合は設定する

shell root > cd /var/lib/redmine/config
shell root > cp configuration.yml.example configuration.yml
shell root > chown apache:apache configuration.yml
shell root > chmod 0777 configuration.yml

Redmineデータベース設定

PostgreSQLへ接続するProduction設定を追加

shell root > cd /var/lib/redmine/config
shell root > cp database.yml.example database.yml
shell root > chown apache:apache database.yml
shell root > chmod 0777 database.yml

PostgreSQL用設定値修正

production:
  adapter: postgresql
  database: redmine
  host: localhost
  username: redmine
  password: "redminepass"

Redmine用接続ユーザー作成

設定値は database.yml で指定したもので初期化

shell root > createuser -U postgres -i -l -S -d redmine -P
shell root > 新しいロールのためのパスワード:
shell root > もう一度入力してください:

Redmine用データベース作成

shell root > createdb -U redmine -E UTF-8 redmine

bundleインストール

Redmineの必要なrubyライブラリのインストール

必要開発パッケージ追加

bundle実行時にビルドエラーになるので利用しない場合でも入れておく

shell root > yum install -y mariadb-devel

bundle実行

shell root > cd /var/lib/redmine
shell root > bundle install
...
...
Fetching yard 0.9.26
Installing yard 0.9.26
Bundle complete! 37 Gemfile dependencies, 87 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Post-install message from rubyzip:
RubyZip 3.0 is coming!
**********************

The public API of some Rubyzip classes has been modernized to use named
parameters for optional arguments. Please check your usage of the
following classes:
  * `Zip::File`
  * `Zip::Entry`
  * `Zip::InputStream`
  * `Zip::OutputStream`

Please ensure that your Gemfiles and .gemspecs are suitably restrictive
to avoid an unexpected breakage when 3.0 is released (e.g. ~> 2.3.0).
See https://github.com/rubyzip/rubyzip for details. The Changelog also
lists other enhancements and bugfixes that have been implemented since
version 2.3.0.

Redmine用データベース情報マイグレーション

shell root > cd /var/lib/redmine
shell root > bundle exec rake generate_secret_token
shell root > RAILS_ENV=production bundle exec rake db:migrate

Redmineディフォルト言語設定

shell root > cd /var/lib/redmine
shell root > RAILS_ENV=production REDMINE_LANG=ja bundle exec rake redmine:load_default_data
Default configuration data loaded.

Apache + Passenger定設

webサーバーの設定を行う

Passenger設定

デバック出力を確認したい場合、 PassengerLogLevel を3に設定する、0~3で設定可能。

<IfModule mod_passenger.c>
    PassengerRoot /opt/rh/rh-passenger40/root/usr/share/passenger//phusion_passenger/locations.ini
    PassengerDefaultRuby /opt/rh/rh-ruby25/root/usr/bin/ruby
    PassengerLogLevel           0
    PassengerMaxPoolSize        20
    PassengerMaxInstancesPerApp 4
    PassengerPoolIdleTime       600
    PassengerStatThrottleRate   10
</IfModule>

Passenger Module設定

パッケージでインストールされる

LoadModule passenger_module modules/mod_passenger.so

vhost設定

redmine用にバーチャルホストを設定しLocationでPassengerが動くようにする

<VirtualHost *:80>
    DocumentRoot /var/lib/redmine/public
    RailsEnv production
    <Directory "/var/lib/redmine/public">
        Options FollowSymLinks
        Require all granted
        AllowOverride All
    </Directory>
</VirtualHost>

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

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

ApacheモジュールOption設定

OPTIONに必要なモジュールを明記する

OPTIONS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PASSENGER"

Apache Service起動

shell root > systemctl start httpd24-httpd
shell root > systemctl enable httpd24-httpd

Firewall設定

アクセスを通す

shell root > firewall-cmd --zone=public --add-service=http --permanent

初期ログイン

  • ログインURL
    • http://[IP]/redmine
  • ログインアカウント
    • ID: admin
    • Password: admin

Posted on 2021-08-16 13:57:14

はじめまして

お茶の国静岡で、焼酎のお茶割なんか罰当たりで飲んだことはありません、常に一番搾りを嗜む静岡極東のBBQerです、最近まわりのエンジニアの方々がお料理を上手にやっている姿を恨めしそうに横目に見ながら、軟骨ピリ辛チクワを食べています、みなさんよろしく。

Posted

Amazon

tags

家系 日本酒池 広井酒店 やがら やっぱた 刺身 丸干し 鯵 東京マラソン fpm php82 servant thread spawn Rust Oracle Linux 8 microcode firmware linux openzfs zfs gitea 麒麟 真野鶴 金鶴 日本酒 docker oracle pod podman cli virtualbox VirtualBox epub mobi calibre mask lens ワンライナー php 海 redmine Linux Oracle Map OMap omap map 夏 BBQ カテゴリ管理 カテゴリ timestamp date oracle database string 麦焼酎 ダービー process 磨き蒸留 広井酒店、日本酒 芋焼酎 酒 焼酎 ゆるキャン 広井酒店、日本酒池 spring framework java persistent spring session session spring hdbc-odbc persistent-odbc odbc day utctime スィート レマンの森 elm初期化 elm バイク xlr80 esqueleto database xl2tpd strongswan vpn l2tp ipsec 正月 ゲーム grub nginx systemctl portage 豚骨 圧力鍋 yesod-auth-hashdb yesod-auth