CentOS7 安装 Redmine

一、准备工作

yum -y update

创建一个 redmine 账号用于启动 redmine

adduser redmine

获取Redmine 并解压缩

cd /home/redmine/
wget http://www.redmine.org/releases/redmine-3.4.6.tar.gz
tar -zxvf redmine-3.4.6.tar.gz
mv redmine-3.4.6/* /home/redmine/
rm -rf redmine-3.4.6.tar.gz
rm -rf redmine-3.4.6

二、安装 环境

1、安装Ruby

yum -y install epel-release curl-devel sqlite-devel libyaml-devel
gpg –keyserver hkp://keys.gnupg.net –recv-keys D39DC0E3
curl -L https://get.rvm.io | bash -s stable
source /etc/profile.d/rvm.sh
rvm reload
rvm install 2.3.3 #安装redmine-3.4.6 对应的 ruby
rvm use ruby-2.3.3

2、安装Rake 和 Rails

gem source -r https://rubygems.org/
gem source -a https://gems.ruby-china.org/
gem install rake -v 12.0.0
gem install rails -v 4.2.8

3、安装其他的包

yum -y install mysql-devel postgresql-devel ImageMagick-devel

三、配置Redmine

cd /home/redmine/config/
cp database.yml.example database.yml
vi database.yml #修改数据库配置

这里我使用Postgresql 数据库 只需要把之前的 production 注释掉,并配置

四、安装Redmine

cd  /home/redmine/
bundle install #安装依赖
rake db:migrate RAILS_ENV=”production”
rake redmine:load_default_data RAILS_ENV=”production” #这时候会提示你选择语言,输入:zh
rake generate_secret_token #为rails生产cookie秘钥
chown -R redmine:redmine *
chmod -R 700 *

五、启动Redmin

su – redmine -c “/usr/local/rvm/rubies/ruby-2.3.3/bin/ruby /home/redmine/bin/rails server webrick -e production -d”

六、用Mongrel组件来替换Webrick

gem install mongrel -v 1.2.0.pre2 –pre –source https://gems.ruby-china.org/
在gemfile中加入
gem “mongrel”,”~> 1.2.0.pre2″
删除gemfile.lock文件,重新执行
bundle install
启动
su – redmine -c “/usr/local/rvm/rubies/ruby-2.3.3/bin/ruby /home/redmine/bin/rails server mongrel -e production -d”

七、配置Nginx代理访问,并修改nginx http配置,设置 client_max_body_size 1024M,以保证可以正常上传文件

location / {
proxy_pass http://localhost:3000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

发表评论

电子邮件地址不会被公开。 必填项已用*标注