项目管理的需要所以安装Redmine,其实wiki放在上面也不错的。
首先是安装,ruby应用第一次装,把坑记住。
nginx, mysql是已经安装好的,只需要配置, 结合nginx的部署方式很多,我这里就选择一种,因为ruby没接触过,只是应用能跑通就好。
下面都是root操作
检查是否有ruby环境
# rpm -aq|grep ruby
没有ruby环境,检查了下yum里面的ruby版本,太老了。
源码安装参考 ruby 2.0.0 centos 6
yum -y install libxslt-devel libyaml-devel libxml2-devel gdbm-devel libffi-devel
yum -y install zlib-devel openssl-devel libyaml-devel readline-devel curl-devel openssl-devel
yum -y install pcre-devel mysql-devel ImageMagick-devel ImageMagick
version=2.0.0-p645
cd /usr/local/src
wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-$version.tar.gz
tar zxvf ruby-$version.tar.gz
cd ruby-$version
./configure
make
make install
检查下ruby的版本信息
# ruby -v
ruby 2.0.0p645 (2015-04-13 revision 50299) [x86_64-linux]
安装gems
version=2.0.7
cd ..
wget http://production.cf.rubygems.org/rubygems/rubygems-$version.tgz
tar zxvf rubygems-$version.tgz
cd rubygems-$version
/usr/local/bin/ruby setup.rb
检查下安装
# gem -v
2.0.7
安装ruby 相关的插件,但是gem这网站被天朝的某个玩意挡住了。
还有淘宝的兄弟搞了个镜像 http://ruby.taobao.org/ , 这里有相关使用的文档。
# gem sources --remove https://rubygems.org/
# gem sources -a https://ruby.taobao.org/
gem sources -l
*** CURRENT SOURCES ***
https://ruby.taobao.org/
接下来继续安装需要的包
gem install bundler
gem install rmagick
gem install rails
gem install mysql2
其实只要安装bundler也ok,后面bundler会自动安装其他的依赖包
http://www.redmine.org/releases/redmine-3.0.4.tar.gz
tar zxvf redmine-3.0.4.tar.gz
cp -R redmine-3.0.4 /data/www/
mv redmine-3.0.4 redmine
cd redmine/
#这里Gemfile文件中的rubygem地址不能用还是改成 https://ruby.taobao.org/ 吧
bundle install #默认是使用 Gemfile,然后安装所有的依赖包
!!安装中 rmagick 安装出现了错误,ImageMagick 版本过低。
接下来就是修改配置等
mysql -uroot -p
mysql> create database redmine character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> create user ‘redmine‘@‘localhost‘ identified by ‘redmine#mysql‘;
Query OK, 0 rows 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.01 sec)
# cd /data/www/redmine/config
# cp database.yml.example database.yml
# vim database.yml
主要修改生产的配置,整个配置很容易看懂
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: "redmine#mysql"
encoding: utf8
生成配置信息,下面几个操作
# cd /data/www/redmine/config
# RAILS_ENV=production bundle exec rake generate_secret_token
# RAILS_ENV=production bundle exec rake db:migrate
# RAILS_ENV=production bundle exec rake redmine:load_default_data
# cd /data/www/redmine/
# bundle exec rails server webrick -p30005 -b 0.0.0.0 -e production
curl "http://localhost:30005"
可以访问到,这样基本的功能就有了。
我这里采用了一个thin的插件
# gem install thin
# thin install
Thin service already installed at /etc/rc.d/thin
mkdir -p /etc/thin
To configure thin to start at system boot:
on RedHat like systems:
sudo /sbin/chkconfig --level 345 thin on
on Debian-like systems (Ubuntu):
sudo /usr/sbin/update-rc.d -f thin defaults
on Gentoo:
sudo rc-update add thin default
Then put your config files in /etc/thin
# mv /etc/rc.d/thin /etc/init.d/thin
* 注意 *
如果要使用thin插件,要在 /data/www/redmine/Gemfile
文件中的插件列表中添加一句
gem "thin"
vim /etc/thin/redmine.yml
pid: /var/run/thin/thin.pid
group: nginx
wait: 30
timeout: 30
log: /var/log/thin/thin.log
max_conns: 1024
require: []
environment: production
max_persistent_conns: 512
servers: 4
daemonize: true
user: nginx
socket: /tmp/thin.sock
chdir: /data/www/redmine
注意redmin的路径
vim /etc/logrotate.d/thin
/var/log/thin/*.log {
daily
missingok
rotate 52
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/thin restart >/dev/null
endscript
}
单写一个redmine.conf
,include到nginx.conf
编辑nginx配置,注意路径可能不一样
vim /usr/local/nginx/conf/redmine.conf
upstream thin_cluster {
server unix:/tmp/thin.0.sock;
server unix:/tmp/thin.1.sock;
server unix:/tmp/thin.2.sock;
server unix:/tmp/thin.3.sock;
}
server {
listen 80;
server_name you.domain.name;
access_log /var/log/nginx/redmine-access;
error_log /var/log/nginx/redmine-error;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
#your redmine path
root /data/www/redmine/public;
proxy_redirect off;
location / {
try_files $uri/index.html $uri.html $uri @cluster;
}
location @cluster {
proxy_pass http://thin_cluster;
}
}
然后重启thin,reload nginx
/etc/init.d/thin restart
/etc/init.d/nginx reload
下面的都是参考资料,要注意系统和软件版本
声明:
本文出自 “orangleliu笔记本” 博客,转载请务必保留此出处http://blog.csdn.net/orangleliu/article/details/46989377 作者orangleliu 知识共享 署名-相同方式共享 3.0协议
版权声明:本文为orangleliu(http://blog.csdn.net/orangleliu/)原创文章,文章转载请声明。
[Redmine] Centos5上安装Redmine3.0+nginx+thin部署
原文地址:http://blog.csdn.net/orangleliu/article/details/46989377