how to install redmine2.4.1 on centos6.3

流过昼夜 提交于 2019-12-04 20:20:02

redmine是什么?

这是基于Ruby+Rails框架开发的一套跨平台项目管理系统, 支持多种数据库(百度)

安装开发包
yum install gcc gcc-c++ make automake autoconf curl-devel openssl-devel zlib-devel ImageMagick-devel -y  甘特图需要用到ImageMagick-devel
安装MYSQL
yum install mysql mysql-server mysql-devel -y
/etc/init.d/mysqld start
 mysql_secure_installation  //安全配置一下
建立数据库
mysql> CREATE DATABASE redmine CHARACTER SET utf8;
mysql> grant all privileges on redmine.* to redmine@'localhost' identified by 'BiVbJHSkZ4DU';
MYSQL编译的自己建库就行啦。

安装RUBY
wget http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz 
cd ruby-2.0.0-p353/
./configure && make && make install  //安装完就有gem了,gem install 包名,如果慢 包名后加-V  看卡在哪里
加快GEM的安装,鉴于国外网站经常被墙,使用淘宝源
1、淘宝的GEM镜像站
gem sources --remove https://rubygems.org/
gem sources -a http://ruby.taobao.org/
gem sources -l
*** CURRENT SOURCES ***


http://ruby.taobao.org  # 请确保只有 ruby.taobao.org
2、本地装好gem   //gem install --local xxxx.gem aa.gem bb.gem gem是自己下载下来的,一并安装可解决依赖
3、VPN到国外再操作
这里我用的第一种
安装redmine
wget http://www.redmine.org/releases/redmine-2.4.1.tar.gz
tar zxvf redmine-2.4.1.tar.gz && mv redmine-2.4.1 /www/redmine
cd /www/redmine/config
cp database.yml.example database.yml
vi database.yml
production:
  adapter: mysql2     //ruby1.9以下就要换成mysql
  database: redmine
  host: localhost
  username: redmine
  password: "BiVbJHSkZ4DU"
  encoding: utf8
tar zxvf ruby-2.0.0-p353.tar.gz && cd ruby-2.0.0-p353/ext/openssl/     //安装Ruby的openssl扩展库,其他扩展也一样执行ruby extconf.rb make make install
ruby extconf.rb   //提示bundle cannot load such file -- openssl,如果没有提示就不用编译这个
make && make install


