Ubuntu12.04.1LTS x86-64上安装ROR and redmine
1、安装编译依赖
sudo apt-get build-dep ruby1.9.1
安装完这个,基本大部分的依赖库都全了,需要的的话,根据错误提示安装。
2、安装ruby1.9.3
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p286.tar.gz
tar -zxvf ruby-1.9.3-p286.tar.gz
cd ruby-1.9.3-p286
./configure --prefix=/usr/local --enable-shared --disable-install-doc --with-opt-dir=/usr/local/lib
make
sudo make install
source /etc/environment
3、安装rails,参考文章a
sudo gem install tzinfo builder memcache-client rack rack-test erubis mail text-format bundler thor i18n
sudo gem install rack-mount
sudo gem install rails
sudo apt-get install mysql-server libmysqlclient-dev libmysql-ruby
sudo gem install mysql
sudo apt-get install libxml2 libxml2-dev libxslt1-dev
sudo gem install spree
推荐按参考文章a进行一下ROR的测试。
4、安装apache2的ROR运行插件passenger
sudo gem install passenger
到passenger安装目录下(这里是/usr/local/bin/)运行
./passenger-install-apache2-module
中间会有一些提示少了哪些为库,不过passenger的安装程序很友好,会提示你怎么安装这些依赖。
之后去/usr/apache2/mods-available下面添加一个passenger.load文件,加入下面的语句,注意更改成你的路径:
LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18/ext/apache2/mod_passenger.so
然后建立一个passenger.conf文件,加入:
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18
PassengerRuby /usr/local/bin/ruby
运行命令
sudo a2enmod passenger
启用这个mod,然后重启apache。
5、安装redmine,参照文章c
wget http://rubyforge.org/frs/download.php/76495/redmine-2.1.2.tar.gz
解压拷贝到/usr/share/下面,拷贝config/database.yml.example为database.yml,并修改配置,删掉里面不要的配置(像pg,sqlite等),同时在Gemfile里删掉不要的配置。
bundle install --without development test
在数据库里配置
create database redmine character set utf8;
grant all privileges on redmine.* to 'redmine'@'localhost' identified by 'my_password';
然后创建redmine所需要的表
rake generate_secret_token
sudo RAILS_ENV=production rake db:migrate
采用默认配置
sudo RAILS_ENV=production rake redmine:load_default_data
6、部署redmine
site的部署文件在安装完passenger有提示,按照上面的写就行了,在这里是:
<VirtualHost *:80>
ServerName www.yourhost.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /usr/share/redmine-2.1.2/public
<Directory /usr/share/redmine-2.1.2/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
</Directory>
</VirtualHost>
reload一下apache的设置就可以了。
参考文章:a. http://hi.baidu.com/zpdbdh/item/b809d210348ecaef9813d6f2
b. http://collectiveidea.com/blog/archives/2011/10/31/install-ruby-193-with-libyaml-on-centos/
c. http://www.redmine.org/projects/redmine/wiki/RedmineInstall