-------------------------------------------------------------------------------- ・参照 https://www.redmine.org/projects/redmine/wiki/RedmineInstall https://www.redmine.org/projects/redmine/wiki/Install_Redmine_34_on_RHEL74 ・注意 ・Windows10上にVirtualBoxでLinux環境を構築します。 ・インターネットにつながっていること(外部接続できること) -------------------------------------------------------------------------------- ・前処理 ・用意するもの CentOS-7-x86_64-DVD-1810.iso ・準備 ・マウント: CentOS-7-x86_64-DVD-1810.iso -------------------------------------------------------------------------------- ・Oracle VM VirtualBox マネージャ で 新規作成 ・名前 redmine ・タイプ Linux ・バージョン Other Linux (64bit) ・メモリサイズ 1024MB ・仮想ハードディスクを作成する ・ハードディスクのファイルタイプ: VDI(VirtualBox Disk Image) ・物理ハードディスクにあるストレージ: 可変サイズ ・ファイルの場所とサイズ: redmine, 80GB ・[作成] -------------------------------------------------------------------------------- ・ネットワーク設定 ・[設定(S)] - ネットワーク ・割り当て(A): ブリッジアダプター ・[OK] -------------------------------------------------------------------------------- ・インストール ・起動(T) ・Install CentOS 7 ・Language: English (United States) ・DATE & TIME: Asia Tokyo ・KEYBOARD: Japanese ・SOFTWARE SELECTION: Minimal Install; ・KDUMP: disabled ・NETWORK & HOST ; Ethernet = ON; ・[Begin Installation] ・ROOT PASSWORD ・USER CREATION ・(処理終了を待つ) ・Reboot ・固定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" # ・Reboot # shutdown -r now ・DNS Client # vi /etc/resolv.conf # cat /etc/resolv.conf nameserver 192.168.3.1 # -------------------------------------------------------------------------------- ・以降、client端末からsshでログインし、処理します。 -------------------------------------------------------------------------------- yum -y update reboot yum -y install wget lynx net-tools yum -y install \ zlib-devel curl-devel openssl-devel httpd-devel apr-devel \ apr-util-devel mysql-devel ImageMagick-devel libffi-devel yum -y install mariadb mariadb-server mariadb-devel systemctl start mariadb.service systemctl enable mariadb.service mysql -u root -p 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'; yum -y install gcc 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 rmagick -v '2.16.0'` succeeds before bundling. gem install rmagick -v '2.16.0' ...... 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 su - redmine cd /var/www/redmine /usr/local/bin/ruby bin/rails server -b 192.168.3.223 -e production Ctrl-C <-- terminate server exit <-- return to root yum -y install darcs hg cvs bzr git vi /usr/lib/systemd/system/redmine.service <<< [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 -y install policycoreutils-python 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 <<< ここで以下のように、エラーが出るがとりあえずスルー。 [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! >>> systemctl start redmine.service systemctl enable redmine.service -------------------------------------------------------------------------------- ・Redmine初期設定 (以前のメモから) (a) ログイン https://192.168.3.223:3000 ID:admin/PW:admin (b) admin ユーザのパスワードの変更 (c) adminの個人設定 (d) ユーザーの追加 (e) プロジェクトの追加 (f) プロジェクトのメンバーを追加 --------------------------------------------------------------------------------