CentOS版本爲6.5
php
1.基本的軟件環境mysql
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-SHAlinux
2.配置redmine數據庫(沒裝mysql的需先裝mysql)c++
mysql> create user 'redmine'@'localhost' identified by 'redmine';web
Query OK, 0 rows affected (0.00 sec)sql
mysql> create database redmine character set utf8;數據庫
Query OK, 1 row affected (0.00 sec)ruby
mysql> grant all privileges on redmine.* to 'redmine'@'localhost';bash
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