10
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Redmine 3.4 を CentOS 7.4 にインストールする

Last updated at Posted at 2017-09-21

Redmine 3.4

CentOS 7.4.1708 に Redmine 3.4.2 をなるべくパッケージでインストールする手順です。
前回との大きな違いは Ruby が 2.3 から 2.4 に、Passenger も 4 から 5 に、GCC を 4 から
6 にバージョン変更しているところになります。
現時点では /issue を参照すると 500 エラーが出る致命的な状態で要調査。プラグインの影響か。
→ redmine_already_read が原因だったようです。

インストール

検証環境

  • VirtualBox 5.1.28 (homebrew-cask)

  • CentOS 7.4.1708 (minimal)

    • RHSCL 2.4 (centos-sclo-rh)
    • Ruby 2.4.0p0 (centos-sclo-rh)
    • MySQL 5.7.19 (mysql57-community)
    • Apache 2.4.6 (updates)
    • Passenger 5.1.8 (passenger)
    • Git 2.9.3 (centos-sclo-rh)
    • GCC 6.3.1 (centos-sclo-rh)
    • Redmine 3.4.2 (GitHub)

アップデート

yum clean all && yum -y update && reboot

Yum-axelget

yum -y install epel-release && yum -y update && yum -y install yum-axelget

RHSCL (Red Hat Software Collections) リポジトリ

yum -y install centos-release-scl-rh

Ruby / Bundler

yum -y install rh-ruby24{,-{ruby-devel,rubygem-bundler}} && \
source scl_source enable rh-ruby24 && \
echo -e '#!/bin/bash\nsource scl_source enable rh-ruby24' > /etc/profile.d/rh-ruby24.sh && \
ln -s /opt/rh/rh-ruby24/root/usr/lib64/libruby.so.2.4 /usr/lib64/

MySQL

yum -y install https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm && yum -y install mysql-community-server && \
echo -e '\ncharacter-set-server = utf8mb4' >> /etc/my.cnf && \
systemctl start mysqld && systemctl enable $_ && \
grep "temporary password" /var/log/mysqld.log | awk '{print $11}' && \
mysql_secure_installation --use-default

データベースと DB ユーザーの作成

cat << "_EOQ_" | mysql -u root -p
CREATE DATABASE `redmine` DEFAULT CHARACTER SET utf8mb4;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'P@ssw0rd';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
_EOQ_

Apache / Passenger

yum -y install yum-utils && yum-config-manager --add-repo https://oss-binaries.phusionpassenger.com/yum/definitions/el-passenger.repo && \
yum -y install httpd mod_passenger && \
rpm -e --nodeps ruby{,-{irb,libs},gem{s,-{bigdecimal,io-console,json,psych,rack,rake,rdoc}}} && \
systemctl start httpd && systemctl enable $_ && \
firewall-cmd --zone=public --add-service=http{,s} --permanent && firewall-cmd --reload

Git

