redmine安装教程


redmine安装需要首先需要查看对ruby的版本依赖,每个版本安装的软件都需要对应的版本,如果选错了,就会导致后面的安装失败。

各个版本之间的依赖可以到https://rubygems.org/gems/mysql2/versions该网址下查看

1、首先安装必要的依赖包:

[root@localhost ~]# yum -y install patch make gcc gcc-c++ gcc-g77 flex* bison file
[root@localhost ~]# yum -y install libtool libtool-libs autoconf kernel-devel
[root@localhost ~]# yum -y install libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel
[root@localhost ~]# yum -y install freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel
[root@localhost ~]# yum -y install glib2 glib2-devel bzip2 bzip2-devel libevent libevent-devel
[root@localhost ~]# yum -y install ncurses ncurses-devel curl curl-devel e2fsprogs
[root@localhost ~]# yum -y install e2fsprogs-devel krb5 krb5-devel libidn libidn-devel
[root@localhost ~]# yum -y install openssl openssl-devel vim-minimal nano sendmail
[root@localhost ~]# yum -y install fonts-chinese gettext gettext-devel
[root@localhost ~]# yum -y install ncurses-devel
[root@localhost ~]# yum -y install gmp-devel pspell-devel
[root@localhost ~]# yum -y install unzip
[root@localhost ~]# yum -y install automake libmcrypt* libtool-ltdl-devel*
[root@localhost ~]# yum -y install readline* libxslt* pcre* net-snmp* gmp* libtidy*
[root@localhost ~]# yum -y install ImageMagick* svnversion*

2、安装rvm以及需要的软件

(Ruby version manager) 顾名思义,就是安装ruby的包版本管理

由于国内无法直接访问外网,所以需要修改下配置才能正常安装,首先执行下面第一条命令,会提示443,无法访问的错误,这时候就要修改/etc/hosts值了

[root@localhost ~]# bash < <( curl -L https://get.rvm.io )     #第(1)步
[root@localhost ~]# source /etc/profile.d/rvm.sh               #第(2)步

会提示443,无法访问的错误,这时候就要修改/etc/host文件,首先打开/etc/hosts (有s不能丢),将199.232.28.133 raw.githubusercontent.com粘贴到打开的文件下面,保存,退出。

[root@localhost ~]# vi /etc/hosts

之后再执行  source /etc/profile.d/rvm.sh  上面的第(2)步,应用一下。

到这里,就把rvm 安装完成了。使用rvm -v查看一下版本,没有问题就进行下一步。

[root@localhost ~]# rvm -v

接下来就要安装ruby版本了,我这里选的是2.5.8,版本依赖参考 https://rubygems.org/gems/mysql2/versions

[root@localhost ~]# rvm list  #可以查看当前的ruby
[root@localhost ~]# rvm install 2.5.8

#扩展小知识
1. rvm list                     //查看当前安装的ruby版本
2. rvm install 2.5.8            //安装1.9.2的ruby版本
3. ruby -version                //查看当前版本
4. rvm use 1.9.2 --default      //修改指定特定的ruby版本
5. rvm list known               //查询已知版本

这里安装的时候会比较慢,下载,安装,编译,一样都少不了,需要耐心等待哦!

ruby安装结束后来安装rails,我这里选的是 5.2.2版本

[root@localhost ~]# gem install rails -v 5.2.2 -V  #后面的-V是为了回显,不然都不知道它有没有在干活

#扩展知识

安装特定的 rails版本

1. gem list --local rails //查看所有已经安装的rails版本

2. rails --version //查看当前rails的版本
3. gem install rails --version 3.0.5 //安装3.0.5 版本的rails

rails安装成功后安装rake版本,我选的是10.5.0,但是好像没啥用,后面bundle install的时候会覆盖掉

[root@localhost ~]# gem install rake -v 10.5.0 -V

安装mysql2,我选的是0.5.0版本

[root@localhost ~]# gem install mysql2 -v 0.5.0  
#安装这个的时候会提示没有安装客户端
如果遇到该问题,执行如下语句
[root@localhost ~]# yum install mysql-devel

