Redmine2.3.2ãCentOS6.4ã«ã¤ã³ã¹ãã¼ã«ããã
以ä¸ã®ãã¼ã¸ãåèã«ãã¦Redmineãã¤ã³ã¹ãã¼ã«ãããã ããã¨ããã©ããéãç®æãããã®ã§ã¡ã¢ã£ã¦ããã
SELinuxãç¡å¹ã«ãã
/etc/sysconfig/selinuxãéãç·¨éãã¦åèµ·å
# vi /etc/sysconfig/selinux
SELINUX=enforcing â SELINUX=disabled# reboot now
以ä¸ã®ã³ãã³ãã§SELinuxãç¡å¹(Disabled)ã«ãªã£ã¦ãããã¨ã確èªã
# getenforce
iptablesã§HTTPã許å¯
ãã¡ã¤ã¢ã¦ã©ã¼ã«ã®ããã©å¤ã§ã¯å¤é¨ããHTTPã«æ¥ç¶ã§ããã
ã¤ãããã§iptablesã®è¨å®ã以ä¸ã®éãã«å¤æ´ãã¦ãµã¼ãã¹åèµ·åã
# vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall # Manual customization of this file is not recommended. *filter-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT
- INPUT ACCEPT [0
- 0]
- FORWARD ACCEPT [0
- 0]
- OUTPUT ACCEPT [0
- 0]
# service iptables restart
EPELãªãã¸ããªã®ç»é²
Rubyã®ãã«ãã«å¿
è¦ãªlibyamlãyumã§ã¤ã³ã¹ãã¼ã«ã§ããããã«ããããã«ãEPEL(ã¨ã³ã¿ã¼ãã©ã¤ãº Linux ç¨ã®æ¡å¼µããã±ã¼ã¸)ãªãã¸ããªã追å ããã
ã¾ã以ä¸ã®ã®URLãéãã
ã§ã2013å¹´7æ14æ¥æç¹ã§epel-release-6-8.noarchã¨ãªã£ã¦ãããªã³ã¯URLãã³ãã¼ã
ãã®å¾ã¯ä»¥ä¸ã®ã³ãã³ãã§ãCentOSã®yumãªãã¸ããªã«EPELã追å ããã
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
å¿ è¦ãªããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«
以ä¸ã®ã³ãã³ãã§æ¢ã«ã¤ã³ã¹ãã¼ã«æ¸ã¿ã®ç¢ºèªããã
# yum grouplist
ããã¨éçºãã¼ã«ã¯æ¢ã«ã¤ã³ã¹ãã¼ã«æ¸ã¿ãªã®ã§é£ã°ãã
ã§ãRubyã¨Passengerã®ãã«ãã«å¿ è¦ãªããããã¡ã¤ã«ãªã©ã以ä¸ã®ã³ãã³ãã§ã¤ã³ã¹ãã¼ã«ã
# yum install openssl-devel readline-devel zlib-devel curl-devel libyaml-devel
MySQLã¨Apacheã¯ã¤ã³ã¹ãã¼ã«æ¸ã¿ãªã®ã§é£ã°ãã
æ¥æ¬èªãã©ã³ããã¤ã³ã¹ãã¼ã«æ¸ã¿ãªã®ã§é£ã°ãã
ãã¨ã¯ImageMagickã®ã¿ã
# yum install ImageMagick ImageMagick-devel
Rubyã®ã¤ã³ã¹ãã¼ã«
Rubyã®ãªãã£ã·ã£ã«ãµã¤ãã®ãã¦ã³ãã¼ããã¼ã¸ããRuby 1.9.3ã®ææ°ã®ã½ã¼ã¹ã³ã¼ãããã¦ã³ãã¼ãããã
# mkdir soft
# cd soft
# wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p448.tar.gz
ãã¦ã³ãã¼ãããRubyã®tarballãå±éãã¦configureãå®è¡å¾ããã«ãã¨ã¤ã³ã¹ãã¼ã«ã
ãããçµæ§æéãããããã
# tar zxvf ruby-1.9.3-p448.tar.gz
# cd ruby-1.9.3-p448
# ./configure --disable-install-doc
# make
# make install
ã¤ã³ã¹ãã¼ã«å¾ãrubyã³ãã³ããå®è¡ãã¦æ£ããã¤ã³ã¹ãã¼ã«ããããã¨ã確èª
# ruby -v
ruby 1.9.3p448 (2013-06-27 revision 41675) [i686-linux]
ç¶ãã¦Redmineã使ç¨ããGemãä¸æ¬ã¤ã³ã¹ãã¼ã«ããããã®ãã¼ã«ãbundlerãã¤ã³ã¹ãã¼ã«ã
# gem install bundler --no-rdoc --no-ri
MySQLã®è¨å®
ã¾ã以ä¸ã®ããã«ãã¦MySQLã®ããã©ã«ããã£ã©ã»ãããutf8ã«è¨å®ããã
# vi /etc/my.cnf
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 character-set-server=utf8 innodb_file_per_table query-cache-size=16M [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid [mysql] default-character-set=utf8
ãã®å¾ã以ä¸ã®éãMySQLãåèµ·åããã³èªåèµ·åè¨å®ã
# service mysqld restart
# chkconfig mysqld on
以ä¸ã®ããã«ãã¦MySQLã®è¨å®ãåæ ããã¦ããã確èªã
# mysql -uroot
mysql> show variables like 'character_set%';+--------------------------+----------------------------+ | 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/ | +--------------------------+----------------------------+8 rows in set (0.00 sec)
ããã¦ãã®ã¾ã¾rootã¦ã¼ã¶ã¼ã®ãã¹ã¯ã¼ãå¤æ´ã»å¿åã¦ã¼ã¶ã¼åé¤ãå®æ½ã
mysql> use mysql;
mysql> update user set password=password('********') where user = 'root';
mysql> delete from user where user = '';
mysql> flush privileges;
mysql> exit;
â» ******** ã®é¨åã¯ä»»æã®ãã¹ã¯ã¼ããè¨å®ãããã ãã
ç¶ãã¦ãRedmineç¨ãã¼ã¿ãã¼ã¹ã¨ã¦ã¼ã¶ã¼ã®ä½æããã
# mysql -uroot -p
Enter password:
mysql> create database db_redmine default character set utf8;
mysql> grant all on db_redmine.* to user_redmine identified by '********';
mysql> flush privileges;
mysql> exit;
â» ******** ã®é¨åã¯ä»»æã®ãã¹ã¯ã¼ããè¨å®ãããã ãã
Redmineã®ã¤ã³ã¹ãã¼ã«
ããããRedmineãã¤ã³ã¹ãã¼ã«ã
ãªãã¨æ¬æ¥2013å¹´7æ15æ¥ãVer.2.3.2ããªãªã¼ã¹ããã¨ãã¾ããã
ããã¤ãã²ãããã¦è§£åãã¾ãã
# cd /root/soft/
# wget http://rubyforge.org/frs/download.php/77023/redmine-2.3.2.tar.gz
# tar zxvf redmine-2.3.2.tar.gz
解åããRedmineã/var/lib/redmineã¨ãã¦é ç½®ããã
次ã«Redmineãããã¼ã¿ãã¼ã¹ã¸æ¥ç¶ããããã®è¨å®ãè¨è¿°ãããã¡ã¤ã«ãä½æããã
ä¸å¿ãµã³ãã«ãããã®ã§ãããã¤ãã³ãã¼ãã¦ä½æã
# cd /var/lib/redmine/config
# cp database.yml.example database.yml
# vi database.ymlproduction: adapter: mysql2 database: db_redmine host: localhost username: user_redmine password: ******** encoding: utf8
â» ******** ã®é¨åã¯ãã£ãRedmineç¨ãã¼ã¿ãã¼ã¹ã¨ã¦ã¼ã¶ã¼ä½æã§è¨å®ãããã¹ã¯ã¼ãã ãã
ã¡ãªã¿ã«viã§è¤æ°è¡ãã³ã¡ã³ãã¢ã¦ããããå ´åã¯ã
- ã³ã¡ã³ãã¢ã¦ããããå é è¡ã§Ctrl+vã§ç©å½¢é¸æã¢ã¼ãã¸
- jï¼ä¸ï¼ã§ã³ã¡ã³ãã¢ã¦ããããæçµè¡ã¸
- :ãæ¼ã
- :'<,'>ã£ã¦åºã¦ãã®ã§ãs/^/#/ã£ã¦æ¼ãã
ããã§OKãã¹ãã¹ããã
ç¶ãã¦Redmineããã¡ã¼ã«ãµã¼ãã¸æ¥ç¶ããããã®è¨å®ãæ¥æ¬èªãã©ã³ããã¡ã¤ã«ã®ãã¹ãè¨è¿°ããè¨å®ãã¡ã¤ã«ãä½æããã
# cp configuration.yml.example configuration.yml
# vi configuration.ymlproduction: email_delivery: delivery_method: :smtp smtp_settings: enable_starttls_auto: true address: "smtp.gmail.com" port: 587 domain: "smtp.gmail.com" # 'your.domain.com' for GoogleApps authentication: :plain user_name: *****.*****@gmail.com password: ******** rmagick_font_path: /usr/share/fonts/ipa-pgothic/ipagp.ttf
â»æ£ç´ãããã¯å¾ã§è¨å®ãããã§é©å½ã§ãã
bundlerã使ç¨ãã¦Redmineã§ä½¿ç¨ããGemãã¤ã³ã¹ãã¼ã«ã
# cd /var/lib/redmine
# bundle install --without development test
Redmineã®åæè¨å®ã¨ãã¼ã¿ãã¼ã¹ã®ãã¼ãã«ä½æ
Redmineã®ã¤ã³ã¹ãã¼ã«ãã£ã¬ã¯ããªã§ä»¥ä¸ã®ã³ãã³ããå©ãã¦ãã»ãã·ã§ã³ãã¼ã¿æ¹ç«é²æ¢ç¨éµã®çæã¨ãã¼ãã«ãä½æããã
# bundle exec rake generate_secret_token
# RAILS_ENV=production bundle exec rake db:migrate
å¾ã¯Passengerã®ã¤ã³ã¹ãã¼ã«ããApacheã®è¨å®ãããæ®ã£ã¦ããã ããã¡ã¨ä¼æ©ã
é·ãããããããã¹ããç²ããããã
ï¼ä¼æ©ä¸ï¼
ãã¦ãRedmineã®ã¤ã³ã¹ãã¼ã«ã®ç¶ãã
ããããã¯httpdå¨ãã®è¨å®ã ãã
Passengerã®ã¤ã³ã¹ãã¼ã«
Apacheä¸ã§Redmineãªã©ã®Railsã¢ããªã±ã¼ã·ã§ã³ã®å®è¡ã«å¿ è¦ãªPhusion Passengerãã¤ã³ã¹ãã¼ã«ããã
# gem install passenger --no-rdoc --no-ri
ã¤ã³ã¹ãã¼ã©ãå®è¡ãã¦Passengerã®Apacheç¨ã¢ã¸ã¥ã¼ã«ãã¤ã³ã¹ãã¼ã«ããã
# passenger-install-apache2-module
ã¤ã³ã¹ãã¼ã«ãå®äºããã¨ä»¥ä¸ã®ããã«è¡¨ç¤ºãããã®ã§ã太åé¨åãã³ãã¼ãã¦ããã
The Apache 2 module was successfully installed. Please edit your Apache configuration file, and add these lines: LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.8/buildout/apache2/mod_passenger.so PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.8 PassengerDefaultRuby /usr/local/bin/ruby After you restart Apache, you are ready to deploy any number of Ruby on Rails applications on Apache, without any further Ruby on Rails-specific configuration! Press ENTER to continue.
- -
Apacheã®è¨å®
Apacheã®è¨å®ã«Passengerã®è¨å®ã追å ããã
ãã ããPassengerã®è¨å®ã¯Apacheã®è¨å®ãã¡ã¤ã«httpd.confã¨ã¯å¥ã®ãã¡ã¤ã«ã«ã¾ã¨ããã
# vi /etc/httpd/conf.d/passenger.conf
# Passengerã®åºæ¬è¨å®ã # passenger-install-apache2-module --snippet ãå®è¡ãã¦è¡¨ç¤ºãããè¨å®ã使ç¨ã # LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.8/buildout/apache2/mod_passenger.so PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.8 PassengerDefaultRuby /usr/local/bin/ruby # Passengerã追å ããHTTPããããåé¤ããããã®è¨å®ï¼ä»»æï¼ã # Header always unset "X-Powered-By" Header always unset "X-Rack-Cache" Header always unset "X-Content-Digest" Header always unset "X-Runtime" # å¿ è¦ã«å¿ãã¦Passengerã®ãã¥ã¼ãã³ã°ã®ããã®è¨å®ã追å ï¼ä»»æï¼ã # 詳ããã¯Phusion Passenger users guide(http://www.modrails.com/documentation/Users%20guide%20Apache.html)ãåç § PassengerMaxPoolSize 20 PassengerMaxInstancesPerApp 4 PassengerPoolIdleTime 3600 PassengerHighPerformance on PassengerStatThrottleRate 10 PassengerSpawnMethod smart RailsAppSpawnerIdleTime 86400 PassengerMaxPreloaderIdleTime 0
â»èµ¤åã®ã¨ããããåèã«ãããµã¤ãã¨ã¯éãã®ã§ãã
ãã¨ã¯Apacheèªä½ã®ServerNameãã¾ã è¨å®ããã¦ããªãã®ã§ä»¥ä¸ã®éãè¨å®ã
# vi /etc/httpd/conf/httpd.conf
#ServerName www.example.com:80 ServerName mngsvr01:80
以ä¸ã®ã³ãã³ãã§Apacheã®èµ·åããã³èªåèµ·åã®è¨å®ãå®æ½
Apacheä¸ã®Passengerã§Redmineãå®è¡ããããã®è¨å®
RedmineãApacheå®è¡ã¦ã¼ã¶ã¼ã»ã°ã«ã¼ãã§èªã¿æ¸ãã§ããããã«ãªã¼ãã¼ãå¤æ´ããã
ãã¦ãRedmineã®å®è¡ã®ããæ¹ã ãããã®ãµã¼ãã¼ã§ã¯Redmineã ãã§ãªãä»ã«ãã¢ããªãåããããã®ã§ãµããã£ã¬ã¯ããªã§Redmineãå®è¡ããããããããããã
ã¤ãããã§ã/var/www/htmlã®ä¸ã«Redmineã®publicã¸ã®ã·ã³ããªãã¯ãªã³ã¯ãä½æããã
ãã¨/etc/httpd/conf.d/passenger.confã«ä»¥ä¸ã追å ã
# vi /etc/httpd/conf.d/passenger.conf
RackBaseURI /redmine
è¨å®å¾ãApacheãåèµ·åããã
ããã¦ï¼
以ä¸ã®URLã«ã¢ã¯ã»ã¹ï¼
http://[ãµã¼ãã¼ã®IPã¢ãã¬ã¹]/redmine/
ãããããããã ï¼
Yesï¼
ããã次åã¯Redmineã®è¨å®ãªã©ãããã