微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

CentOS上安装Redmine-3.4项目管理软件

1.说明

redmine和ruby以及rails的版本号关系如下:
Redmine版本支持Ruby版本使用Rails版本
4.0(即将到来的)ruby2.2,2.3,2.4Rails5.1
3.4ruby1.9.3,2.0.0,2.1,2.2,2.4Rails4.2
3.3ruby1.9.3,2.3Rails4.2
3.2ruby1.9.3.2.0.0,2.2Rails4.2

支持Ruby1.9.3,2.0和2.1通过Ruby社区已经结束。
Redmine3.2或更低的不支持Ruby2.3。Redmine3.3支持Ruby2.3。
Redmine不支持JRuby因为一些gems不支持Rails4.2。

官方安装文档:http://www.redmine.org/projects/redmine/wiki/RedmineInstall

redmine安装思路:MysqL-->RVM-->ruby-->gem-->rails-->redmine

注:SELinux和防火墙要关闭

2.安装MysqL

MysqL5.7.15二进制安装,详见我的另一篇博客

http://blog.51cto.com/moerjinrong/2092614

3.设置MysqL的账号和密码,并创建redmine数据库

[root@node1MysqL]#MysqL-uroot-p
root@node114:18:[(none)]>createdatabaseredminecharactersetutf8;
QueryOK,1rowaffected(0.01sec)

root@node114:29:[(none)]>createuser'redmine'@'localhost'IDENTIFIEDBY'my_password';
QueryOK,0rowsaffected(0.00sec)

root@node114:29:[(none)]>grantallprivilegesonredmine.*to'redmine'@'localhost';
QueryOK,0rowsaffected(0.00sec)

root@node114:30:[(none)]>flushprivileges;
QueryOK,0rowsaffected(0.00sec)

4.安装rvm

curl-Lget.rvm.io|bash-sstable

如果遇到以下报错,则执行报错中的gpg2--recv-keys的命令。
[root@node1~]#curl-Lget.rvm.io|bash-sstable
%Total%received%XferdAverageSpeedTimeTimeTimeCurrent
DloadUploadTotalSpentLeftSpeed
100194100194003350--:--:----:--:----:--:--335
1002409010024090001742100:00:010:00:01--:--:--44446
Downloadinghttps://github.com/rvm/rvm/archive/1.29.3.tar.gz
Downloadinghttps://github.com/rvm/rvm/releases/download/1.29.3/1.29.3.tar.gz.asc
gpg:于2017年09月11日星期一04时59分21秒CST创建的签名,使用RSA,钥匙号BF04FF17
gpg:无法检查签名:没有公钥
Warning,RVM1.26.0introducessignedreleasesandautomatedcheckofsignatureswhenGPGsoftwarefound.AssumingyoutrustMichalPapisimportthempapispublickey(downloadingthesignatures).

GPGsignatureverificationFailedfor'/usr/local/rvm/archives/rvm-1.29.3.tgz'-'https://github.com/rvm/rvm/releases/download/1.29.3/1.29.3.tar.gz.asc'!TrytoinstallGPGv2andthenfetchthepublickey:

gpg2--recv-keys409B6B1796C275462A1703113804BB82D39DC0E3#报错执行这个命令
orifitfails:

commandcurl-sSLhttps://rvm.io/mpapis.asc|gpg2--import-
thekeycanbecomparedwith:

https://rvm.io/mpapis.asc
https://keybase.io/mpapis
NOTE:GPGversion2.1.17haveabugwhichcausefailuresduringfetchingkeysfromremoteserver.Pleasedowngradeorupgradetonewerversion(ifavailable)orusethesecondmethoddescribedabove.

执行报错中的gpg2--recv-keys的命令。

[root@node1~]#gpg2--recv-keys409B6B1796C275462A1703113804BB82D39DC0E3 gpg:钥匙环‘/root/.gnupg/secring.gpg’已建立 gpg:下载密钥‘D39DC0E3’,从hkp服务器keys.gnupg.net gpg:/root/.gnupg/trustdb.gpg:建立了信任度数据库 gpg:密钥D39DC0E3:公钥“MichalPapis(RVMsigning)<mpapis@gmail.com>”已导入 gpg:没有找到任何绝对信任的密钥 gpg:合计被处理的数量:1 gpg:已导入:1(RSA:1)

再次执行命令curl-Lget.rvm.io|bash-sstable。

