{"id":1998,"date":"2019-02-27T20:39:30","date_gmt":"2019-02-27T11:39:30","guid":{"rendered":"https:\/\/test.ji0vwl.net\/?p=1998"},"modified":"2019-12-02T12:37:41","modified_gmt":"2019-12-02T03:37:41","slug":"redmine-4-0-%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%abcentos7apache2-4mariadb10","status":"publish","type":"post","link":"https:\/\/ji0vwl.net\/index.php\/2019\/02\/27\/1998\/","title":{"rendered":"Redmine 4.0 \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb(Apache2.4+MariaDB)"},"content":{"rendered":"<p><a href=\"https:\/\/aws.amazon.com\/jp\/lightsail\/\">Amazon Lightsail<\/a> CentOS7\u306b<a href=\"http:\/\/redmine.jp\">Redmine<\/a>\u3092\u5165\u308c\u3066\u307f\u305f\u306e\u3067\u3001\u899a\u66f8\u3002<a href=\"http:\/\/redmine.jp\">Redmine<\/a>\u306f<a href=\"https:\/\/rubyonrails.org\">Ruby on Rails<\/a>\u306e\u4e0a\u3067\u52d5\u4f5c\u3057\u3066\u3044\u308b\u3088\u3046\u3067\u3059\uff08\u4eca\u307e\u3067\u4ed5\u4e8b\u3067\u6563\u3005\u4f7f\u3063\u3066\u304d\u305f\u306e\u306b\u3001\u304a\u6065\u305a\u304b\u3057\u306a\u304c\u3089\u521d\u3081\u3066\u77e5\u3063\u305f\u3068\u3044\u3046\u7b11\uff09\u3002<\/p>\n<h4>\u74b0\u5883<\/h4>\n<p>\u30fbCentOS \u00a07.6.1810<\/p>\n<p>\u30fbApache 2.4.38<\/p>\n<p>\u30fbMariaDB\u00a010.3.13<\/p>\n<p>\u30fbRuby 2.5.3<\/p>\n<p>\u30fbRuby on Rails 5.2.2<\/p>\n<p>\u30fbRedmine 4.0<\/p>\n<p><a href=\"https:\/\/test.ji0vwl.net\/index.php\/2019\/02\/04\/1894\/\">Apache 2.4.38<\/a>\u3001<a href=\"https:\/\/test.ji0vwl.net\/index.php\/2018\/12\/24\/1436\/\">MariaDB<\/a>\u3001<a href=\"https:\/\/test.ji0vwl.net\/index.php\/2018\/12\/24\/1436\/\">Let&#8217;s Encrypt(certbot)<\/a>\u306f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u6e08\u307f\u306e\u524d\u63d0\u3067\u9032\u3081\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h4>1. \u5fc5\u8981\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u3044\u308d\u3044\u308d\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h4>\n<pre>$ sudo -i\r\n# yum -y update\r\n# yum -y install openssl-devel readline-devel zlib-devel curl-devel libyaml-devel libffi-devel ruby-devel bzip2 git\r\n# yum -y install httpd-devel\r\n# (yum --disablerepo=base,extras,updates --enablerepo=ius -y install httpd-devel) \u203bius\u304b\u3089httpd\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3044\u308b\u5834\u5408\r\n# yum -y install ImageMagick ImageMagick-devel ipa-pgothic-fonts\r\n# yum -y install MariaDB-devel MariaDB-shared<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4>2. Ruby 2.5.3\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h4>\n<p>Ruby\u306f\u76f4\u63a5\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u306e\u3067\u306a\u304f\u3001Rbenv\u3092\u4ecb\u3057\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<pre># git clone https:\/\/github.com\/rbenv\/rbenv.git ~\/.rbenv\r\n# git clone git:\/\/github.com\/sstephenson\/ruby-build.git ~\/.rbenv\/plugins\/ruby-build\r\n# vim ~\/.bashrc\r\n--------------------------------------\r\n.\r\n.\r\n# rbenv\r\nexport PATH=\"$HOME\/.rbenv\/bin:$PATH\"\r\neval \"$(rbenv init -)\"\r\n--------------------------------------\r\n:wq\r\n--------------------------------------\r\n# source ~\/.bashrc\r\n# rbenv -v\r\n# rbenv install --list\r\n# rbenv install 2.5.3    # \u6642\u9593\u304c\u304b\u304b\u308a\u307e\u3059\r\n# rbenv global 2.5.3\r\n# ruby -v<\/pre>\n<p>&nbsp;<\/p>\n<h4>3. Ruby on Rails 5.2.2\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h4>\n<p>bundle\u306froot\u3067\u5b9f\u884c\u3059\u308b\u306a\u3001\u3068\u8b66\u544a\u304c\u51fa\u307e\u3059\u304c\u7121\u8996\u3002root\u3058\u3083\u306a\u3044\u30e6\u30fc\u30b6\u3067\u3084\u3063\u305f\u3089\u8272\u3005\u30cf\u30de\u3063\u305f\u306e\u3067\u3002<\/p>\n<pre># gem install bundler\r\n# gem query -ra -n  \"^rails$\"\r\n# mkdir \/usr\/local\/rails_v5.2.2\r\n# cd \/usr\/local\/rails_v5.2.2\r\n# bundle init\r\n# echo 'gem \"rails\", \"5.2.2\"' &gt;&gt; Gemfile\r\n# gem install mysql2 -v '0.5.2'\r\n# bundle install --without development test --path vendor\/bundle<\/pre>\n<p>&nbsp;<\/p>\n<h4>4. \u00a0Passenger 6.0.2 \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h4>\n<p>Rails\u3092\u52d5\u304b\u3059\u305f\u3081\u306eApache\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u3042\u308bPassenger\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<strong>\u3082\u306e\u3059\u3054\u304f\u6642\u9593\u304c\u304b\u304b\u308a\u307e\u3059<\/strong>\u3002<a href=\"https:\/\/aws.amazon.com\/jp\/lightsail\/pricing\/\">Lightsail $3.5<\/a>\u306e\u6700\u5f31\u30d7\u30e9\u30f3\u306730\u5206\u4ee5\u4e0a\u3002<\/p>\n<p>apache2\u30e2\u30b8\u30e5\u30fc\u30eb\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u524d\u306b\u3001chmod o+x &#8220;\/root&#8221;\u3067\u305d\u306e\u4ed6\u30e6\u30fc\u30b6\u306b\u5b9f\u884c\u6a29\u9650\u3092\u4ed8\u4e0e\u3057\u3066\u304a\u304f\u306e\u304c\u809d\u3002\u305d\u3057\u3066\u3001httpd\u306eapxs\u306e\u30d1\u30b9\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002httpd\u3092yum\u3067\u5165\u308c\u3066\u3044\u308b\u307e\u3068\u3082\u306a\u4eba\u306f &#8211;apxs2-path \u306e\u4ee3\u308f\u308a\u306b &#8211;auto\u3067\u826f\u3044\u3067\u3059\u3002<\/p>\n<pre># gem install passenger\r\n# chmod o+x \"\/root\"\r\n# passenger-install-apache2-module --apxs2-path \"\/usr\/local\/httpd3\/bin\/apxs\"      # \u3081\u3061\u3083\u304f\u3061\u3083\u6642\u9593\u304c\u304b\u304b\u308a\u307e\u3059\r\n1\r\n[Enter]\r\n\u25cfRuby\r\n\u25cfPython\r\n[Enter]\r\ny\r\n[Enter]\r\n.\r\n.\r\n.\r\n\u260530\u5206\u4ee5\u4e0a\u3002\u6c17\u9577\u306b\u5f85\u3061\u307e\u3057\u3087\u3046\u2605\r\n.\r\n.\r\n[Enter]\r\n[Enter]<\/pre>\n<p>&nbsp;<\/p>\n<h4>5.\u00a0MariaDB\u306bRedmine\u7528\u306eDB\u3068\u30e6\u30fc\u30b6\u3092\u4f5c\u6210<\/h4>\n<pre># mysql -u root -p\r\n&gt; create database redmine_db default character set utf8;\r\n&gt; create user 'redmine_ur'@'localhost' IDENTIFIED BY '************';\r\n&gt; grant all on redmine_db.* to redmine_ur@localhost identified by '************';\r\n&gt; exit;<\/pre>\n<p>&nbsp;<\/p>\n<h4>6. Redmine 4.0\u3092 \/var\/lib\/redmine \u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h4>\n<pre># svn co http:\/\/svn.redmine.org\/redmine\/branches\/4.0-stable \/var\/lib\/redmine\r\n# vim \/var\/lib\/redmine\/config\/database.yml\r\n--------------------------------------\r\nproduction:\r\n  adapter: mysql2\r\n  database: redmine_db\r\n  host: localhost\r\n  username: redmine_ur\r\n  password: \"************\"\r\n  encoding: utf8\r\n--------------------------------------\r\n:wq\r\n--------------------------------------\r\n\r\n# vim \/var\/lib\/redmine\/config\/configuration.yml\r\n--------------------------------------\r\nproduction:\r\n  email_delivery:\r\n    delivery_method: :smtp\r\n    smtp_settings:\r\n      address: \"localhost\"\r\n      port: 25\r\n      domain: \"redmine.ji0vwl.net\"\r\n\r\n  rmagick_font_path: \/usr\/share\/fonts\/ipa-pgothic\/ipagp.ttf\r\n--------------------------------------\r\n:wq\r\n--------------------------------------\r\n\r\n# cd \/var\/lib\/redmine\/\r\n# bundle update\r\n# bundle exec rake generate_secret_token\r\n# RAILS_ENV=production bundle exec rake db:migrate\r\n# RAILS_ENV=production REDMINE_LANG=ja bundle exec rake redmine:load_default_data\r\n# sudo chown -R apache:apache \/var\/lib\/redmine\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h4>7. httpd\u306e\u30d0\u30fc\u30c1\u30e3\u30eb\u30db\u30b9\u30c8\u8a2d\u5b9a<\/h4>\n<p>DocumentRoot\u306fRedmine\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5148\u306e\u00a0\/var\/lib\/redmine\/public \u3068\u3057\u3001passenger-install-apache2-module &#8211;snippet \u3067\u5f97\u3089\u308c\u305f\u5fdc\u7b54\u3092\u3001HTTPS\u306e\u30d0\u30fc\u30c1\u30e3\u30eb\u30db\u30b9\u30c8\u5185\u306b\u8cbc\u308a\u4ed8\u3051\u307e\u3059\u3002HTTP\u306e\u30d0\u30fc\u30c1\u30e3\u30eb\u30db\u30b9\u30c8\u306f\u3001 HTTPS\u3078\u306e\u30ea\u30e9\u30a4\u30c8\u51e6\u7406\u306e\u307f\u3067OK\u3002<\/p>\n<pre># passenger-install-apache2-module --snippet\r\nLoadModule passenger_module\/root\/.rbenv\/versions\/2.5.3\/lib\/ruby\/gems\/2.5.0\/gems\/passenger-6.0.2\/buildout\/apache2\/mod_passenger.so\r\n&lt;IfModule mod_passenger.c&gt;\r\n  PassengerRoot \/root\/.rbenv\/versions\/2.5.3\/lib\/ruby\/gems\/2.5.0\/gems\/passenger-6.0.2\r\n  PassengerDefaultRuby \/root\/.rbenv\/versions\/2.5.3\/bin\/ruby\r\n&lt;\/IfModule&gt;\r\n# vim \/usr\/local\/httpd3\/conf\/extra\/httpd-vhosts-http.conf\r\n--------------------------------------\r\n.\r\n.\r\n&lt;VirtualHost *:80&gt;\r\n    DocumentRoot \/var\/lib\/redmine\/public\r\n    ServerName redmine.ji0vwl.net\r\n\r\n    &lt;Directory \"\/var\/lib\/redmine\/public\/public\/\"&gt;\r\n        Options FollowSymlinks Includes\r\n        AllowOverride All\r\n        AddType text\/html .html\r\n        Require all granted\r\n    &lt;\/Directory&gt;\r\n\r\n    RewriteEngine on\r\n    RewriteCond %{SERVER_NAME} =redmine.ji0vwl.net\r\n    RewriteRule ^ https:\/\/%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]\r\n&lt;\/VirtualHost&gt;\r\n--------------------------------------\r\n:wq\r\n--------------------------------------\r\nvim \/usr\/local\/httpd3\/conf\/extra\/httpd-vhosts-https.conf\r\n--------------------------------------\r\n.\r\n.\r\n.\r\n&lt;IfModule mod_ssl.c&gt;\r\n&lt;VirtualHost *:443&gt;\r\n    DocumentRoot \/var\/lib\/redmine\/public\r\n    ServerName redmine.ji0vwl.net\r\n\r\n    &lt;Directory \"\/var\/lib\/redmine\/public\/\"&gt;\r\n        Options FollowSymlinks Includes\r\n        AllowOverride All\r\n        AddType text\/html .html\r\n        Require all granted\r\n    &lt;\/Directory&gt;\r\n.\r\n.\r\n.\r\n    # passenger-install-apache2-module --snippet \u306e\u7d50\u679c\u3092VirtualHost\u5185\u306b\u8cbc\u308b\r\n    LoadModule passenger_module \/root\/.rbenv\/versions\/2.5.3\/lib\/ruby\/gems\/2.5.0\/gems\/passenger-6.0.2\/buildout\/apache2\/mod_passenger.so\r\n    &lt;IfModule mod_passenger.c&gt;\r\n      PassengerRoot \/root\/.rbenv\/versions\/2.5.3\/lib\/ruby\/gems\/2.5.0\/gems\/passenger-6.0.2\r\n      PassengerDefaultRuby \/root\/.rbenv\/versions\/2.5.3\/bin\/ruby\r\n    &lt;\/IfModule&gt;\r\n&lt;\/VirtualHost&gt;\r\n&lt;\/IfModule&gt;\r\n--------------------------------------\r\n# systemctl restart httpd3\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h4>8. Let&#8217;s Encrypt SSL\u8a3c\u660e\u66f8\u306b\u30b5\u30d6\u30c9\u30e1\u30a4\u30f3\u8ffd\u52a0<\/h4>\n<p>certbot certonly\u3067\u3001\u30b5\u30d6\u30c9\u30e1\u30a4\u30f3\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002\u5148\u306bDNS\u8a2d\u5b9a\u3092\u3057\u3066\u304a\u304f\u3053\u3068\u3092\u304a\u5fd8\u308c\u306a\u304f\u3002<\/p>\n<pre># certbot certonly\r\n.\r\n.\r\n.\r\n\r\n# systemctl restart httpd3<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/redmine.ji0vwl.net\">Redmine<\/a>\u304c\u7acb\u3061\u4e0a\u304c\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u5b9f\u306f\u3046\u307e\u304f\u52d5\u304b\u305a\u30014\u56de\u304f\u3089\u3044\u30c6\u30b9\u30c8\u7528\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u3063\u3066\u306f\u6f70\u3057\u3066\u3092\u7e70\u308a\u8fd4\u3057\u307e\u3057\u305f\u3002\u3053\u3046\u3044\u3046\u306e\u304c\u3067\u304d\u308b\u306e\u304cAWS\u306e\u3044\u3044\u3068\u3053\u308d\u3067\u3059\u306d\u3002\u305f\u3060\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3053\u3068\u304c\u76ee\u7684\u3060\u3063\u305f\u306e\u3067\u3001\u4f7f\u3044\u9053\u306f\u6c7a\u307e\u3063\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Amazon Lightsail CentOS7\u306bRedmine\u3092\u5165\u308c\u3066\u307f\u305f\u306e\u3067\u3001\u899a\u66f8\u3002Redmine\u306fRuby on Rails\u306e\u4e0a\u3067\u52d5\u4f5c\u3057\u3066\u3044\u308b\u3088\u3046\u3067\u3059\uff08\u4eca\u307e\u3067\u4ed5\u4e8b\u3067\u6563\u3005\u4f7f\u3063\u3066\u304d\u305f\u306e\u306b\u3001\u304a\u6065\u305a\u304b\u3057\u306a\u304c\u3089\u521d\u3081\u3066\u77e5\u3063\u305f\u3068 &hellip; <a href=\"https:\/\/ji0vwl.net\/index.php\/2019\/02\/27\/1998\/\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">Redmine 4.0 \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb(Apache2.4+MariaDB)<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1998","post","type-post","status-publish","format-standard","hentry","category-server"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/posts\/1998","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/comments?post=1998"}],"version-history":[{"count":0,"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/posts\/1998\/revisions"}],"wp:attachment":[{"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/media?parent=1998"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/categories?post=1998"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/tags?post=1998"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}