Redmine部署安装手记

工作上杂事多,不能很好的汇报上级,所以想部署个项目管理规范规范。综合考虑后选择了很是折腾的Redmine,服务器上开了个虚拟机,装了Centos 7 minimal,参考Redmine官方文档开始部署。

1、安装一些常用软件

yum-yinstallscreenvimwgetsvn
#进入screen
screen

2、安装EPEL库

yum-yinstallepel-release

3、可选,关掉firewall(iptables哀)

[root@redmine~]#systemctllist-unit-files|grep-n'firewalld'
51:firewalld.serviceenabled
[root@redmine~]#systemctldisablefirewalld.service
[root@redmine~]#systemctllist-unit-files|grep-n'firewalld'
50:firewalld.servicedisabled

4、安装依赖

yum-yinstallzlib-develcurl-developenssl-develhttpd-develapr-develapr-util-develMysqL-develImageMagick-devel

5、安装Apache和MariaDB(MysqL

yum-yinstallhttpdmariadbmariadb-server
systemctlenablehttpd.service
systemctlenablemariadb.service
systemctlstarthttpd.service
systemctlstartmariadb.service

6、初始化MariaDB

[root@redmine~]#MysqL_secure_installation

NOTE:RUNNINgalLPARTSOFTHISSCRIPTISRECOMMENDEDFORALLMariaDB
SERVERSINPRODUCTIONUSE!PLEASEREADEACHSTEPCAREFULLY!

InordertologintoMariaDBtosecureit,we'llneedthecurrent
passwordfortherootuser.Ifyou'vejustinstalledMariaDB,and
youhaven'tsettherootpasswordyet,thepasswordwillbeblank,soyoushouldjustpressenterhere.

Entercurrentpasswordforroot(enterfornone):
OK,successfullyusedpassword,movingon...

SettingtherootpasswordensuresthatnobodycanlogintotheMariaDB
rootuserwithouttheproperauthorisation.

Setrootpassword?[Y/n]y
Newpassword:
Re-enternewpassword:
Passwordupdatedsuccessfully!
Reloadingprivilegetables..
...Success!


Bydefault,aMariaDBinstallationhasananonymoususer,allowinganyone
tologintoMariaDBwithouthavingtohaveauseraccountcreatedfor
them.Thisisintendedonlyfortesting,andtomaketheinstallation
goabitsmoother.Youshouldremovethembeforemovingintoa
productionenvironment.

Removeanonymoususers?[Y/n]y
...Success!

normally,rootshouldonlybeallowedtoconnectfrom'localhost'.This
ensuresthatsomeonecannotguessattherootpasswordfromthenetwork.

disallowrootloginremotely?[Y/n]n
...skipping.

Bydefault,MariaDBcomeswithadatabasenamed'test'thatanyonecan
access.Thisisalsointendedonlyfortesting,andshouldberemoved
beforemovingintoaproductionenvironment.

Removetestdatabaseandaccesstoit?[Y/n]y
-Droppingtestdatabase...
...Success!
-Removingprivilegesontestdatabase...
...Success!

Reloadingtheprivilegetableswillensurethatallchangesmadesofar
willtakeeffectimmediately.

ReloadprivilegetablesNow?[Y/n]y
...Success!

Cleaningup...

Alldone!Ifyou'vecompletedalloftheabovesteps,yourMariaDB
installationshouldNowbesecure.

ThanksforusingMariaDB!

7、装个webmin,装完浏览器通过SSL端口号10000访问,帐号密码同系统。

[root@redmine~]#cat<<EOF>/etc/yum.repos.d/webmin.repo
[Webmin]
name=WebmindistributionNeutral
#baseurl=http://download.webmin.com/download/yum
mirrorlist=http://download.webmin.com/download/yum/mirrorlist
enabled=1
EOF
[root@redmine~]#wgethttp://www.webmin.com/jcameron-key.asc
[root@redmine~]#rpm--importjcameron-key.asc
[root@redmine~]#yum-yinstallwebmin

8、通过RVM安装Ruby,用国内源加速

curl-Lhttps://get.rvm.io|bash
source/etc/profile.d/rvm.sh
echo"ruby_url=https://cache.ruby-china.org/pub/ruby">/usr/local/rvm/user/db
rvminstall--disable-binary2.4

9、安装Rubygems,用国内源加速

yum-yinstallrubygems
gemsources--addhttps://gems.ruby-china.org/--removehttps://rubygems.org/

10、安装Passenger

[root@redmine~]#geminstallpassenger
[root@redmine~]#passenger-install-apache2-module
Almostthere!

PleaseedityourApacheconfigurationfile,andaddtheselines:
#留意这一段代码,下面要用。
LoadModulepassenger_module/usr/local/rvm/gems/ruby-2.4.1/gems/passenger-5.1.8/buildout/apache2/mod_passenger.so
<IfModulemod_passenger.c>
PassengerRoot/usr/local/rvm/gems/ruby-2.4.1/gems/passenger-5.1.8
PassengerDefaultRuby/usr/local/rvm/gems/ruby-2.4.1/wrappers/ruby
</IfModule>

AfteryourestartApache,youarereadytodeployanynumberofweb
applicationsonApache,withaminimumamountofconfiguration!

PressENTERwhenyouaredoneediting.
#此时离开screen
[root@redmine~]#cat<<EOF>/etc/httpd/conf.d/passenger.conf
LoadModulepassenger_module/usr/local/rvm/gems/ruby-2.4.1/gems/passenger-5.1.8/buildout/apache2/mod_passenger.so
<IfModulemod_passenger.c>
PassengerRoot/usr/local/rvm/gems/ruby-2.4.1/gems/passenger-5.1.8
PassengerDefaultRuby/usr/local/rvm/gems/ruby-2.4.1/wrappers/ruby
</IfModule>
EOF
[root@redmine~]#systemctlrestarthttpd.service
#此时返回screen并继续下面操作
[root@redmine~]#screen-r

11、创建数据库

[root@redmine~]#MysqL--user=root--password=XXX
WelcometotheMariaDBmonitor.Commandsendwith;or\g.
YourMariaDBconnectionidis11
Serverversion:5.5.52-MariaDBMariaDBServer

copyright(c)2000,2016,Oracle,MariaDBCorporationAbandothers.

Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement.

MariaDB[(none)]>createdatabaseredminecharactersetutf8;
QueryOK,1rowaffected(0.08sec)

MariaDB[(none)]>quit;
Bye

12、安装Redmine,通过SVN拿版本

cd/var/www
svnco--trust-server-cert--non-interactivehttps://svn.redmine.org/redmine/branches/3.4-stableredmine

13、配置Redmine数据库连接

cd/var/www/redmine/config
cpdatabase.yml.exampledatabase.yml
vimdatabase.yml
#只改production的参数即可
production:
adapter:MysqL2
database:redmine
host:localhost
username:root
password:XXX
encoding:utf8

14、配置Rails,国内源加速

cd/var/www/redmine
geminstallbundler
bundleconfigmirror.https://rubygems.orghttps://gems.ruby-china.org
bundleinstall
rakegenerate_secret_token

15、部署Redmine数据库

RAILS_ENV=productionrakedb:migrate
RAILS_ENV=productionrakeredmine:load_default_data

16、启用FCGI

cd/var/www/redmine/public
cpdispatch.fcgi.exampledispatch.fcgi
cphtaccess.fcgi.example.htaccess
yum-yinstallmod_fcgid

17、配置httpd

[root@redmineconfig]#cat<<EOF>/etc/httpd/conf.d/redmine.conf
<VirtualHost*:80>
DocumentRoot/var/www/redmine/public/
ErrorLoglogs/redmine_error_log
<Directory"/var/www/redmine/public/">
OptionsIndexesExecCGIFollowSymLinks
Orderallow,deny
Allowfromall
AllowOverrideall
</Directory>
</VirtualHost>
EOF

18、运行Redmine

cd/var/www
chown-Rapache:apacheredmine
chmod-R755redmine
systemctlrestarthttpd.service

19、访问网页,收工。

相关文章

Centos下搭建性能监控Spotlight
CentOS 6.3下Strongswan搭建IPSec VPN
在CentOS6.5上安装Skype与QQ
阿里云基于centos6.5主机VPN配置
CentOS 6.3下配置multipah
CentOS安装、配置APR和tomcat-native