[root@node1~]#curl-Lget.rvm.io|bash-sstable
%Total%received%XferdAverageSpeedTimeTimeTimeCurrent
DloadUploadTotalSpentLeftSpeed
100194100194003100--:--:----:--:----:--:--309
1002409010024090001823000:00:010:00:01--:--:--103k
Downloadinghttps://github.com/rvm/rvm/archive/1.29.3.tar.gz
Downloadinghttps://github.com/rvm/rvm/releases/download/1.29.3/1.29.3.tar.gz.asc
gpg:于2017年09月11日星期一04时59分21秒CST创建的签名,使用RSA,钥匙号BF04FF17
gpg:完好的签名,来自于“MichalPapis(RVMsigning)<mpapis@gmail.com>”
gpg:亦即“MichalPapis<michal.papis@toptal.com>”
gpg:亦即“[jpegimageofsize5015]”
gpg:警告:这把密钥未经受信任的签名认证!
gpg:没有证据表明这个签名属于它所声称的持有者。
主钥指纹:409B6B1796C275462A1703113804BB82D39DC0E3
子钥指纹:62C9E5F4DA300D94AC36166BE206C29FBF04FF17
GPGverified'/usr/local/rvm/archives/rvm-1.29.3.tgz'
Creatinggroup'rvm'

InstallingRVMto/usr/local/rvm/
InstallationofRVMin/usr/local/rvm/isalmostcomplete:

*Firstyouneedtoaddallusersthatwillbeusingrvmto'rvm'group,andlogout-loginagain,anyoneusingrvmwillbeoperatingwith`umasku=rwx,g=rwx,o=rx`.

*TostartusingRVMyouneedtorun`source/etc/profile.d/rvm.sh`
inallyouropenshellwindows,inrarecasesyouneedtoreopenallshellwindows.

以上表示执行成功,然后加载一下rvm命令。

[root@node1~]#source/usr/local/rvm/scripts/rvm

查看rvm库中已知的ruby版本

[root@node1~]#rvmlistkNown
#MRIRubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head]#securityreleasedonhead
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p551]
[ruby-]2.0.0[-p648]
[ruby-]2.1[.10]
[ruby-]2.2[.7]
[ruby-]2.3[.4]
[ruby-]2.4[.1]
ruby-head
......

5.安装Ruby

#安装ruby
[root@node1~]#rvminstall2.4.1

#使用新版本
[root@node1~]#rvmuse2.4.1

#查看当前版本
[root@node1~]#ruby--version

6.如果gem的源所在的网络不好,可以更改源

请尽可能用比较新的RubyGems版本,建议2.6.x以上。
[root@node1~]#gemupdate--system#这里请×××一下
[root@node1~]#gem-v
2.6.14
[root@node1~]#gemsources-l#查看当前镜像源
https://rubygems.org/
[root@node1~]#gemsources--addhttps://gems.ruby-china.org/--removehttps://rubygems.org/
[root@node1~]#gemsources-l
https://gems.ruby-china.org
#确保只有gems.ruby-china.org

如果你使用Gemfile和Bundler(例如:Rails项目) 你可以用Bundler的Gem源代码镜像命令。

[root@node1~]#bundleconfigmirror.https://rubygems.orghttps://gems.ruby-china.org

这样你不用改你的Gemfile的source。

source'https://rubygems.org/'
gem'rails','4.2.5'
...
SSL证书错误
正常情况下,你是不会遇到SSL证书错误的,除非你的Ruby安装方式不正确。
如果遇到SSL证书问题,你又无法解决,请修改~/.gemrc文件增加ssl_verify_mode:0配置,以便于RubyGems可以忽略SSL证书错误

--- :sources: -https://gems.ruby-china.org :ssl_verify_mode:0

如果你在意Gem下载的安全问题,请正确安装Ruby、OpenSSL,建议部署Linux服务器的时候采用这个RVM安装脚本的方式安装Ruby。

7.安装rails 和 相关依赖包

[root@node1~]#geminstallrails
[root@node1~]#geminstallrake
[root@node1~]#geminstallMysqL2

8.下载redmine并安装依赖

