Ubuntu 16.04上安装Redmine

1.安装rvm(ruby版本管理器)

sudo su
apt-get install mysql-server libmysqlclient-dev git-core subversion imagemagick libmagickwand-dev libcurl4-openssl-dev 
gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
curl -L https://get.rvm.io | bash -s stable --ruby=2.0.0
现在,你应该加载RVM
source /usr/local/rvm/scripts/rvm
echo '[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm"' >> ~/.bashrc

2.安装Phusion Passenger和Nginx

gem install passenger --no-ri --no-rdoc
passenger-install-nginx-module

配置nginx

git clone git://github.com/jnstq/rails-nginx-passenger-ubuntu.git
mv rails-nginx-passenger-ubuntu/nginx/nginx /etc/init.d/nginx
chown root:root /etc/init.d/nginx
update-rc.d nginx defaults
nano /opt/nginx/conf/nginx.conf

替换端口号80的配置部分

server {
  listen  80;
  server_name [your_server_domain_name] # redmine.com;
  root /var/data/redmine/public;
  passenger_enabled on;
  client_max_body_size      10m; # Max attachemnt size
}

3.安装Redmine

 mkdir /var/data
 cd /var/data/
 svn co http://svn.redmine.org/redmine/branches/3.2-stable redmine
 cd /var/data/redmine

数据库配置

nano config/database.yml

添加以下行

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: redmine
  encoding: utf8

development:
  adapter: mysql2
  database: redmine 
  host: localhost
  username: redmine
  password: redmine
  encoding: utf8

4.插件安装

解压插件到/plugins/文件夹
cd /var/data/redmine
gem install bundler --no-ri --no-rdoc
bundle install

5.配置redmine

设置redmine文件夹权限

cd /var/data/redmine
mkdir public/plugin_assets
chown -R www-data:www-data files log tmp public/plugin_assets config.ru
chmod -R 755 files log tmp public/plugin_assets

创建数据库

mysql -u root -p

在MySQL中执行以下命令行

CREATE DATABASE redmine character SET utf8;
CREATE user 'redmine'@'localhost' IDENTIFIED BY 'redmine';
GRANT ALL privileges ON redmine.* TO 'redmine'@'localhost';
exit

迁移数据库

cd /var/data/redmine
bundle exec rake db:migrate
bundle exec rake redmine:plugins

生成会话存储

bundle exec rake generate_secret_token 

启动Web服务器

service nginx start

重启Redmine

touch /var/data/redmine/tmp/restart.txt
Was this article helpful? Yes  No
515 from 551 found this helpful