Redmineの構築手順です。Postgresqlを覚えたかったのでやってみました。
前提
OSはCentOS7
selinuxは無効化
必要なパッケージインストール
yum -y groupinstall "Development Tools"
yum -y install openssl-devel readline-devel zlib-devel curl-devel libyaml-devel libffi-devel
yum -y install postgresql-server postgresql-devel
yum -y install httpd httpd-devel
yum -y install ImageMagick ImageMagick-devel ipa-pgothic-fonts
ソースコードのダウンロード(その時の最新をDLしたらいいと)
curl -O https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.1.tar.gz
Rubyのビルド
tar xvf ruby-2.4.1.tar.gz
cd ruby-2.4.1
./configure --disable-install-doc
make
make install
cd ..
確認
ruby -v
bundlerインストール
gem install bundler --no-rdoc --no-ri
PostgreSQLの設定
データベースクラスタの新規作成
postgresql-setup initdb
RedmineからPostgreSQLに接続するための設定を追加
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
PostgreSQL起動、自動起動設定
systemctl start postgresql.service
systemctl enable postgresql.service
Redmine用ユーザーの作成
cd /var/lib/pgsql
sudo -u postgres createuser -P redmine
※コマンド実行後、パスワード入力
Redmine用データベースの作成
sudo -u postgres createdb -E UTF-8 -l ja_JP.UTF-8 -O redmine -T template0 redmine
Redmineのインストール
cd
svn co https://svn.redmine.org/redmine/branches/3.4-stable /var/lib/redmine
データベースへの接続設定
vim /var/lib/redmine/config/database.yml
※設定したパスワードに修正
production:
adapter: postgresql
database: redmine
host: localhost
username: redmine
password: "********"
encoding: utf8
設定ファイル config/configuration.yml の作成
vim /var/lib/redmine/config/configuration.yml
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
gemパッケージのインストール
cd /var/lib/redmine
bundle install --without development test --path vendor/bundle
Redmineの初期設定と初期データ登録
セッション改ざん
防止用秘密鍵の作成
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
Passengerのインストール
gem install passenger -v 5.1.12 --no-rdoc --no-ri
# PassengerのApache用モジュールのインストール
passenger-install-apache2-module --auto --languages ruby
# Apache用設定内容の確認
passenger-install-apache2-module --snippet
※ここで表示された設定をコピーして次のApache設定で貼る。
Apacheの設定
vim /etc/httpd/conf.d/redmine.conf
※以下記載
Alias /redmine /var/lib/redmine/public
<Location /redmine>
PassengerBaseURI /redmine
PassengerAppRoot /var/lib/redmine
</Location>
# Redmineの画像ファイル・CSSファイル等へのアクセスを許可する設定
<Directory "/var/lib/redmine/public">
Require all granted
</Directory>
# Passengerの基本設定
LoadModule passenger_module /usr/local/lib/ruby/gems/2.4.0/gems/passenger-5.1.12/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/lib/ruby/gems/2.4.0/gems/passenger-5.1.12
PassengerDefaultRuby /usr/local/bin/ruby
</IfModule>
# Passengerのチューニングのための設定
PassengerMaxPoolSize 20
PassengerMaxInstancesPerApp 4
PassengerPoolIdleTime 864000
PassengerStatThrottleRate 10
Header always unset "X-Powered-By"
Header always unset "X-Runtime
Apache起動、自動起動設定
systemctl start httpd.service
systemctl enable httpd.service
権限変更
chown -R apache:apache /var/lib/redmine
ブラウザ確認
http://サーバのIP/redmineで表示させる
ログイン/パスワードはadminでログインできます。
GUIで各種設定
プラグイン(例えば)
Flat theme
git clone https://github.com/tsi/redmine-theme-flat.git /var/lib/redmine/public/themes/flat
redmine_absolute_datetime
git clone git://github.com/syagawa/redmine_absolute_datetime.git /var/lib/redmine/plugins/redmine_absolute_datetime