CentOS 6.5 部署redmine 2.42

CentOS 6.5 部署redmine 2.42

(远程mysql数据库/apache反向代理/注册服务)

l环境说明

n数据库服务器:192.168.1.8

nRedmine服务器:192.168.1.11

nApache服务器:192.168.1.11



本文为本人工作之余依靠记忆所写,不保证全文的完整性和正确性,仅作为个人知识积累;如您参考本文操作,在不确保环境一致的情况下,请您先测试~

或从本文下方的信息联系本人






一、安装redmine环境、

a)安装mysql

i.安装MySQL

1.yuminstall mysql*          

//为省事,这里直接安装mysql所有包

2.chkconfigmysqld on    

//设置mysql开机自启

3.servicemysqld start        

//启动mysql服务

ii.配置MySQL

1.mysql  -u root –p          

//登入Mysql

2.SETPASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');  

//设置MySQL下root用户本地登入的账户密码

3.create databaseredmine;    

//创建redmine数据库

4.alter database redmine character set utf8

//设置redmine字符集为UTF8

5.grant allprivileges on redmine.* to redmine@192.168.1.11identified by ‘password’ with grant option;

//创建一个名为redmine,密码为password,允许从192.168.1.11远程登入,并对redmine数据拥有完整权限的用户


b)安装redmine

i.安装库

1.yum install gcc gcc-c++ make automakeautoconf curl-devel openssl-devel zlib-devel ImageMagick-devel

ii.安装ruby

1.wget http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz

2.tar zxvfruby-2.0.0-p353.tar.gz

3.cd ruby- 2.0.0-p353

4../configure --prefix=/usr/local/ruby&& make &&make install

5.Ruby -v

iii.更换gem源

1.gem sources -a http://ruby.taobao.org/

\\新增GEM源

2.gem sources -r https://rubygems.org/

\\删除自带官方源

3.gem sources –l

\\查看gem源。确保只剩下ruby.taobao.org

iv.安装bundle等依赖

1.gem install bundler

\\如果ruby编译默认安装了该gem,请不要安装

2.geminstall rails  

\\如果ruby编译默认安装了该gem,请不要安装

3.geminstall rake    

\\如果ruby编译默认安装了该gem,请不要安装

4.geminstall mysql2  

\\如果mysql是编译安装的,可使用—with-mysql-config=mysql_config的位置

v.安装SVN客户端

1.yum install subversion –y

vi.下载redmine

1.wget  http://www.redmine.org/releases/redmine-2.4.2.tar.gz

2.tar zxvfredmine-2.4.2.tar.gz

3.mv  redmine-2.4.2 /usr/local/redmine

vii.配置redmine

1.cd  /usr/local/redmine/config/

2.cp database.yml.example database.yml

3.vim database.yml

\\更改为下面字样

production:
   adapter: mysql2  
   database: redmine
   host: 192.168.1.8
   username: redmine
   password: “password”
   encoding: utf8

viii.生成存储密钥、生成表结构、初始化数据

1.rake generate_secret_token

//Session存储秘钥

2.RAILS_ENV=production rake db:migrate

//生成表结构

3.RAILS_ENV= production REDMINE_LANG=zh rakeredmine:load_default_data

//初始化数据,非必要操作

ix.启动redmine

1.ruby script/rails server webrick -e production

2.http://192.168.1.11:3000

\\访问测试

二、Apache反向代理

a)安装apache

i.yum install httpd

b)配置apache反向代理

i.vim /etc/httpd/conf/httpd.conf

\\在文末添加下列字样

<VirtualHost *:80>

ServerAdmin admin@localhost

ServerName redmine.xxxx.com

ProxyRequests Off

#<Proxy *>

#Order deny,allow

#Allow from all

#</Proxy>

ProxyPass /http://127.0.0.1:3000/

ProxyPa***everse /http://127.0.0.1:3000/

</VirtualHost>

c)启动httpd服务

i.Service httpd start

ii.Chkconfighttpd on

三、Chkconfig注册服务

a)touch/etc/init.d/redmine

\\在/etc/init.d/下新建一个命为redmine的文件

b)chmod +x/etc/init.d/redmine

\\给该文件赋予可执行权限

c)vim/etc/init.d/redmine

\\编辑该文件并输入如下字样

#!/bin/sh

#This script is used for startor stop

#the redmine Daemon

# chkconfig: 234 55 16

# description: redmine Daemon

. /etc/profile

       case "$1" in

        start)

               run0=$(ps -ef|grep rails|grepruby|awk '{print $2}')

                if [ ! -n "$run0" ];then

                       echo "StartingRedmine Server..."

                              /usr/local/bin/ruby /usr/local/redmine/script/rails server webrick -eproduction  > /dev/null  &

                                       else

                       echo  "The redmine is running"

               exit 0

               fi

        ;;

       stop)

               run1=$(ps -ef|grep rails|grepruby|awk '{print $2}')

               if [ ! -n "$run1" ];then

                       echo "The redmine is not running"

                                    else

                       echo  "Stop redmine Server"

               kill $(ps -ef|grep rails|grepruby|awk '{print $2}')

               exit 0

               fi

       ;;

       restart)

               echo "Restarting RedmineServer..."

               service redmine stop

               service redmine start

               service httpd restart

               #kill $(ps -ef|grep rails|grepruby|awk '{print $2}') > /dev/zero

               #/usr/local/bin/ruby/usr/local/redmine/script/rails server webrick -e production  > /dev/zero  &



       ;;

      *)

              echo "Usage:  serveice redmine {start|stop|restart}"

              exit 1

              ;;

       esac

      exit 0

d)注册服务

i.Chkconfig –add redmine

ii.Chkconfigredmine on


部分错误可参考下列文章:

    http://blog.csdn.net/caspiansea/article/details/40332021



QQ:236865473

博客:http://robert283.blog.51cto.com

E-Mmail:Robert283@sina.com


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值