Chinaunix首页 | 论坛 | 博客
  • 博客访问: 39468
  • 博文数量: 7
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 70
  • 用 户 组: 普通用户
  • 注册时间: 2014-08-08 15:40
文章分类

全部博文(7)

文章存档

2016年(7)

我的朋友

分类: LINUX

2016-01-27 14:18:41

先安装 ruby包管理器


  1. curl -sSL | bash -s stable
安装完成后需要 source /etc/profile.d/rvm.sh

查看官方版本需求
Redmine version Supported Ruby versions Rails version used
current trunk ruby 1.9.3, 2.0.0, 2.1, 2.2 Rails 4.2
3.0 ruby 1.9.3, 2.0.0, 2.1, 2.2 Rails 4.2
2.6 ruby 1.8.7, 1.9.2, 1.9.3, 2.0.0, 2.1, 2.2, jruby-1.7.6 Rails 3.2


先查看版本


  1. rvm list known
  2. # MRI Rubies
  3. [ruby-]1.8.6[-p420]
  4. [ruby-]1.8.7[-head] # security released on head
  5. [ruby-]1.9.1[-p431]
  6. [ruby-]1.9.2[-p330]
  7. [ruby-]1.9.3[-p551]
  8. [ruby-]2.0.0[-p648]
  9. [ruby-]2.1[.8]
  10. [ruby-]2.2[.4]
  11. [ruby-]2.3[.0]
  12. [ruby-]2.2-head


安装2.2版本
rvm install 2.2

安装完成后使用
rvm use 2.2
然后使用 ruby -v 查看ruby的版本

接着 安装rails
gem install rails -V

在安装过程中
可能会出现
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)


  1. gem sources --remove https://rubygems.org/
  2. gem sources -a https://ruby.taobao.org/
  3. gem sources -l
替换掉源
安装完成后使用
rails -v 查看版本信息
Rails 4.2.5 应该可以吧 --。


  1. git clone https://github.com/redmine/redmine


然后跟着官网的来


  1. gem install bundler
  2. bundle install --without development test
第二部可能出现
An error occurred while installing rmagick (2.15.4), and Bundler cannot continue. Make sure that `gem install rmagick -v '2.15.4'` succeeds before bundling.

用下面的就好了

  1. apt-get install imagemagick libmagickcore-dev libmagickwand-dev

    剩下的就跟着
    其他错误按照上面的提示应该就好了


  1. https://www.redmine.org/projects/redmine/wiki/RedmineInstall

在redmine 目录下用以下代码 且能够正常访问

  1. bundle exec rails server webrick -e production
    在apache配置

    必须要先安装passenger



  1. gem install passenger

然后安装apache 模块

  1. passenger-install-apache2-module
    期间却少模块 可以安装他的说明
    最后会有类似这样的代码


  1. LoadModule passenger_module /usr/local/rvm/gems/ruby-2.2.4/gems/passenger-5.0.23/buildout/apache2/mod_passenger.so
  2.    <IfModule mod_passenger.c>
  3.      PassengerRoot /usr/local/rvm/gems/ruby-2.2.4/gems/passenger-5.0.23
  4.      PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.2.4/wrappers/ruby
  5.    </IfModule


 复制到记事本上面去  后面配置 apache 会用到

a2enconf passenger
然后就在 touch /etc/apache2/sites-enabled/redmine.conf 里面配置就好了  这个文件是从sites-available 做的软链接


像这样就可以了

  1. ServerName redmine.domain.com

  2. <VirtualHost *:443>
  3.  ServerAdmin admin@domain.com
  4.  ServerName redmine.domain.com
  5.  

  6.  DocumentRoot /opt/redmine/current/public/
  7.  
  8.  ## Passenger Configuration
  9.  ## Details at http://www.modrails.com/documentation/Users%20guide%20Apache.html
  10.  
  11.  PassengerMinInstances 6
  12.  PassengerMaxPoolSize 20
  13.  RailsBaseURI /
  14.  PassengerAppRoot /opt/redmine/current
  15.  
  16.  # Speeds up spawn time tremendously -- if your app is compatible.
  17.  # RMagick seems to be incompatible with smart spawning
  18.  RailsSpawnMethod smart
  19.  
  20.  # Keep the application instances alive longer. Default is 300 (seconds)
  21.  PassengerPoolIdleTime 1000
  22.  
  23.  # Keep the spawners alive, which speeds up spawning a new Application
  24.  # listener after a period of inactivity at the expense of memory.
  25.  RailsAppSpawnerIdleTime 3600
  26.  
  27.  # Additionally keep a copy of the Rails framework in memory. If you're
  28.  # using multiple apps on the same version of Rails, this will speed up
  29.  # the creation of new RailsAppSpawners. This isn't necessary if you're
  30.  # only running one or 2 applications, or if your applications use
  31.  # different versions of Rails.
  32.  PassengerMaxPreloaderIdleTime 0
  33.  
  34.  # Just in case you're leaking memory, restart a listener
  35.  # after processing 5000 requests
  36.  PassengerMaxRequests 5000
  37.  
  38.  # only check for restart.txt et al up to once every 5 seconds,
  39.  # instead of once per processed request
  40.  PassengerStatThrottleRate 5
  41.  
  42.  # If user switching support is enabled, then Phusion Passenger will by default run the web application as the owner if the file config/environment.rb (for Rails apps) or config.ru (for Rack apps). This option allows you to override that behavior and explicitly set a user to run the web application as, regardless of the ownership of environment.rb/config.ru.
  43.  PassengerUser www-data
  44.  PassengerGroup www-data
  45.  
  46.  # By default, Phusion Passenger does not start any application instances until said web application is first accessed. The result is that the first visitor of said web application might experience a small delay as Phusion Passenger is starting the web application on demand. If that is undesirable, then this directive can be used to pre-started application instances during Apache startup.
  47.  PassengerPreStart https://localhost
  48.   
  49.  <Directory /opt/redmine/current/public/>
  50.  Options +Indexes +FollowSymLinks -MultiViews
  51.  AllowOverride All
  52.  <IfVersion < 2.3 >
  53.      Order allow,deny
  54.      Allow from all
  55.  </IfVersion>
  56.  <IfVersion >= 2.3>
  57.      Require all granted
  58.  </IfVersion>
  59.  </Directory>
  60.  
  61.  AddOutputFilter DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css
  62.  BrowserMatch ^Mozilla/4 gzip-only-text/html
  63.  BrowserMatch ^Mozilla/4.0[678] no-gzip
  64.  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  65.  
  66.  
  67.  ErrorLog ${APACHE_LOG_DIR}/redmine.error.log
  68.  LogLevel warn
  69.  CustomLog ${APACHE_LOG_DIR}/redmine.access.log combined
  70.  ServerSignature Off
  71.  
  72. </VirtualHost>




阅读(2745) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~