yum -y install rh-git29 && source scl_source enable $_ && \
echo -e '#!/bin/bash\nsource scl_source enable rh-git29' > /etc/profile.d/rh-git29.sh
ln -s /opt/rh/rh-git29/root/usr/bin/* /usr/local/bin/

Devtoolset-6 (Red Hat Developer Toolset 6.0)

yum -y install devtoolset-6 && source scl_source enable $_ && \
echo -e '#!/bin/bash\nsource scl_source enable devtoolset-6' > /etc/profile.d/devtoolset-6.sh

必須ではないが、標準リポジトリでは GCC のバージョンが 4.8.5 と古いため。

その他ライブラリ

yum -y install {mysql-community,libxml2,libxslt,ImageMagick}-devel ipa-pgothic-fonts

Redmine

cd /var/www && git clone https://github.com/redmine/redmine.git && \
cd redmine && git checkout `git tag | tail -n 1` && \
bundle config build.nokogiri --local --use-system-libraries && \
cat << "_EOF_" > config/database.yml
production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: root
  password: P@ssw0rd
  encoding: utf8
_EOF_
bundle install --jobs=8 --without development test && \
bundle exec rake generate_secret_token && \
bundle exec rake db:migrate RAILS_ENV=production && \
bundle exec rake redmine:load_default_data RAILS_ENV=production REDMINE_LANG=ja && \
chown -R apache. /var/www/redmine && \
chmod -R 755 files log tmp public/plugin_assets

Apache の VirtualHost 設定

cat << _EOF_ > /etc/httpd/conf.d/redmine.conf
<VirtualHost *:80>
    ServerName example.com
    Header always unset "X-Powered-By"
    Header always unset "X-Runtime"
    PassengerRuby `which ruby`
    DocumentRoot /var/www/redmine/public
    <Directory /var/www/redmine/public>
        AllowOverride all
        Require all granted
        Options -MultiViews
    </Directory>
</VirtualHost>
_EOF_
systemctl restart httpd
setenforce 0 #TODO

テーマ

git clone --depth 1 https://github.com/akabekobeko/redmine-theme-minimalflat2 /var/www/redmine/public/themes/minimalflat && cd $_ && rm * -fr && git checkout origin/master -- src && mv src/* . && rmdir -p src && cd - && \
git clone --depth 1 https://github.com/tsi/redmine-theme-flat /var/www/redmine/public/themes/flat && \
git clone --depth 1 https://github.com/hardpixel/minelab /var/www/redmine/public/themes/minelab && \
git clone --depth 1 https://github.com/lqez/redmine-theme-basecamp-with-icon /var/www/redmine/public/themes/basecamp-with-icon && \
git clone --depth 1 https://github.com/makotokw/redmine-theme-gitmike /var/www/redmine/public/themes/gitmike

プラグイン

git clone --depth 1 https://github.com/syagawa/redmine_absolute_datetime /var/www/redmine/plugins/redmine_absolute_datetime && \
git clone --depth 1 https://github.com/haru/redmine_wiki_extensions /var/www/redmine/plugins/redmine_wiki_extensions && \
git clone --depth 1 https://github.com/AlphaNodes/redmine_tweaks /var/www/redmine/plugins/redmine_tweaks && \
git clone --depth 1 https://github.com/cdwertmann/line_numbers /var/www/redmine/plugins/line_numbers && \
git clone --depth 1 https://github.com/suer/redmine_japanese_help /var/www/redmine/plugins/redmine_japanese_help && \
git clone --depth 1 https://github.com/onozaty/redmine-view-customize /var/www/redmine/plugins/view_customize && \
git clone --depth 1 https://github.com/peclik/clipboard_image_paste /var/www/redmine/plugins/clipboard_image_paste && \
git clone --depth 1 https://github.com/akiko-pusu/redmine_issue_templates /var/www/redmine/plugins/redmine_issue_templates && \
git clone --depth 1 https://github.com/akiko-pusu/redmine_issue_badge /var/www/redmine/plugins/redmine_issue_badge && \
git clone --depth 1 https://github.com/akiko-pusu/redmine_banner /var/www/redmine/plugins/redmine_banner && \
git clone --depth 1 https://github.com/tleish/redmine_editor_preview_tab /var/www/redmine/plugins/redmine_editor_preview_tab && \
git clone --depth 1 https://github.com/stpl/redmine_issue_history /var/www/redmine/plugins/redmine_issue_history && \
git clone --depth 1 https://github.com/bdemirkir/sidebar_hide /var/www/redmine/plugins/sidebar_hide && \
git clone --depth 1 https://github.com/haru/redmine_theme_changer /var/www/redmine/plugins/redmine_theme_changer && \
cd /var/www/redmine && \
bundle install --jobs=8 --without development test && \
bundle exec rake redmine:plugins:migrate RAILS_ENV=production && \
systemctl restart httpd

Redmine 関連記事

10
18
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?