工作上杂事多,不能很好的汇报上级,所以想部署个项目管理规范规范。综合考虑后选择了很是折腾的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、访问网页,收工。
原文链接:https://www.f2er.com/centos/376086.html