安装bundler
gem install bundler
Fetching: bundler-1.3.5.gem (100%)
Successfully installed bundler-1.3.5
Parsing documentation for bundler-1.3.5
Installing ri documentation for bundler-1.3.5
1 gem installed
//*想要快速安装的直接略过这一大段落
引用http://www.2cto.com/kf/201210/159888.html
1. Ruby简介
Ruby是面向对象的编程语言,追求的是“简单便捷的面向对象编程”。Ruby是解释型的语言,因此不许要编译就可以快速的编程,熟悉编程语言的同学可能清楚,既然是解释型的语言,就需要在语言的效率上作出一定的牺牲。2004年Rails框架的出现,使得Ruby更加流行。
2. Ruby的安装
目前使用的最多的就是通过rvm进行安装ruby(how to install ruby on centos). RVM是ruby的一个版本管理工具,并且可以通过这个工具实现在线安装ruby,rails等。为什么需要ruby的版本管理呢?因为ruby语言的版本变化是很快的,在推出的新版本中,可能对以前版本的支持不是很好,并且有些不兼容,如果你想使用新的版本做测试,但是并不想用新的版本来开发已经用以前版本已经在进行开发的产品,就需要用到版本管理。RVM可以让你轻松的在各个版本的ruby之间切换,而不会造成版本混论和其他的负面影响。如果你已经安装了rvm,并且安装了多个版本的ruby,版本的切换可以使用:rvm use ruby-1.9.3-p194这样的命令来实现,如果想指定一个版本为默认的版本,使用下面的命令:
$ rvm use ruby-1.9.3 --default  //https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-centos-6-with-rvm 如何用rvm安装ruby
gem相当于java程序中的包,是别人已经写好的一些ruby程序,可以直接来调用实现一些功能。
Rubyems是Rbuy语言的包管理工具,安装Ruby的时候就会自动的已组件的形式自动的安装。在安装的Ruby语言相关组件的时候,直接使用RubyGems包的一条命令就可以安装,并且在使用包管理
bundler主要用于管理Ruby应用程序的依赖关系,并按照此依赖关系安装所需的Gems。当运行bundle install命令来安装Gems时,bundler会使用当前目录下的名为Gemfile的文件来处理依赖关系。
*//
安装一些依赖
cd /www/redmine/   //必须到redmine根目录下执行以下命令,如果配置文件注释掉了,可以直接bundle install ,配置文件database.yml
bundle install --without development test   //--without 忽略安装,比如你可以bundle install --without rmagick sqlite
安装时候缺少什么就装什么
Gem::RemoteFetcher::FetchError: Errno::ETIMEDOUT: Connection timed out - connect(2) (https://rubygems.org/gems/rack-cache-1.2.gem)
An error occurred while installing rack-cache (1.2), and Bundler cannot continue.
Make sure that `gem install rack-cache -v '1.2'` succeeds before bundling.
gem install rack-cache  //你也可以指定版本,一般安装最新的
这里发现用了国外的源
继续替换淘宝的vi Gemfile 
source 'https://rubygems.org'  //source ‘http://ruby.taobao.org’
执行后的结果
Your bundle is complete!
Gems in the groups development and test were not installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from rdoc:
Depending on your version of ruby, you may need to install ruby rdoc/ri data:
继续执行
1、Generate the session store  //Session存储秘钥
rake generate_secret_token
2、Migrate the database models   //生成表结构
RAILS_ENV=production rake db:migrate
3、Load default data (optional)   //初始化数据
RAILS_ENV=production REDMINE_LANG=zh rake redmine:load_default_data   //语言环境,WEB上面也有一个配置语言环境的
启动也必须在根目录下
cd /www/redmine/
nohup ruby script/rails server webrick -e production -p 8000  > log/webrick.log & //默认是3000
访问http://ip:8000
admin/admin
修改密码  管理--用户
OK,大功告成了!

cp /redmine/config/configuration.yml.example  /redmine/config/configuration.yml   //配置邮件

 production:
   email_delivery:
     delivery_method: :smtp
     smtp_settings:
       address: "smtp.163.com"
       port: 25
       authentication: :login
       domain: '163.com'
       user_name: 'id'
       password: 'mima123456'

redmine和nginx整合  //apache可参考http://mrtn.me/blog/2012/07/06/installing-redmine-on-centos-6-dot-2-wiht-mysql-and-apache/
redmine访问时出现时快时慢的现象
原因是默认的启动命令是使用webrick服务器,webrick是单进程单线程的,只能一次处理一个请求,当有请求阻塞时,就排队
解决办法是安装nginx+Passenger:
gem install passenger 
cd /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.27/ext/nginx/   //这个是编译安装ruby并且未指定--prefix=  的位置
cd /root/software/nginx-1.5.7
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --add-module=/usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.27/ext/nginx/
make && make install
nginx -V  //模块增加没。
配置nginx.conf  http  里面 
client_max_body_size 20m;   //上传的大小
passenger_root /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.27 ; 
passenger_ruby  /usr/local/bin/ruby ;
server {
listen 80;
    server_name redmine.yourdomain.com;
    index index.html index.htm index.php;
    root  /www/redmine/public/;
    passenger_enabled on;
}
错误日志
会写入nginx的error里面 error_log  /usr/local/nginx/logs/error.log  crit;
访问日志
chmod 666 /www/redmine/log/production.log

备份还原
Redmine的用户和问题等信息存储于Mysql数据库,表名为redmine而附件等资源存储于Redmine安装目录的files目录下.因此需要迁移的话只需要备份Mysql数据库的对应的表和files目录即可。
备份配置文件config\*.yml

安装主题
redmine/public/themes/ls
alternate  classic  coffee  README  redminecrm  主题.zip   //直接覆盖,强刷浏览器,管理--配置--显示--主题--保存即可更换主题


安装插件
http://www.redmine.org/projects/redmine/wiki/Plugins  
https://github.com/a-ono/redmine_ckeditor   //编辑器
1. Copy your plugin directory into #{RAILS_ROOT}/plugins (Redmine 2.x) or #{RAILS_ROOT}/vendor/plugins (Redmine 1.x)
ls redmine/plugins/
README  redmine_ckeditor-master  redmine_ckeditor-master.zip 
mv redmine_ckeditor-master redmine_ckeditor
bundle install --without development test  //Install the required gems
rake redmine:plugins:migrate RAILS_ENV=production //Execute migration
2、重启服务

kill `pgrep ruby`

ruby script/rails server webrick -e production -p 8000 
3、管理--配置--文本格式 到插件那边自己配置一下


应该待办事项的插件的,在创建项目可以勾选待办事项和dashboard

https://github.com/AZielinski/Redmine-Todo-lists  支持2.4   //待办事项
停止服务
上传解压,解压出来的Redmine-Todo-lists-master改名为 redmine_todos  //这个很重要!否则会提示404
rake redmine:plugins:migrate   //因为我们的数据库是自己制定帐号密码的,要这样执行

rake redmine:plugins:migrate RAILS_ENV=production,否则会出现下面的情况
Access denied for user 'root'@'localhost' (using password: NO) 
然后插件那边启用就行了
启动服务
ruby script/rails server webrick -e production -p 8000 

我在操作过程中还出现500错误
redmine 500 错误,查看日志 没有表结构!rake redmine:plugins:migrate RAILS_ENV=production 
An error occurred on the page you were trying to access.
If you continue to experience problems please contact your Redmine administrator for assistance.
If you are the Redmine administrator, check your log files for details about the error.


https://github.com/jgraichen/redmine_dashboard#readme    //一个面板
上传解压后改名 redmine_dashboard  
ruby script/rails server webrick -e production -p 8000
Could not find gem 'haml (>= 0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems
根据提示执行bundle install即可,你也可以一个一个安装gem install a b c d....

http://www.redmine.org/plugins/issue_checklist  //问题检查列表
Unarchive plugin to folder redmine/plugins
bundle exec rake redmine:plugins NAME=redmine_issue_checklist RAILS_ENV=production
重启服务

卸载插件
建议先备份下数据库,有的插件有建表
rake redmine:plugins NAME=redmine_issue_checklist VERSION=0 RAILS_ENV=production
删除插件目录
重启即可

好了,我只学到这里,后面可能会继续更新。

参考:http://www.redmine.org/projects/redmine/wiki/RedmineInstall

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!