3、安装redmine

下面打开要安装的路径,我这里安装到/opt路径下

[root@localhost ~]# cd /opt/
[root@localhost opt]# yum -y install subversion -v 1.7.14   #没有安装svn的要先装下
[root@localhost opt]# svn co http://svn.redmine.org/redmine/branches/3.3-stable redmine

4、运行bundle install 补全缺失的包以及版本不对的包

[root@localhost redmine]# cd /redmine
[root@localhost redmine]# bundle install #如果按照正常的步骤,这里是一路飘绿,看着很爽.如果版本冲突,一路飘红,看着很难受

5、配置mysql2数据库

 5.1 重命令名

[root@localhost redmine]# cd config/
[root@localhost ~]# mv database.yml.example database.yml #重命名数据库连接配置
[root@localhost ~]# mv configuration.yml.example configuration.yml  #重命名redmine配置

  5.2修改数据库配置

[root@localhost config]# vim database.yml
production:
  adapter: mysql2
  database: redmine       #数据库名称redmine
  host: 127.0.0.1         #数据库ip地址
  username: root
  password: "******"      #这个是mysql数据库密码,你需要自己装,如果有更好,只需要创建一个数据库redmine
  encoding: utf8

6、初始化redmin[root@localhost config]# cd ..

[root@localhost redmine]# rake config/initializers/secret_token.rb
[root@localhost redmine]# rake db:migrate RAILS_ENV="production"

 #如果数据库没有配置或者丢失文件manifest.js都会报错,如果市文件丢失,定位到要求的文件下面新建一个就可以了

提示无法连接到127.0.0.1时,需要去配置mysql数据库,请参考 《mysql数据库配置》

7、如果一切都配置好了,就可以启动redmine了

[root@localhost redmine]# ./bin/rails server -p3000 -b127.0.0.1 -e production #阻塞运行,ctrl+c停止
[root@localhost redmine]# ./bin/rails server -p3000 -b0.0.0.0 -e production -d #后台运行
[root@localhost redmine]# ps -ef | grep rails #查看开始的进程

8、登录

 初始账号密码是admin/admin,首次登陆后需要修改密码

9、配置邮箱

root@localhost ~]# ps auxf | grep sendmail
如果没有启动,启动下
[root@localhost ~]# service sendmail start
如果没有安装安装下
[root@localhost ~]# yum -y install sendmail
[root@localhost ~]# mail -s "mail from baoguo" baoguo.ding@roadshare.com < mail.txt
# 如果报  
-bash: mail: command not found [root@localhost ~]# yum -y install mailx 如果还报错,查看执行如下命令 [root@localhost ~]# tail /var/log/maillog [root@localhost ~]# vim /opt/redmine/config/configuration.yml default: # Outgoing emails configuration # See the examples below and the Rails guide for more configuration options: # http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration email_delivery: #
==== Simple SMTP server at localhost # # email_delivery: # delivery_method: :smtp # smtp_settings: # address: "localhost" # port: 25 # # ==== SMTP server at example.com using LOGIN authentication and checking HELO for foo.com # # email_delivery: delivery_method: :smtp smtp_settings: address: "******" port: 25 authentication: :login domain: '*******' user_name: 'xxxx@qq.com' password: 'qq授权码' #

如果设置邮件,需要把邮件的smtp打开,尤其是qq的需要找到对应的地方打开,并且密码填写的那个授权码。

设置完成后,重新启动,安装完成。

 

这里有几个踩的坑:

1、redmine高版本的数据库有字段修改的情况,这里如果是数据迁移的话,最好同版本修改,高版本的可以从零开始,否则建议找到好的迁移方式再迁移。

2、在使用高版本的rails时,会出现语法升级的情况,遇到这种情况不要慌,到log文件下查看日志,然后到github上找源码,对照着修改对应的文件就可以了。

3、修改文件到挂载盘需要到配置/opt/redmin/config/configuration.yml中去配置挂载的路径attachment_**,然后再重新启动就可以了。

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM