centos6.x 安装redmine 3.x + apache

前言

Redmine 3.x 最低要求Ruby 1.9.3,CentOS 6.x 默认安装Ruby 1.8.x,这就尴尬了,无法用简单的 yum 一路到底。

解决Ruby

为了以后能支持 redmine 4,至少需要安装 Ruby 2.2.2。那么我们目标就安装 >2.2.2

yum install gcc-c++ patch readline readline-devel zlib zlib-devel
yum install libyaml-devel libffi-devel openssl-devel make
yum install bzip2 autoconf automake libtool bison iconv-devel sqlite-devel

在安装这个的过程中,如果遇到意外,可能需要用到

rpm -e 要删除的重复包
yum downgrade curl lib-curl libidn

安装 RVM

curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -L get.rvm.io | bash -s stable
source /etc/profile.d/rvm.sh
rvm reload
rvm requirements run
rvm install 2.2.4
rvm use 2.2.4 --default

最后,运行下列语句就能正确显示,我们已经成功用上 ruby2.2.4

# ruby --version

ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux]

安装 Passenger

gem install passenger 
yum install curl-devel httpd-devel 
passenger-install-apache2-module

看到下面类似的 代码:

LoadModule passenger_module /usr/local/rvm/gems/ruby-2.2.4/gems/passenger-5.3.0/buildout/apache2/mod_passenger.so
   <IfModule mod_passenger.c>
     PassengerRoot /usr/local/rvm/gems/ruby-2.2.4/gems/passenger-5.3.0
     PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.2.4/wrappers/ruby
   </IfModule>

将下列代码添加到 /etc/httpd/conf.d/passenger.conf

安装Redmine

下载 Redmine 压缩包,解压。修改 config/database.yml 设置数据库配置

gem install bundler
bundle install --without development test rmagick
bundle exec rake db:migrate RAILS_ENV=production

这个时候,可以运行

bundle exec rails server webrick -e production

开启测试服务器,看是否能正常运行 http://localhost:3000/。
如果你看到登录界面,恭喜您。

配置passenger

vi /etc/httpd/conf.d/passenger.conf
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.2.4/gems/passenger-5.3.0/buildout/apache2/mod_passenger.so
   <IfModule mod_passenger.c>
     PassengerRoot /usr/local/rvm/gems/ruby-2.2.4/gems/passenger-5.3.0
     PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.2.4/wrappers/ruby
   </IfModule>

Listen 99

<VirtualHost *:99> 
 DocumentRoot /path/redmine-3.4.5/public
ErrorLog logs/redmine_error_log
 <Directory /path/redmine-3.4.5/public> 
 # This relaxes Apache security settings. 
 AllowOverride all 
 # MultiViews must be turned off. 
 Options -MultiViews 
 </Directory> 
</VirtualHost>

重启 httpd, 访问本地 99 端口即可。

插件

安装插件

bundle install --without development test rmagick
rake redmine:plugins:migrate  RAILS_ENV=production

卸载插件

rake redmine:plugins:migrate NAME=redmine_lightbox2 VERSION=0 RAILS_ENV=production
rm -Rf plugins/redmine_lightbox2

One more thing

修复 Redmine 调取 SVN https 地址返回404错误。

vi lib/redmine/scm/adapters/subversion_adapter.rb
str << " --no-auth-cache --non-interactive"

修改为

str << " --trust-server-cert --no-auth-cache --non-interactive"

重启 Apache 即可

参考资料

相关推荐