centos 6.5下安装mysql+nginx+redmine 3.1.0 笔记
目录[-]
- 过程
- 1、安装RVM
- 2、利用rvm安装 Ruby 1.9.3 并设为默认
- 3、安装rails
- 4、安装依赖包
- 5、为Rails生成cookies秘钥
- 6、安装redmine
- 7. 在WEBrick服务上测试Redmine是否安装成功
- 8、配置Redmine在Nginx上运行
系统:centos 6.5 x64
redmine 版本:3.1.0
ruby 版本: 2.2.3
rails 版本 : 4.2
过程
1、安装RVM
安装公钥
[root@localhost ~]# curl -sSL https://rvm.io/mpapis.asc | gpg --import
gpg: 已创建目录‘/root/.gnupg’
gpg: 新的配置文件‘/root/.gnupg/gpg.conf’已建立
gpg: 警告:在‘/root/.gnupg/gpg.conf’里的选项于此次运行期间未被使用
gpg: 钥匙环‘/root/.gnupg/secring.gpg’已建立
gpg: 钥匙环‘/root/.gnupg/pubring.gpg’已建立
gpg: /root/.gnupg/trustdb.gpg:建立了信任度数据库
gpg: 密钥 D39DC0E3:公钥“Michal Papis (RVM signing) <mpapis@gmail.com>”已导入
gpg: 合计被处理的数量:1
gpg: 已导入:1 (RSA: 1)
安装rvm
[root@localhost ~]# curl -L https://get.rvm.io | bash -s stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 22721 100 22721 0 0 6915 0 0:00:03 0:00:03 --:--:-- 113k
Downloading https://github.com/rvm/rvm/archive/1.26.11.tar.gz
#省略……
# Administrator,
#
# Thank you for using RVM!
# We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team.
In case of problems: http://rvm.io/help and https://twitter.com/rvm_io
载入RVM环境并获取需要的支持安装包
[root@localhost ~]# source /etc/profile.d/rvm.sh
[root@localhost ~]# rvm requirements
Checking requirements for centos.
Installing requirements for centos.
Installing required packages: patch, libyaml-devel, autoconf, patch, readline-devel, libffi-devel,
automake, libtool, sqlite-devel
..........
Requirements installation successful.
2、利用rvm安装 Ruby 1.9.3 并设为默认
# rvm install 2.2.3
# rvm use 2.2.3 --default
3、安装rails
由于国内网络原因(你懂的),导致rubygems.org存放 Amazon S3上面的资源文件间歇性连接失败。所以你会与遇到gem install rack或bundle install的时候半天没有响应,具体可以用gem install rails -V来查看执行过程。下面替换成淘宝的GEM镜像站:
# gem sources -l
*** CURRENT SOURCES ***
https://rubygems.org/
# gem sources --remove https://rubygems.org/
https://rubygems.org/
removed from sources
# gem sources -a https://ruby.taobao.org/
https://ruby.taobao.org/ added to sources
# gem sources -l
*** CURRENT SOURCES ***
https://ruby.taobao.org/
安装rails 4.2
gem install rails -v=4.2
4、安装依赖包
下载redmine3.1.1
wget http://www.redmine.org/releases/redmine-3.1.1.tar.gz
解压并进入目录
tar -zxvf redmine-3.1.1.tar.gz
cd redmine-3.1.1
安装管理ruby的包依赖的工具bundler
gem install bundler #注意是在网站根目录下执行
安装redmine依赖的所有ruby包
bundle install --without development test rmagick #完成redmine依赖包的安装
如果失败执行下列命令
gem install json -v '1.8.3'
gem install minitest -v '5.8.0'
gem install activesupport -v '4.2.3'
gem install actionview -v '4.2.3'
gem install actionpack -v '4.2.3'
gem install activejob -v '4.2.3'
gem install actionmailer -v '4.2.3'
gem install actionpack-action_caching -v '1.1.1'
gem install actionpack-xml_parser -v '1.0.2'
gem install activemodel -v '4.2.3'
gem install activerecord -v '4.2.3'
gem install coderay -v '1.1.0'
gem install railties -v '4.2.3'
gem install jquery-rails -v '3.1.4'
gem install mysql2 -v '0.3.20'
gem install net-ldap -v '0.3.1'
gem install protected_attributes -v '1.1.3'
gem install ruby-openid -v '2.3.0'
gem install rack-openid -v '1.4.2'
gem install rails -v '4.2.3'
gem install rbpdf -v '1.18.6'
gem install redcarpet -v '3.1.2'
gem install request_store -v '1.0.5'
5、为Rails生成cookies秘钥
rake generate_secret_token
6、安装redmine
创建redmine数据库
mysql> create database redmine;
添加mysql用户
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'my_password';
配置Redmine的database.yml
cp config/database.yml.example config/database.yml
cat database.yum #修改对应数据库连接信息
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: "my_password"
encoding: utf8
创建数据库结构
RAILS_ENV=production bundle exec rake db:migrate
生成缺省数据
RAILS_ENV=production bundle exec rake redmine:load_default_data
7. 在WEBrick服务上测试Redmine是否安装成功
bundle exec rails server webrick -e production -b 0.0.0.0
地址:http://IP:3000 (注意:打开iptables 3000端口号)
缺省管理员用户:
- login: admin
- password: admin
8、配置Redmine在Nginx上运行
按ctrl+c结束webrick服务
安装passenger
gem install passenger
passenger-install-nginx-module
在湖闻樟注:passenger-install-nginx-module可以选择自动下载完整nginx还是自己编译,我在这里是选了下载完整nginx
复制redmine到nginx的html目录
cp ../redmine-3.1.1 /usr/local/nginx/html/redmine
配置nginx.conf,修改server部分的location 为
location / {
root html/redmine/public;
index index.html index.htm;
}
启动nginx
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
http://www.redmine.org/projects/redmine/wiki/RedmineInstall
https://blog.linuxeye.com/407.html