redmine for CentOS7
--------------------------------------------------------------------------------
・前処理
・用意するもの
CentOS-8.1.1911-x86_64-dvd1.iso
--------------------------------------------------------------------------------
・Oracle VM VirtualBox マネージャ で 新規作成
・名前 redmine8
・タイプ Linux
・バージョン Other Linux (64bit)
・メモリサイズ 1024MB
・仮想ハードディスクを作成する
・ハードディスクのファイルタイプ: VDI(VirtualBox Disk Image)
・物理ハードディスクにあるストレージ: 可変サイズ
・ファイルの場所とサイズ: redmine8, 80GB
・[作成]
--------------------------------------------------------------------------------
・ストレージ
・CentOS-8.1.1911-x86_64-dvd1.iso
・[設定(S)] - ネットワーク(固定IP)
・ブリッジ・アダプタ
・[OK]
・[設定(S)] - ネットワーク(Local Only)
・NAT
・Host Only
・[OK]
--------------------------------------------------------------------------------
・インストール
・起動(T)
・Install CentOS 8
・Language: English (United States)
・DATE & TIME: Asia Tokyo
・KEYBOARD: Japanese
・SOFTWARE SELECTION: Minimal Install;
・KDUMP: disabled
・NETWORK & HOST ; Ethernet = ON; redmine8.mydomain
・[Begin Installation]
・ROOT PASSWORD
・USER CREATION
・(処理終了を待つ)
・Reboot
・Local Only の場合
/etc/sysconfig/network-scripts/ifcfg-enp0s8
ONBOOT=yes
・固定IPの場合
$ su -
# cd /etc/sysconfig/network-scripts
# cp ifcfg-enp0s3 _ifcfg-enp0s3_org
# vi ifcfg-enp0s3
# diff _ifcfg-enp0s3_org ifcfg-enp0s3
< BOOTPROTO="dhcp"
---
> BOOTPROTO="static"
> IPADDR="192.168.3.223"
> NETMASK="255.255.255.0"
> GATEWAY="192.168.3.1"
#
# vi /etc/resolv.conf
# cat /etc/resolv.conf
nameserver 192.168.3.1
#
・Reboot
# shutdown -r now
--------------------------------------------------------------------------------
・以降、client端末からsshでログインし、処理します。
--------------------------------------------------------------------------------
yum -y update
# reboot
shutdown -r now
yum -y install tar wget net-tools make
yum -y install \
zlib-devel curl-devel openssl-devel httpd-devel apr-devel \
apr-util-devel libffi-devel
yum -y install httpd
yum -y install mariadb mariadb-server mariadb-devel
systemctl start mariadb.service
systemctl enable mariadb.service
mysql -u root -p
パスワード入力はCR(Enter)だけ。
MariaDB [(none)]> set password for 'root'@'localhost' = password('...password...');
MariaDB [(none)]> create database redmine character set utf8;
MariaDB [(none)]> create user 'redmine'@'localhost' identified by '...password...';
MariaDB [(none)]> grant all privileges on redmine.* to 'redmine'@'localhost';
MariaDB [(none)]> exit
yum -y install gcc
yum -y install epel-release
yum config-manager --set-enabled PowerTools
yum -y install ImageMagick ImageMagick-devel
cd /usr/local/src
wget https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.0.tar.gz
tar xzf ruby-2.5.0.tar.gz
rm -f ruby-2.5.0.tar.gz
cd ruby-2.5.0
./configure
make && make install
gem update --system
gem install passenger
gem install bundler -v '1.5.0'
gem install rake -v '12.3.2'
gem list bundler
check bundler -v '1.5.0'
useradd redmine
yum -y install svn
yum -y install libxml2-devel libxslt-devel libxslt
cd /var/www
mkdir redmine
chown redmine:redmine redmine
su - redmine
cd /var/www
svn co http://svn.redmine.org/redmine/branches/3.4-stable redmine
cd /var/www/redmine/config
cp database.yml.example database.yml
vi database.yml
<<<
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: "...password..."
encoding: utf8
>>>
exit <-- return to root
cd /var/www/redmine
bundle config build.nokogiri --use-system-libraries
bundle _1.5.0_ install
バージョンの違いを調整し、上記コマンドが成功するまで繰り返す。
Make sure that `gem install ffi -v '1.12.2'` succeeds before bundling.
# gem install ffi -v '1.12.2'
......
yard config --gem-install-yri
RAILS_ENV=production bundle exec rake generate_secret_token
RAILS_ENV=production bundle exec rake db:migrate
firewall-cmd --zone=public --add-port=3000/tcp --permanent
firewall-cmd --reload
chown redmine:redmine /var/www/redmine/log/production.log
su - redmine
cd /var/www/redmine
/usr/local/bin/ruby bin/rails server -b 192.168.3.223 -e production <--- CHECK 192.168.3.223
Ctrl-C <-- terminate server
exit <-- return to root
yum -y install hg cvs git
vi /usr/lib/systemd/system/redmine.service
check 192.168.3.223
<<<
[Unit]
Description=Redmine server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=simple
User=redmine
Group=redmine
EnvironmentFile=/etc/sysconfig/httpd
ExecStart=/usr/local/bin/ruby /var/www/redmine/bin/rails server -b 192.168.3.223 -e production
TimeoutSec=300
ExecStop=/bin/kill -WINCH ${MAINPID}
[Install]
WantedBy=multi-user.target
>>>
vi /etc/httpd/conf.d/redmine.conf
<<<
<VirtualHost *:443>
ServerName my-server-name@my-domain.com
ServerAdmin my-admin-name@my-domain.com
ErrorLog "logs/redmine_error_log"
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/ca.crt
SSLCertificateKeyFile /etc/pki/tls/private/ca.key
DocumentRoot /var/www/redmine/public
<Directory /var/www/redmine/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
>>>
vi /var/www/redmine/public/.htaccess
<<<
# General Apache options
<IfModule cgi_module>
AddHandler cgi-script .cgi
</IfModule>
<IfModule mod_fastcgi.c>
AddHandler fastcgi-script .fcgi
</IfModule>
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
</IfModule>
Options +FollowSymLinks +ExecCGI
# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
#
# Example:
# RewriteCond %{REQUEST_URI} ^/notrails.*
# RewriteRule .* - [L]
# Redirect all requests not available on the filesystem to Rails
# By default the cgi dispatcher is used which is very slow
#
# For better performance replace the dispatcher with the fastcgi one
#
# Example:
# RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
RewriteEngine On
# If your Rails application is accessed via an Alias directive,
# then you MUST also set the RewriteBase in this htaccess file.
#
# Example:
# Alias /myrailsapp /path/to/myrailsapp/public
# RewriteBase /myrailsapp
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
<IfModule cgi_module>
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
</IfModule>
<IfModule mod_fastcgi.c>
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
</IfModule>
<IfModule mod_fcgid.c>
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
</IfModule>
# In case Rails experiences terminal errors
# Instead of displaying this message you can supply a file here which will be rendered instead
#
# Example:
ErrorDocument 500 /500.html
>>>
vi /var/www/redmine/public/dispatch.cgi
<<<
#!/usr/local/bin/ruby
require File.dirname(__FILE__) + '/../config/boot'
require File.dirname(__FILE__) + '/../config/environment'
class Rack::PathInfoRewriter
def initialize(app)
@app = app
end
def call(env)
env.delete('SCRIPT_NAME')
parts = env['REQUEST_URI'].split('?')
env['PATH_INFO'] = parts[0]
env['QUERY_STRING'] = parts[1].to_s
@app.call(env)
end
end
Rack::Handler::CGI.run Rack::PathInfoRewriter.new(RedmineApp::Application)
>>>
cd /var/www/redmine/public
chown -R apache:apache .
chmod +x dispatch.cgi
cd
yum provides /usr/sbin/semanage
yum -y install policycoreutils-python-utils
semanage boolean -m --on httpd_enable_cgi
semanage fcontext -a -t httpd_sys_script_exec_t /var/www/redmine/public
restorecon /var/www/redmine/public
setsebool -P httpd_can_network_connect 1
setsebool -P httpd_can_network_connect_db 1
ausearch -c 'dispatch.cgi' --raw | audit2allow -M my-dispatchcgi
semodule -i my-dispatchcgi.pp
<<< 上記の2つのコマンド、エラーが出るが、とりあえずスルー。
[root@localhost ~]# ausearch -c 'dispatch.cgi' --raw | audit2allow -M my-dispatchcgi
Nothing to do
[root@localhost ~]# semodule -i my-dispatchcgi.pp
libsemanage.map_file: Unable to open my-dispatchcgi.pp
(No such file or directory).
libsemanage.semanage_direct_install_file: Unable to read file my-dispatchcgi.pp
(No such file or directory).
semodule: Failed on my-dispatchcgi.pp!
>>>
vi /etc/sysconfig/httpd
<<<
LANG=C
>>>
systemctl start redmine.service
systemctl enable redmine.service
--------------------------------------------------------------------------------
・Redmine初期設定 (以前のメモから, https or http)
(a) ログイン https://192.168.3.223:3000 ID:admin/PW:admin
(b) admin ユーザのパスワードの変更
(c) adminの個人設定
(d) ユーザーの追加
(e) プロジェクトの追加
(f) プロジェクトのメンバーを追加
--------------------------------------------------------------------------------