CentOS版本为6.5
1.基本的软件环境
yum -y install libyaml-devel zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel gcc ruby-devel gcc-c++ make postgresql-devel ImageMagick-devel sqlite-devel perl-LDAP mod_perl perl-Digest-SHA
2.配置redmine数据库(没装mysql的需先装mysql)
mysql> create user 'redmine'@'localhost' identified by 'redmine';
Query OK, 0 rows affected (0.00 sec)
mysql> create database redmine character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on redmine.* to 'redmine'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
3.iptables设置
如果服务器开了防火墙,我们需要进行相关设置
/sbin/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
/sbin/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
4.安装php环境
yum -y install php php-mysql php-gd php-imap php-ldap php-mbstring php-odbc php-pear php-xml php-xmlrpc php-pecl-apc php-soap
5.安装ruby环境
\curl -L https://get.rvm.io | bash
source /etc/profile.d/rvm.sh
[root@usvr-126 ~]# source /etc/profile.d/rvm.sh
[root@usvr-126 ~]# rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p551]
[ruby-]2.0.0[-p643]
[ruby-]2.1.4
[ruby-]2.1[.5]
[ruby-]2.2[.1]
[ruby-]2.2-head
2.6版本需要ruby 支持的版本,在这我们选择1.9.3 稳定版
rvm install 1.9.3
[root@usvr-126 ~]# ruby -v
ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
6.安装rails
gem install rails
(可能会遇到墙,如果遇到墙就换成淘宝源http://ruby.taobao.org/)
查看版本rails -v
7.下载redmine
wget http://www.redmine.org/releases/redmine-2.6.0.tar.gz
tar zxvf redmine-2.6.0.tar.gz
8.依赖组件安装
cd redmine-2.6.0
gem install bundler
bundle install --without development test rmagick(这一步好恶心,又是墙)
9:安装连接mysql的gem
gem install mysql2
10:配置redmine连接数据库
复制 config/database.yml.example
到 config/database.yml
cp config/database.yml.example config/database.yml
cd config
编辑database.yml
修改下面相应的部分
Example for a MySQL database using ruby 1.9 (adapter must be set to mysql2
):
production: adapter: mysql2 database: redmine host: localhost username: redmine password: my_password
11:创建一个session安装密钥
rake generate_secret_token
12:创建初始化所有redmine用到的table表
RAILS_ENV=production rake db:migrate
13:装入默认的配置信息,输入zh(选择中文)
RAILS_ENV=production rake redmine:load_default_data
14:启动redmine
ruby script/rails server webrick -e production
后台运行
ruby script/rails server webrick -e production -d
15:开机自动启动
编辑启动文件
vi /etc/rc.local
最后一行或者适当的位置,加入一下内容。此处必须用绝对路径。注意根据实际redmine路径来填写。
/usr/local/rvm/rubies/ruby-1.9.3-p551/bin/ruby /root/redmine-2.6.0/script/rails server webrick -e production -d
ruby路径:
[root@iZ25wrr95ffZ redmine-2.6.0]# which ruby
/usr/local/rvm/rubies/ruby-1.9.3-p551/bin/ruby