[root@node1~]#yuminstallImageMagick-devel
[root@node1~]#useradd-s/sbin/nologinredmine
[root@node1~]#cd/usr/local/
[root@node1local]#wgethttp://www.redmine.org/releases/redmine-3.4.4.tar.gz
[root@node1local]#tarxfredmine-3.4.4.tar.gz
[root@node1local]#mvredmine-3.4.4redmine&&cdredmine
[root@node1local]#chown-Rroot:root/usr/local/redmine
[root@node1redmine]#bundleinstall
Don'trunBundlerasroot.Bundlercanaskforsudoifitisneeded,andinstallingyourbundleasrootwillbreakthisapplicationforallnon-rootusersonthismachine.
Thedependencytzinfo-data(>=0)willbeunusedbyanyoftheplatformsBundlerisinstallingfor.Bundlerisinstallingforrubybutthedependencyisonlyforx86-mingw32,x64-mingw32,x86-mswin32.Toaddthoseplatformstothebundle,run`bundlelock--add-platformx86-mingw32x64-mingw32x86-mswin32`.
FetchinggemMetadatafromhttps://rubygems.org/..........
FetchinggemMetadatafromhttps://rubygems.org/.
Resolvingdependencies....
Usingrake12.3.1
......
Use`bundleinfo[gemname]`toseewhereabundledgemisinstalled.
post-installmessagefromyard:
--------------------------------------------------------------------------------
AsofYARDv0.9.2:

RubyGems"--document=yri,yard"hooksareNowsupported.Youcanauto-configure
YARDtoautomaticallybuildtheyriindexforinstalledgemsbytyping:

$yardconfig--gem-install-yri

See`yardconfig--help`formoreinformationonRubyGemsinstallhooks.

Youcanalsoaddthefollowingtoyour.gemspectohaveYARDdocumentyourgem
oninstall:

spec.Metadata["yard.run"]="yri"#use"yard"tobuildfullHTMLdocs.

--------------------------------------------------------

9.配置redmine并初始化

Redmine设置在config/configuration.yml的文件中定义。
[root@node1~]#cd/usr/local/redmine/config/
[root@node1config]#cpconfiguration.yml{.example,}
[root@node1config]#cpdatabase.yml{.example,}
[root@node1config]#vimdatabase.yml#选择production部分修改数据库密码
production:
adapter:MysqL2
database:redmine
host:localhost
port:3306
socket:/data/MysqL/MysqL3306.sock
username:redmine
password:"my_password"
encoding:utf8

[root@node1config]#cd../
[root@node1redmine]#rakegenerate_secret_token
[root@node1redmine]#RAILS_ENV=productionbundleexecrakedb:migrate#生成表结构
==1Setup:migrating=========================================================
--create_table("attachments",{:force=>true})
->0.0363s
--create_table("auth_sources",{:force=>true})
->0.0231s
......
==20170419144536AddViewMessagesToAllExistingRoles:migrating================
==20170419144536AddViewMessagesToAllExistingRoles:migrated(0.0170s)=======

[root@node1redmine]#RAILS_ENV=productionbundleexecrakeredmine:load_default_data#初始化数据选择zh
Selectlanguage:ar,az,bg,bs,ca,cs,da,de,el,en,en-GB,es,es-PA,et,eu,fa,fi,fr,gl,he,hr,hu,id,it,ja,ko,lt,lv,mk,mn,nl,no,pl,pt,pt-BR,ro,ru,sk,sl,sq,sr,sr-YU,sv,th,tr,uk,vi,zh,zh-TW[en]zh
====================================
Defaultconfigurationdataloaded.
[root@node1redmine]#

权限设置:

[root@node1redmine]#pwd
/usr/local/redmine
[root@node1redmine]#mkdir-pvtmptmp/pdfpublic/plugin_assets
[root@node1redmine]#chown-Rredmine:redminefileslogtmppublic/plugin_assets
[root@node1redmine]#chmod-R755fileslogtmppublic/plugin_assets

10.启动redmine

[root@node1~]#nohup/usr/local/rvm/rubies/ruby-2.4.1/bin/ruby/usr/local/redmine/bin/railsserver-eproduction-b0.0.0.0>/dev/null2>&1&

11.访问登录

访问http://ip:3000/
认账号和密码adminadmin

12.后续备份:

主要是备份MysqL的redmine库,config下面的yml配置文件,以及files下面的附件:
#!/bin/bash
bk_time=`date+"%Y%m%d"`

cd/usr/local/redmine
tar-zcf/home/redmine/redmine_backup/conf_file_${bk_time}.tar.gzfiles/config/*.yml

MysqLdump-u****-p"****"redmine|gzip>/home/redmine/MysqL_backup/redmine_${bk_time}.sql.gz

参考

https://blog.csdn.net/linxi7/article/details/79216859

报错:

1.ERRORRuntimeError:Missing`secret_token`and`secret_key_base`for'production'environment,setthesevaluesin`config/secrets.yml`
解决:
执行:bundleexecrakegenerate_secret_token

原文地址:https://www.jb51.cc/centos/374555.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。