在Linux中安装redmine

Redmine是用Ruby开发的基于web的项目管理软件,是用ROR框架开发的一套跨平台项目管理系统。

如下即为安装步骤:

(1)配置ruby环境,可用rvm进行安装匹配,参考http://ruby-china.org/wiki/install_ruby_guide

(2)下载redmine软件包

svn co http://svn.redmine.org/redmine/branches/2.3-stable redmine-2.3

 (3)选用一种后台数据库,如mysql,postgreSQL,我在这里选择Mysql;

安装mysql-client和mysql-server,另外,要注意安装mysql的开发包libmysqlclient-dev,否则在后面会无法安装mysql的gem

在ubuntu系统下,可直接使用

sudo apt-get install mysql-client mysql-server libmysqlclient-dev

 创建一个数据库

CREATE DATABASE redmine CHARACTER SET utf8;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';

 (4)在conf/database.yml中设置数据库的连接方式

复制conf/database.yml.example一份命名为conf/database.yml,进行修改配置:

这里使用的是ruby2.0.0

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: my_password

 (5)安装依赖的包

gem install bundler
bundle install --without development test rmagick

如果没有安装libmysqlclient-dev,则可能会出现如下错误

Installing mysql2 (0.3.13)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /home/qunengrong/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/home/qunengrong/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
    --with-mysql-config
    --without-mysql-config
    --with-mysql-dir
    --without-mysql-dir
    --with-mysql-include
    --without-mysql-include=${mysql-dir}/include
    --with-mysql-lib
    --without-mysql-lib=${mysql-dir}/
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-mlib
    --without-mlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-zlib
    --without-zlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-socketlib
    --without-socketlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-nsllib
    --without-nsllib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-mygcclib
    --without-mygcclib
    --with-mysqlclientlib
    --without-mysqlclientlib

 (6)生成session安装密钥

rake generate_secret_token

 (7)生成数据库结构

RAILS_ENV=production rake db:migrate

(8)在数据库中插入默认的数据集

RAILS_ENV=production REDMINE_LANG=fr rake redmine:load_default_data

 (9)对几个特定的目录给以写的权限

mkdir -p tmp tmp/pdf public/plugin_assets
sudo chmod -R 777 files log tmp public/plugin_assets

(10)测试运行

ruby script/rails server webrick -e production

 如果安装成功,则会出现以下信息:

$ruby script/rails server webrick -e production
=> Booting WEBrick
=> Rails 3.2.13 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-08-04 19:26:26] INFO  WEBrick 1.3.1
[2013-08-04 19:26:26] INFO  ruby 2.0.0 (2013-06-27) [i686-linux]

 这时可以在http://localhost:3000中使用redmine了。

在ubuntu系统中安装则更为简单,可参见http://blog.sina.com.cn/s/blog_6c07f2b601014yad.html

原文地址:https://www.cnblogs.com/Cherise/p/3236784.html