ソフトウェア | バージョン |
---|---|
Redmine | Redmine 3.3.2 |
OS | CentOS 7.3 |
データベース | MariaDB 5.5.52 |
webサーバ | Apache 2.4.6 |
Ruby | Ruby 2.0.0 |
Passenger | Passenger 5.1.2 |
バージョン管理システム | Git 1.8.3.1 |
開発環境
# yum -y groupinstall "Development Tools"
# yum -y install openssl-devel readline-devel zlib-devel curl-devel libyaml-devel libffi-devel
Ruby (CentOS-Base リポジトリ)
# yum -y install ruby ruby-devel
MariaDB
# yum -y install mariadb-server mariadb-devel
Apache
# yum -y install httpd httpd-devel
ImageMagickとヘッダファイル・日本語フォント
# yum -y install ImageMagick ImageMagick-devel ipa-pgothic-fonts
bundler
# gem install bundler --no-rdoc --no-ri
[mysqld]
character-set-server=utf8
[mysql]
default-character-set=utf8
# systemctl start mariadb
# systemctl enable mariadb
# mysql -u root
> show variables like 'character_set%'; (filesystem と dir 以外全てが utf8 になっていること)
+--------------------------+----------------------------+
| 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/mysql/charsets/ |
+--------------------------+----------------------------+
> exit
# mysql_secure_installation
...
Enter current password for root (enter for none): (そのままエンター)
...
Set root password? [Y/n] (y応答)
New password: (新 root パスワードを入力)
Re-enter new password: (パスワード再入力)
...
Remove anonymous users? [Y/n] (y応答)
...
Disallow root login remotely? [Y/n] (y応答)
...
Remove test database and access to it? [Y/n] (y応答)
...
Reload privilege tables now? [Y/n] (y応答)
# mysql -u root -p
> create database db_redmine default character set utf8;
> grant all on db_redmine.* to user_redmine@localhost identified by '********';
(******** は user_redmine 用のパスワードを記述する)
> flush privileges;
> exit;
# curl -L -o redmine_3.3.2.zip https://github.com/redmine/redmine/archive/master.zip
# unzip redmine_3.3.2.zip
# mv redmine-master/ /var/lib/redmine
production:
adapter: mysql2
database: db_redmine
host: localhost
username: user_redmine
password: "********"
encoding: utf8
production:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: "localhost"
port: 25
domain: "example.com"
rmagick_font_path: /usr/share/fonts/ipa-pgothic/ipagp.ttf
# cd /var/lib/redmine
# bundle install --without development test --path vendor/bundle
Installing Passenger + Apache on Red Hat 7 / CentOS 7 (with RPM) - Passenger Library
# yum install pygpgme curl
# curl --fail -sSLo /etc/yum.repos.d/passenger.repo https://oss-binaries.phusionpassenger.com/yum/definitions/el-passenger.repo
# yum install -y mod_passenger || yum-config-manager --enable cr && yum install -y mod_passenger
# /usr/bin/passenger-config validate-install (設定確認)
# systemctl restart httpd
# /usr/sbin/passenger-memory-stats
/etc/httpd/conf.d/passenger.conf
### Begin automatically installed Phusion Passenger config snippet ###
<IfModule mod_passenger.c>
PassengerRoot /usr/share/ruby/vendor_ruby/phusion_passenger/locations.ini
PassengerRuby /usr/bin/ruby
PassengerInstanceRegistryDir /var/run/passenger-instreg
</IfModule>
### End automatically installed Phusion Passenger config snippet ###
# Deploying a web application: an example
# Suppose you have a web application in /somewhere. Add a virtual host to
# your Apache configuration file and set its DocumentRoot to /somewhere/public:
<VirtualHost *:80>
ServerName redmine.example.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /var/lib/redmine/public
<Directory /var/lib/redmine/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
# 画像ファイル・CSSファイル等へのアクセスを許可する
Require all granted
</Directory>
</VirtualHost>
# Passengerが追加するHTTPヘッダを削除するための設定(任意)。
Header always unset "X-Powered-By"
Header always unset "X-Runtime"
# 必要に応じてPassengerのチューニングのための設定を追加(任意)。
# 詳しくはPhusion Passenger users guide(https://www.phusionpassenger.com/library/config/apache/reference/)参照。
PassengerMaxPoolSize 20
PassengerMaxInstancesPerApp 4
PassengerPoolIdleTime 864000
PassengerHighPerformance on
PassengerStatThrottleRate 10
PassengerSpawnMethod smart
PassengerFriendlyErrorPages off
# bundle exec rake generate_secret_token
# RAILS_ENV=production bundle exec rake db:migrate
# RAILS_ENV=production REDMINE_LANG=ja bundle exec rake redmine:load_default_data
#!/bin/bash
chown -R apache. /var/lib/redmine
chcon -Rh -t httpd_sys_content_t /var/lib/redmine
cd /var/lib/redmine
chcon -Rh -t httpd_log_t log
chcon -Rh -t httpd_tmpfs_t tmp
chcon -Rh -t httpd_sys_rw_content_t files public/plugin_assets
find . -name '*.so' | xargs -i chcon -Rvh -t httpd_modules_t {}
# リポジトリとして使用するフォルダ
chcon -Rh -t public_content_t /home/Shared/
# firewall-cmd --add-service=http --permanent
# firewall-cmd --reload
# systemctl start httpd
# systemctl enable httpd
# cd /var/lib/redmine/
# RAILS_ENV=production rake 'project_data:export[identifier,destdir]'
# cd /var/lib/redmine/
# cp -R destdir/files/ .
# chown -R apache. files/
# chcon -Rh -t httpd_sys_content_t files/
# cat destdir/identifier.sql | mysql -u user_redmine -p db_redmine