最近需要在公司内部搭建一个项目管理平台Redmine,在摸索了一天之后,终于配置成功,在这里分享给大家。
公司服务器的系统是Ubuntu14.04,要安装的是最新的Redmine3.0。
由于Redmine是基于Ruby On Rails安装的,所以第一步是安装Ruby On Rails。这部分可以参考我的上一篇博文《Ubuntu Ruby On Rails安装和配置》
PostgreSQL安装完Ruby On Rails之后,下一步是安装数据库。Redmine支持的数据库有MySQL、PostgreSQL、Microsoft SQL Server、SQLite3,本人选用的是MySQL,这里以MySQL为例。执行以下命令:
sudo apt-get install mysql-server mysql-client
mysql -u root -p CREATE DATABASE redmine CHARACTER SET utf8; CREATE USER ‘redmine‘@‘localhost‘ IDENTIFIED BY ‘my_password‘; GRANT ALL PRIVILEGES ON redmine.* TO ‘redmine‘@‘localhost‘;
其中redmine是用户名,my_password是密码。创建完之后需要下载Redmine的源码:
hg clone --updaterev 3.0-stable https://bitbucket.org/redmine/redmine-all redmine-3.0
cp config/database.yml.example config/database.yml
production: adapter: mysql2 database: redmine host: localhost username: redmine password: my_password
gem install bundler bundle install
$ gem sources --remove https://rubygems.org/ $ gem sources -a https://ruby.taobao.org/ $ gem sources -l *** CURRENT SOURCES *** https://ruby.taobao.org # 请确保只有 ruby.taobao.org $ gem install rails
rake generate_secret_token RAILS_ENV=production rake db:migrate RAILS_ENV=production rake redmine:load_default_data下一步需要修改文件权限:
mkdir -p tmp tmp/pdf public/plugin_assets sudo chown -R redmine:redmine files log tmp public/plugin_assets sudo chmod -R 755 files log tmp public/plugin_assets
ruby bin/rails server webrick -e production
此时如果安装的是Ubuntu桌面版就可以通过浏览器打开http://127.0.0.1:3000来查看Redmine的页面了,如果是服务器版本,可以通过命令w3m来查看:
w3m http://127.0.0.1:3000
如果需要在其他机器上查看的话,仅仅是ip+端口号是无法查看的,因为外部访问没有端口权限。解决方法可以通过Apache或者nginx服务器配置一个反向代理。
下面给出一些错误对应的解决方法:
1. There was an error while trying to write to Gemfile.lock. It is likely that you need to allow write permissions for the file at path: /home/thiago/model/Gemfile.lock
http://stackoverflow.com/questions/17519090/gemfile-lock-write-error-permissions
sudo chown -R $(whoami):$(whoami) myappfolder
2. No package ‘MagickCore‘ found
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc‘
http://stackoverflow.com/questions/27204494/unable-to-install-fileutils-rubygem-on-ubuntu-14-04-lts
sudo apt-get install libmagickwand-dev
3. Installing mysql2 (0.3.11) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
http://stackoverflow.com/questions/10051448/error-failed-to-build-gem-native-extension-mysql2-on-rails-3-2-3
sudo apt-get install mysql-client libmysqlclient-dev
原文地址:http://blog.csdn.net/zhaoxy_thu/article/details/44310677