【Redmine安裝--CentOS篇】Redmine3.4.x (CentOS Linux release 7.5 , MySQL 5.6, Apache2 , Phusion Passenger)

Redmine管理工具

Tags: redmine 項(xiàng)目管理工具 團(tuán)隊(duì)管理工具 問題管理工具 centos下安裝redmine

目錄

  • 作者
  • 安裝環(huán)境說明
  • 一.更新系統(tǒng)關(guān)鍵組件
  • 二.安裝依賴項(xiàng)包
  • 三.安裝Apache和Mysql
  • 四.關(guān)閉SELinux
  • 五.設(shè)置主機(jī)名
  • 六.配置防火墻
  • 七.安裝PHP和phpMyAdmin
  • 八.安裝ruby
  • 九.安裝RubyGems
  • 十.安裝Passenger
  • 十一.為Redmine創(chuàng)建數(shù)據(jù)庫
  • 十二.安裝Redmine
  • 十三.設(shè)置Rails
  • 十四.為Redmine創(chuàng)建虛擬主機(jī)
  • 十五.保存文件配置并退出

作者

水士白 WaterWrite

安裝環(huán)境說明

  • redmine 3.4.6
  • CentOS Linux release 7.5
  • Mysql 5.5
  • Ruby 2.1.9
  • Passenger 5.3.4
  • Apache 2.4.7

一.更新系統(tǒng)關(guān)鍵組件

  1. 為方便起見,我們將按照以下方式進(jìn)行操作:
  • 選擇并復(fù)制命令(CTRL + C)

  • 右鍵單擊Putty窗口以粘貼命令,然后按Enter執(zhí)行

復(fù)制并執(zhí)行以下命令以更新系統(tǒng)的關(guān)鍵組件:

sudo yum update
  • 顯示信息如下,供參考:
Installed:
  kernel.x86_64 0:3.10.0-862.9.1.el7                                               

Updated:
  NetworkManager.x86_64 1:1.10.2-16.el7_5                                          
  NetworkManager-libnm.x86_64 1:1.10.2-16.el7_5                                    
  NetworkManager-team.x86_64 1:1.10.2-16.el7_5                                     
  NetworkManager-tui.x86_64 1:1.10.2-16.el7_5                                      
  binutils.x86_64 0:2.27-28.base.el7_5.1                                           
  ca-certificates.noarch 0:2018.2.22-70.0.el7_5                                    
  centos-release.x86_64 0:7-5.1804.4.el7.centos                                    
  dhclient.x86_64 12:4.2.5-68.el7.centos.1                                         
  dhcp-common.x86_64 12:4.2.5-68.el7.centos.1                                      
  dhcp-libs.x86_64 12:4.2.5-68.el7.centos.1                                        
  e2fsprogs.x86_64 0:1.42.9-12.el7_5                                               
  e2fsprogs-libs.x86_64 0:1.42.9-12.el7_5                                          
  gnupg2.x86_64 0:2.0.22-5.el7_5                                                   
  iptables.x86_64 0:1.4.21-24.1.el7_5                                              
  kernel-tools.x86_64 0:3.10.0-862.9.1.el7                                         
  kernel-tools-libs.x86_64 0:3.10.0-862.9.1.el7                                    
  libcom_err.x86_64 0:1.42.9-12.el7_5                                              
  libgcc.x86_64 0:4.8.5-28.el7_5.1                                                 
  libgomp.x86_64 0:4.8.5-28.el7_5.1                                                
  libss.x86_64 0:1.42.9-12.el7_5                                                   
  libstdc++.x86_64 0:4.8.5-28.el7_5.1                                              
  linux-firmware.noarch 0:20180220-62.2.git6d51311.el7_5                           
  nspr.x86_64 0:4.19.0-1.el7_5                                                     
  nss.x86_64 0:3.36.0-5.el7_5                                                      
  nss-softokn.x86_64 0:3.36.0-5.el7_5                                              
  nss-softokn-freebl.x86_64 0:3.36.0-5.el7_5                                       
  nss-sysinit.x86_64 0:3.36.0-5.el7_5                                              
  nss-tools.x86_64 0:3.36.0-5.el7_5                                                
  nss-util.x86_64 0:3.36.0-1.el7_5                                                 
  openldap.x86_64 0:2.4.44-15.el7_5                                                
  procps-ng.x86_64 0:3.3.10-17.el7_5.2                                             
  python.x86_64 0:2.7.5-69.el7_5                                                   
  python-libs.x86_64 0:2.7.5-69.el7_5                                              
  python-perf.x86_64 0:3.10.0-862.9.1.el7                                          
  rsyslog.x86_64 0:8.24.0-16.el7_5.4                                               
  selinux-policy.noarch 0:3.13.1-192.el7_5.4                                       
  selinux-policy-targeted.noarch 0:3.13.1-192.el7_5.4                              
  sudo.x86_64 0:1.8.19p2-14.el7_5                                                  
  yum-plugin-fastestmirror.noarch 0:1.1.31-46.el7_5                                
  yum-utils.noarch 0:1.1.31-46.el7_5                                               

Complete!
  1. 更新完成后,我們需要使用以下命令重新啟動(dòng)系統(tǒng):
reboot

二.安裝依賴項(xiàng)包

這些是用于編譯其他包的環(huán)境設(shè)置和實(shí)用工具的基本軟件包。

復(fù)制塊命令并在命令行中執(zhí)行:

這是一個(gè)很長的命令行,負(fù)責(zé)全部內(nèi)容。

sudo yum -y install nano zip unzip libyaml-devel zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel gcc ruby-devel gcc-c++ make postgresql-devel ImageMagick-devel sqlite-devel perl-LDAP mod_perl perl-Digest-SHA
  • 顯示信息如下,供參考:
Installed:
  ImageMagick-devel.x86_64 0:6.7.8.9-15.el7_2                                      
  apr-devel.x86_64 0:1.4.8-3.el7_4.1                                               
  apr-util-devel.x86_64 0:1.5.2-6.el7                                              
  gcc.x86_64 0:4.8.5-28.el7_5.1                                                    
  gcc-c++.x86_64 0:4.8.5-28.el7_5.1                                                
  httpd-devel.x86_64 0:2.4.6-80.el7.centos.1                                       
  libcurl-devel.x86_64 0:7.29.0-46.el7                                             
  libyaml-devel.x86_64 0:0.1.4-11.el7_0                                            
  mariadb-devel.x86_64 1:5.5.56-2.el7                                              
  nano.x86_64 0:2.3.1-10.el7                                                       
  openssl-devel.x86_64 1:1.0.2k-12.el7                                             
  perl-Digest-SHA.x86_64 1:5.85-4.el7                                              
  perl-LDAP.noarch 1:0.56-5.el7                                                    
  postgresql-devel.x86_64 0:9.2.23-3.el7_4                                         
  ruby-devel.x86_64 0:2.0.0.648-33.el7_4                                           
  sqlite-devel.x86_64 0:3.7.17-8.el7                                               
  unzip.x86_64 0:6.0-19.el7                                                        
  zip.x86_64 0:3.0-11.el7                                                          
  zlib-devel.x86_64 0:1.2.7-17.el7                                                 

Dependency Installed:
  ImageMagick.x86_64 0:6.7.8.9-15.el7_2                                            
  OpenEXR-libs.x86_64 0:1.7.1-7.el7                                                
  apr.x86_64 0:1.4.8-3.el7_4.1                                                     
  apr-util.x86_64 0:1.5.2-6.el7                                                    
  avahi-libs.x86_64 0:0.6.31-19.el7                                                
  bzip2-devel.x86_64 0:1.0.6-13.el7                                                
  cairo.x86_64 0:1.14.8-2.el7                                                      
  cpp.x86_64 0:4.8.5-28.el7_5.1                                                    
  cups-libs.x86_64 1:1.6.3-35.el7                                                  
  cyrus-sasl.x86_64 0:2.1.26-23.el7                                                
  cyrus-sasl-devel.x86_64 0:2.1.26-23.el7                                          
  expat-devel.x86_64 0:2.1.0-10.el7_3                                              
  fontconfig.x86_64 0:2.10.95-11.el7                                               
  fontpackages-filesystem.noarch 0:1.44-8.el7                                      
  freetype-devel.x86_64 0:2.4.11-15.el7                                            
  gdk-pixbuf2.x86_64 0:2.36.5-1.el7                                                
  ghostscript.x86_64 0:9.07-28.el7_4.2                                             
  ghostscript-devel.x86_64 0:9.07-28.el7_4.2                                       
  ghostscript-fonts.noarch 0:5.50-32.el7                                           
  glibc-devel.x86_64 0:2.17-222.el7                                                
  glibc-headers.x86_64 0:2.17-222.el7                                              
  graphite2.x86_64 0:1.3.10-1.el7_3                                                
  harfbuzz.x86_64 0:1.3.2-1.el7                                                    
  httpd.x86_64 0:2.4.6-80.el7.centos.1                                             
  httpd-tools.x86_64 0:2.4.6-80.el7.centos.1                                       
  ilmbase.x86_64 0:1.0.3-7.el7                                                     
  jasper-devel.x86_64 0:1.900.1-31.el7                                             
  jasper-libs.x86_64 0:1.900.1-31.el7                                              
  jbigkit-libs.x86_64 0:2.0-11.el7                                                 
  kernel-headers.x86_64 0:3.10.0-862.9.1.el7                                       
  keyutils-libs-devel.x86_64 0:1.5.8-3.el7                                         
  krb5-devel.x86_64 0:1.15.1-19.el7                                                
  lcms2.x86_64 0:2.6-3.el7                                                         
  libICE.x86_64 0:1.0.9-9.el7                                                      
  libICE-devel.x86_64 0:1.0.9-9.el7                                                
  libSM.x86_64 0:1.2.2-2.el7                                                       
  libSM-devel.x86_64 0:1.2.2-2.el7                                                 
  libX11.x86_64 0:1.6.5-1.el7                                                      
  libX11-common.noarch 0:1.6.5-1.el7                                               
  libX11-devel.x86_64 0:1.6.5-1.el7                                                
  libXau.x86_64 0:1.0.8-2.1.el7                                                    
  libXau-devel.x86_64 0:1.0.8-2.1.el7                                              
  libXdamage.x86_64 0:1.1.4-4.1.el7                                                
  libXext.x86_64 0:1.3.3-3.el7                                                     
  libXext-devel.x86_64 0:1.3.3-3.el7                                               
  libXfixes.x86_64 0:5.0.3-1.el7                                                   
  libXfont.x86_64 0:1.5.2-1.el7                                                    
  libXft.x86_64 0:2.3.2-2.el7                                                      
  libXrender.x86_64 0:0.9.10-1.el7                                                 
  libXt.x86_64 0:1.1.5-3.el7                                                       
  libXt-devel.x86_64 0:1.1.5-3.el7                                                 
  libXxf86vm.x86_64 0:1.1.4-1.el7                                                  
  libcom_err-devel.x86_64 0:1.42.9-12.el7_5                                        
  libdb-devel.x86_64 0:5.3.21-24.el7                                               
  libfontenc.x86_64 0:1.1.3-3.el7                                                  
  libjpeg-turbo.x86_64 0:1.2.90-5.el7                                              
  libjpeg-turbo-devel.x86_64 0:1.2.90-5.el7                                        
  libkadm5.x86_64 0:1.15.1-19.el7                                                  
  libmpc.x86_64 0:1.0.1-3.el7                                                      
  libpng.x86_64 2:1.5.13-7.el7_2                                                   
  librsvg2.x86_64 0:2.40.16-1.el7                                                  
  libselinux-devel.x86_64 0:2.5-12.el7                                             
  libsepol-devel.x86_64 0:2.5-8.1.el7                                              
  libstdc++-devel.x86_64 0:4.8.5-28.el7_5.1                                        
  libthai.x86_64 0:0.1.14-9.el7                                                    
  libtiff.x86_64 0:4.0.3-27.el7_3                                                  
  libtiff-devel.x86_64 0:4.0.3-27.el7_3                                            
  libtool-ltdl.x86_64 0:2.4.2-22.el7_3                                             
  libverto-devel.x86_64 0:0.2.5-4.el7                                              
  libwayland-client.x86_64 0:1.14.0-2.el7                                          
  libwayland-server.x86_64 0:1.14.0-2.el7                                          
  libwmf-lite.x86_64 0:0.2.8.4-41.el7_1                                            
  libxcb.x86_64 0:1.12-1.el7                                                       
  libxcb-devel.x86_64 0:1.12-1.el7                                                 
  libxshmfence.x86_64 0:1.2-1.el7                                                  
  libyaml.x86_64 0:0.1.4-11.el7_0                                                  
  mailcap.noarch 0:2.1.41-2.el7                                                    
  mesa-libEGL.x86_64 0:17.2.3-8.20171019.el7                                       
  mesa-libGL.x86_64 0:17.2.3-8.20171019.el7                                        
  mesa-libgbm.x86_64 0:17.2.3-8.20171019.el7                                       
  mesa-libglapi.x86_64 0:17.2.3-8.20171019.el7                                     
  mpfr.x86_64 0:3.1.1-4.el7                                                        
  openldap-devel.x86_64 0:2.4.44-15.el7_5                                          
  pango.x86_64 0:1.40.4-1.el7                                                      
  pcre-devel.x86_64 0:8.32-17.el7                                                  
  perl.x86_64 4:5.16.3-292.el7                                                     
  perl-Authen-SASL.noarch 0:2.15-10.el7                                            
  perl-Business-ISBN.noarch 0:2.06-2.el7                                           
  perl-Business-ISBN-Data.noarch 0:20120719.001-2.el7                              
  perl-Carp.noarch 0:1.26-244.el7                                                  
  perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7                                     
  perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7                                      
  perl-Convert-ASN1.noarch 0:0.26-4.el7                                            
  perl-Data-Dumper.x86_64 0:2.145-3.el7                                            
  perl-Digest.noarch 0:1.17-245.el7                                                
  perl-Digest-HMAC.noarch 0:1.03-5.el7                                             
  perl-Digest-MD5.x86_64 0:2.52-3.el7                                              
  perl-Encode.x86_64 0:2.51-7.el7                                                  
  perl-Encode-Locale.noarch 0:1.03-5.el7                                           
  perl-Exporter.noarch 0:5.68-3.el7                                                
  perl-File-Listing.noarch 0:6.04-7.el7                                            
  perl-File-Path.noarch 0:2.09-2.el7                                               
  perl-File-Temp.noarch 0:0.23.01-3.el7                                            
  perl-Filter.x86_64 0:1.49-3.el7                                                  
  perl-GSSAPI.x86_64 0:0.28-9.el7                                                  
  perl-Getopt-Long.noarch 0:2.40-3.el7                                             
  perl-HTML-Parser.x86_64 0:3.71-4.el7                                             
  perl-HTML-Tagset.noarch 0:3.20-15.el7                                            
  perl-HTTP-Cookies.noarch 0:6.01-5.el7                                            
  perl-HTTP-Daemon.noarch 0:6.01-7.el7                                             
  perl-HTTP-Date.noarch 0:6.02-8.el7                                               
  perl-HTTP-Message.noarch 0:6.06-6.el7                                            
  perl-HTTP-Negotiate.noarch 0:6.01-5.el7                                          
  perl-HTTP-Tiny.noarch 0:0.033-3.el7                                              
  perl-IO-Compress.noarch 0:2.061-2.el7                                            
  perl-IO-HTML.noarch 0:1.00-2.el7                                                 
  perl-IO-Socket-IP.noarch 0:0.21-5.el7                                            
  perl-IO-Socket-SSL.noarch 0:1.94-7.el7                                           
  perl-JSON.noarch 0:2.59-2.el7                                                    
  perl-LWP-MediaTypes.noarch 0:6.02-2.el7                                          
  perl-Mozilla-CA.noarch 0:20130114-5.el7                                          
  perl-Net-HTTP.noarch 0:6.06-2.el7                                                
  perl-Net-LibIDN.x86_64 0:0.12-15.el7                                             
  perl-Net-SSLeay.x86_64 0:1.55-6.el7                                              
  perl-PathTools.x86_64 0:3.40-5.el7                                               
  perl-Pod-Escapes.noarch 1:1.04-292.el7                                           
  perl-Pod-Perldoc.noarch 0:3.20-4.el7                                             
  perl-Pod-Simple.noarch 1:3.28-4.el7                                              
  perl-Pod-Usage.noarch 0:1.63-3.el7                                               
  perl-Scalar-List-Utils.x86_64 0:1.27-248.el7                                     
  perl-Socket.x86_64 0:2.010-4.el7                                                 
  perl-Storable.x86_64 0:2.45-3.el7                                                
  perl-Text-ParseWords.noarch 0:3.29-4.el7                                         
  perl-Text-Soundex.x86_64 0:3.04-4.el7                                            
  perl-Text-Unidecode.noarch 0:0.04-20.el7                                         
  perl-Time-HiRes.x86_64 4:1.9725-3.el7                                            
  perl-Time-Local.noarch 0:1.2300-2.el7                                            
  perl-TimeDate.noarch 1:2.30-2.el7                                                
  perl-URI.noarch 0:1.60-9.el7                                                     
  perl-WWW-RobotRules.noarch 0:6.02-5.el7                                          
  perl-XML-Filter-BufferText.noarch 0:1.01-17.el7                                  
  perl-XML-NamespaceSupport.noarch 0:1.11-10.el7                                   
  perl-XML-SAX-Base.noarch 0:1.08-7.el7                                            
  perl-XML-SAX-Writer.noarch 0:0.53-4.el7                                          
  perl-constant.noarch 0:1.27-2.el7                                                
  perl-libs.x86_64 4:5.16.3-292.el7                                                
  perl-libwww-perl.noarch 0:6.05-2.el7                                             
  perl-macros.x86_64 4:5.16.3-292.el7                                              
  perl-parent.noarch 1:0.225-244.el7                                               
  perl-podlators.noarch 0:2.5.1-3.el7                                              
  perl-threads.x86_64 0:1.87-4.el7                                                 
  perl-threads-shared.x86_64 0:1.43-6.el7                                          
  pixman.x86_64 0:0.34.0-1.el7                                                     
  poppler-data.noarch 0:0.4.6-3.el7                                                
  postgresql.x86_64 0:9.2.23-3.el7_4                                               
  postgresql-libs.x86_64 0:9.2.23-3.el7_4                                          
  ruby.x86_64 0:2.0.0.648-33.el7_4                                                 
  ruby-irb.noarch 0:2.0.0.648-33.el7_4                                             
  ruby-libs.x86_64 0:2.0.0.648-33.el7_4                                            
  rubygem-bigdecimal.x86_64 0:1.2.0-33.el7_4                                       
  rubygem-io-console.x86_64 0:0.4.2-33.el7_4                                       
  rubygem-json.x86_64 0:1.7.7-33.el7_4                                             
  rubygem-psych.x86_64 0:2.0.0-33.el7_4                                            
  rubygem-rdoc.noarch 0:4.0.0-33.el7_4                                             
  rubygems.noarch 0:2.0.14.1-33.el7_4                                              
  stix-fonts.noarch 0:1.1.0-5.el7                                                  
  urw-fonts.noarch 0:2.4-16.el7                                                    
  xorg-x11-font-utils.x86_64 1:7.5-20.el7                                          
  xorg-x11-proto-devel.noarch 0:7.7-20.el7                                         

Complete!

三.安裝Apache和Mysql

Apache是一個(gè)通過HTTP協(xié)議進(jìn)行通信的服務(wù)器應(yīng)用程序。 Apache可在Unix,Linux,Microsoft Windows和其他操作系統(tǒng)等操作系統(tǒng)上運(yùn)行。

Apache在互聯(lián)網(wǎng)和萬維網(wǎng)的發(fā)展中發(fā)揮著重要作用。

MySQL是世界上最流行的數(shù)據(jù)庫管理免費(fèi)開源,MySQL具有高速,穩(wěn)定和易用性,可移植性,在多個(gè)操作系統(tǒng)上運(yùn)行,提供了一個(gè)非常強(qiáng)大的實(shí)用功能系統(tǒng)。

憑借速度和高安全性,MySQL非常適合訪問互聯(lián)網(wǎng)上數(shù)據(jù)庫的應(yīng)用程序。

  1. 使用以下命令安裝Apache:
sudo yum -y install httpd 
  • 操作系統(tǒng)啟動(dòng)時(shí)允許啟動(dòng)服務(wù):
sudo chkconfig httpd on
sudo service httpd start
  1. centos7默認(rèn)不支持mysql,默認(rèn)支持的是mariadb,mariadb是mysql一個(gè)開源分支。
  • 如果已經(jīng)安裝mariadb,請(qǐng)使用以下方法將其卸載:

a.卸載mariadb,否則安裝mysql會(huì)出現(xiàn)沖突,

  • 執(zhí)行命令
rpm -qa | grep mariadb

列出所有被安裝的mariadb rpm 包;

  • 執(zhí)行命令
rpm -e --nodeps 包名稱(比如:rpm -e --nodeps mariadb-libs-5.5.44-2.el7.centos.x86_64)

逐個(gè)將所有列出的mariadb rpm 包給卸載掉

  1. 增加官方的yum源
  • 以安裝mysql5.6為例:

創(chuàng)建并編輯mysql-community.repo文件

vi /etc/yum.repos.d/mysql-community.repo

將以下內(nèi)容粘貼進(jìn)去并保存

[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

注意:gpgcheck是GPG加密校驗(yàn),官方文檔中,值為1,但check會(huì)報(bào)錯(cuò)誤,所以這里改為0跳過檢查,對(duì)安裝無影響。

  1. 安裝Mysql,執(zhí)行命令:
sudo yum install mysql-community-server

顯示效果如下,供參考:

Installed:
  mysql-community-server.x86_64 0:5.6.41-2.el7                                     

Dependency Installed:
  mysql-community-client.x86_64 0:5.6.41-2.el7                                     
  mysql-community-common.x86_64 0:5.6.41-2.el7                                     
  mysql-community-libs.x86_64 0:5.6.41-2.el7                                       
  net-tools.x86_64 0:2.0-0.22.20131004git.el7                                      
  perl-DBI.x86_64 0:1.627-4.el7                                                    
  perl-Net-Daemon.noarch 0:0.48-5.el7                                              
  perl-PlRPC.noarch 0:0.2020-14.el7                                                

Complete!
  • 操作系統(tǒng)啟動(dòng)時(shí)允許啟動(dòng)服務(wù):
sudo chkconfig mysqld on
sudo service mysqld start
  1. 設(shè)置mysql的root密碼
 /usr/bin/mysql_secure_installation
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "zh_CN.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").



NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
# 因?yàn)槲覀儧]有root帳戶的密碼所以請(qǐng)按Enter跳過。
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] Y
# 選擇“y”以設(shè)置MySQL root帳戶的密碼。
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
# 輸入并確認(rèn)您的密碼,刪除匿名用戶,選擇y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
# 允許以root帳戶遠(yuǎn)程登錄MySQL,選擇n。
 ... skipping.

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
# 刪除測試數(shù)據(jù)庫,選擇“y”
 - Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
 ... Failed!  Not critical, keep moving...
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
# 重新加載權(quán)限表,選擇y
 ... Success!




All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


Cleaning up...

四.關(guān)閉SELinux

SELinux是Linux操作系統(tǒng)的高級(jí)安全功能,在安裝系統(tǒng)時(shí),您需要關(guān)閉此功能才能順利完成該過程,成功后您可以根據(jù)需要打開。

 sudo nano /etc/selinux/config

按照以下內(nèi)容修改 :

SELINUX=disabled
  • 修改效果如下,供參考:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are prote$
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
  • 按CTRL + O保存文件,然后按CTRL + X退出。

五.設(shè)置主機(jī)名

默認(rèn)情況下,在安裝新的操作系統(tǒng)Centos時(shí)未設(shè)置主機(jī)名,因此我們需要使用以下命令進(jìn)行設(shè)置:

 sudo nano /etc/hosts
  GNU nano 2.3.1               File: /etc/hosts                                    

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

添加您在命令行上設(shè)置的域名或主機(jī)名,保存文件并退出,重新啟動(dòng)時(shí)將更改服務(wù)器名稱。

六.配置防火墻

我們不想關(guān)閉防火墻,因?yàn)樗浅V匾?,因此您需要添加?guī)則以允許HTTP端口80和HTTPS端口443。

CentOS 7中防火墻是一個(gè)非常的強(qiáng)大的功能,在CentOS 6.5中在iptables防火墻中進(jìn)行了升級(jí)了。CentOS 7 中默認(rèn)Firewall動(dòng)態(tài)管理防火墻

  1. 檢查動(dòng)態(tài)防火墻是否開啟
 ps -ef | grep firewalld
root     17724     1  0 14:49 ?        00:00:00 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
root     17851 17562  0 15:01 pts/1    00:00:00 grep --color=auto firewalld

如果firewalld進(jìn)程不存在,請(qǐng)輸入啟動(dòng)命令:

 sudo systemctl start firewalld.service 
  1. 添加端口22、80、8080、443和3306端口
 sudo firewall-cmd --zone=public --add-port=22/tcp --permanent 
 sudo firewall-cmd --zone=public --add-port=80/tcp --permanent 
 sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent 
 sudo firewall-cmd --zone=public --add-port=443/tcp --permanent
 sudo firewall-cmd --zone=public --add-port=3306/tcp --permanent
 sudo firewall-cmd --reload
  1. 檢查端口是否配置成功
 sudo firewall-cmd --list-ports
80/tcp 8080/tcp 443/tcp 3306/tcp 22/tcp
  1. 配置防火墻開機(jī)自啟動(dòng)
 sudo chkconfig firewalld on
Note: Forwarding request to 'systemctl enable firewalld.service'.
Created symlink from /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service to /usr/lib/systemd/system/firewalld.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/firewalld.service to /usr/lib/systemd/system/firewalld.service.
  1. 最后,我們需要重新啟動(dòng)系統(tǒng)以將更改應(yīng)用于SELinux和Hostname。
 sudo reboot

七.安裝PHP和phpMyAdmin

因?yàn)槲覀兪褂肕ySQL數(shù)據(jù)庫管理系統(tǒng),所以我們需要安裝phpMyAdmin程序管理。

phpMyAdmin是一個(gè)免費(fèi)的開源工具,由PHP語言編寫,通過Web瀏覽器管理MySQL數(shù)據(jù)庫。

它可以創(chuàng)建,修改或刪除數(shù)據(jù)庫,表,字段或記錄,執(zhí)行SQL語句或管理用戶和權(quán)限。

  1. 安裝PHP和包的命令:
 sudo yum -y install php php-mysql php-gd php-imap php-ldap php-mbstring php-odbc php-pear php-xml php-xmlrpc php-pecl-apc php-soap

命令執(zhí)行后顯示如下,供參考:

Installed:
  php.x86_64 0:5.4.16-45.el7             php-gd.x86_64 0:5.4.16-45.el7            
  php-ldap.x86_64 0:5.4.16-45.el7        php-mbstring.x86_64 0:5.4.16-45.el7      
  php-mysql.x86_64 0:5.4.16-45.el7       php-odbc.x86_64 0:5.4.16-45.el7          
  php-pear.noarch 1:1.9.4-21.el7         php-soap.x86_64 0:5.4.16-45.el7          
  php-xml.x86_64 0:5.4.16-45.el7         php-xmlrpc.x86_64 0:5.4.16-45.el7        

Dependency Installed:
  libXpm.x86_64 0:3.5.12-1.el7               libxslt.x86_64 0:1.1.28-5.el7         
  libzip.x86_64 0:0.10.1-8.el7               php-cli.x86_64 0:5.4.16-45.el7        
  php-common.x86_64 0:5.4.16-45.el7          php-pdo.x86_64 0:5.4.16-45.el7        
  php-process.x86_64 0:5.4.16-45.el7         t1lib.x86_64 0:5.1.2-14.el7           
  unixODBC.x86_64 0:2.3.1-11.el7            

Complete!
  1. 重新啟動(dòng)Apache服務(wù)
 sudo service httpd restart
  1. 然后,安裝phpMyadmin:
 sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
 sudo yum -y install phpmyadmin

命令執(zhí)行后顯示內(nèi)容如下,供參考:

Installed:
  phpMyAdmin.noarch 0:4.4.15.10-3.el7                                              

Dependency Installed:
  compat-libtidy.x86_64 0:0.99.0-37.20091203.el7                                   
  dejavu-fonts-common.noarch 0:2.33-6.el7                                          
  dejavu-sans-fonts.noarch 0:2.33-6.el7                                            
  php-bcmath.x86_64 0:5.4.16-45.el7                                                
  php-fedora-autoloader.noarch 0:1.0.0-1.el7                                       
  php-php-gettext.noarch 0:1.0.12-1.el7                                            
  php-tcpdf.noarch 0:6.2.13-1.el7                                                  
  php-tcpdf-dejavu-sans-fonts.noarch 0:6.2.13-1.el7                                
  php-tidy.x86_64 0:5.4.16-7.el7                                                   

Complete!
  1. 編輯虛擬主機(jī)文件以允許遠(yuǎn)程登錄phpMyadmin。
 sudo nano /etc/httpd/conf.d/phpMyAdmin.conf
  1. 編輯phpMyadmin的配置文件
    默認(rèn)情況下,CentOS 7上的phpMyAdmin只允許從回環(huán)地址(127.0.0.1)訪問。為了能遠(yuǎn)程連接,你需要改動(dòng)它的配置。

用文本編輯器打開phpMyAdmin的配置文件(路徑:/etc/httpd/conf.d/phpMyAdmin.conf),找出并注釋掉帶有"Require ip XXXX"字樣的代碼行。會(huì)有四處這樣的代碼行,用"Require all granted"取而代之。重新改動(dòng)過的配置文件如下所示。

<Directory /usr/share/phpMyAdmin/>
   AddDefaultCharset UTF-8

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
#       Require ip 127.0.0.1   
#       Require ip ::1             
       Require all granted    
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
#       Require ip 127.0.0.1    
#       Require ip ::1               
       Require all granted   
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>

# These directories do not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#
<Directory /usr/share/phpMyAdmin/libraries/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/lib/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/frames/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>
  1. 最后,重啟httpd使改動(dòng)生效
$ sudo systemctl restart httpd
  1. 成功安裝phpMyadmin后,您可以在以下地址查看:

HTTP://你的域名/ phpMyAdmin的

使用帳戶登錄:root / your_password

用密碼已經(jīng)設(shè)置在上面安裝MySQL數(shù)據(jù)庫的步驟。

phpMyadmin界面

注意:如果在PC上或不在專用服務(wù)器上的虛擬機(jī)中安裝Redmine系統(tǒng),我們需要將應(yīng)用程序phpMyadmin切換為在端口8080上運(yùn)行,因?yàn)槎丝?0將在后續(xù)步驟中用于Redmine。

我們需要向防火墻添加端口8080(已在第六章配置防火墻描述并添加)并更改phpMyadmin的VirtualHost。

  • 編輯VirtualHost文件以在端口8080上運(yùn)行phpMyadmin
$ sudo nano /etc/httpd/conf/httpd.conf

修改如下內(nèi)容,供參考:

<VirtualHost *:8080>
    DocumentRoot /usr/share/phpmyadmin/
    ServerName your_domain.com
</VirtualHost>

接下來,添加命令以允許偵聽文件“httpd.conf”中的端口8080

$ sudo nano /etc/httpd/conf/httpd.conf

添加以下命令:

Listen 8080

保存文件并退出,重新啟動(dòng)Apache服務(wù):

$ sudo service httpd restart

現(xiàn)在,phpMyadmin將在地址8080上運(yùn)行:

八.安裝ruby

Ruby是一種面向?qū)ο蟮木幊陶Z言,能夠反射。 語法繼承自Ada和Perl,具有Smalltalk的面向?qū)ο筇匦裕⑶疫€與Python,Lisp,Dylan和CLU共享一些特性,Ruby是單階段解釋器。

Ruby提供編程模式,包括函數(shù)式編程,面向?qū)ο?,命令式,反射式,它使用?dòng)態(tài)變量和自動(dòng)內(nèi)存管理。

  1. 使用版本管理程序RVM安裝Ruby解釋器:
$ \curl -L https://get.rvm.io | bash
  1. 成功之后,我們將推出RVM
$ source /home/parallels/.rvm/scripts/rvm
  1. 以下命令將列出要安裝的Ruby版本:
$ rvm list known

顯示內(nèi)容如下,供參考:

# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[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[.10]
[ruby-]2.3[.7]
[ruby-]2.4[.4]
[ruby-]2.5[.1]
[ruby-]2.6[.0-preview2]
ruby-head
  1. 我們選擇穩(wěn)定版本[ruby-] 2.2 [.10],并執(zhí)行以下命令:
$ rvm install 2.2

安裝過程相當(dāng)長,但您不需要任何干預(yù),成功后,請(qǐng)使用以下命令進(jìn)行檢查:

注:如果下載非常慢,可以輸入以下指令修改gem源,然后再運(yùn)行rvm install 2.2

$ gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
$ gem sources -l
*** CURRENT SOURCES ***
https://gems.ruby-china.com

請(qǐng)確保只有 https://gems.ruby-china.com

$ ruby -v
ruby 2.2.10p489 (2018-03-28 revision 63023) [x86_64-linux]

九.安裝RubyGems

Rubygems是一個(gè)Ruby的包管理程序,在Ruby語言和Ruby On Rails框架編寫的應(yīng)用程序中非常流行。

$ yum -y install rubygems

十.安裝Passenger

Passenger的全名是Phusion Passenger,稱為mod_rails或mod_rack,它是一個(gè)與Apache集成的Web應(yīng)用程序,它可以作為Ruby On Rails應(yīng)用程序的獨(dú)立Web服務(wù)器支持。

  1. 執(zhí)行以下命令:
$ gem install passenger
$ passenger-install-apache2-module

顯示如下,供參考:

This installer will guide you through the entire installation process. It
shouldn't take more than 3 minutes in total.

Here's what you can expect from the installation process:

 1. The Apache 2 module will be installed for you.
 2. You'll learn how to configure Apache.
 3. You'll learn how to deploy a Ruby on Rails application.

Don't worry if anything goes wrong. This installer will advise you on how to
solve any problems.

Press Enter to continue, or Ctrl-C to abort.


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

Which languages are you interested in?

Use <space> to select.
If the menu doesn't display correctly, press '!'

   ?  Ruby
 ? ?  Python
   ?  Node.js
   ?  Meteor

  1. 完成后,我們?cè)诖翱谥袕?fù)制通知塊以在后續(xù)步驟中創(chuàng)建配置文件(選擇塊通知并按C進(jìn)行復(fù)制)。
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p545/gems/passenger-4.0.37/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
   PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p545/gems/passenger-4.0.37
   PassengerDefaultRuby /usr/local/rvm/gems/ruby-1.9.3-p545/wrappers/ruby
</IfModule>
  1. 為Passenger創(chuàng)建一個(gè)新的虛擬主機(jī)文件:
$ nano /etc/httpd/conf.d/passenger.conf
  1. 將命令塊粘貼到空文件中并保存,然后重新啟動(dòng)Apache服務(wù)。
$ service httpd restart

十一.為Redmine創(chuàng)建數(shù)據(jù)庫

使用MySQLAdmin為Redmine創(chuàng)建一個(gè)空數(shù)據(jù)庫,保存密碼以在接下來的步驟中填寫配置文件。

$ mysql --user=root --password=root_password_mysql
> create database redmine_db character set utf8;
> create user 'redmine_admin'@'localhost' identified by 'your_new_password';
> grant all privileges on redmine_db.* to 'redmine_admin'@'localhost';
> quit;

十二.安裝Redmine

Redmine是項(xiàng)目管理系統(tǒng)的主要程序,我們將從Redmine網(wǎng)站下載并安裝該程序。

  1. 將Redmine版本3.4.6下載到Centos OS上的目錄“/ var / www”。
$ cd /var/www
$ yum install wget
$ wget http://www.redmine.org/releases/redmine-3.4.6.tar.gz
  1. 解壓縮文件夾并重命名目錄
$ tar xvfz redmine-3.4.6.tar.gz
$ mv redmine-3.4.6 redmine
$ rm -rf redmine-3.4.6.tar.gz
  1. 配置數(shù)據(jù)庫

接下來,我們需要配置數(shù)據(jù)庫是從上面的步驟創(chuàng)建的。

$ cd /var/www/redmine/config
$ cp database.yml.example database.yml
$ nano database.yml

配置"production"內(nèi)容如下:

production:
  adapter: mysql2
  database: redmine_db
  host: localhost
  username: redmine_admin
  password: "123456"
  encoding: utf8

輸入數(shù)據(jù)庫名稱,輸入數(shù)據(jù)庫的用戶名和密碼。 按CTRL + O保存文件,按CTRL + X退出。

十三.設(shè)置Rails

  1. 使用Bundle安裝Rails的軟件包庫支持。
$ bundle config mirror.https://rubygems.org https://gems.ruby-china.org
$ cd /var/www/redmine
$ gem install bundler
$ bundle install
$ rake generate_secret_token
  1. 接下來,我們?yōu)镽edmine應(yīng)用程序創(chuàng)建數(shù)據(jù)庫表。
$ RAILS_ENV=production rake db:migrate
$ RAILS_ENV=production rake redmine:load_default_data
Select language: 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
  1. 激活FCGI
$ cd /var/www/redmine/public
$ cp dispatch.fcgi.example dispatch.fcgi
$ cp htaccess.fcgi.example .htaccess
  1. 設(shè)置Apache和FastCGI
$ cd /var/www/
$ rpm --import https://fedoraproject.org/static/0608B895.txt
$ wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ rpm -ivh epel-release-6-8.noarch.rpm
$ yum -y install mod_fcgid
$ rm -rf epel-release-6-8.noarch.rpm
  1. 創(chuàng)建文件目錄
    該目錄包含在Redmine作為文檔或圖像文件操作期間生成的數(shù)據(jù)文件,我們?cè)凇? opt”中創(chuàng)建一個(gè)新目錄。
$ mkdir -p /opt/redmine/files
$ chown -R apache:apache /opt/redmine
$ cd /var/www/redmine/config
$ cp configuration.yml.example configuration.yml
$ nano configuration.yml

  # Configuration of the autologin cookie.
  # autologin_cookie_name: the name of the cookie (default: autologin)bsolute path to the directory where attachments are stored.
  # The default is the 'files' directory in your Redmine instance.
  # Your Redmine instance needs to have write permission on this
  # directory.
  # Examples:
   attachments_storage_path: /opt/redmine/files
  # attachments_storage_path: D:/redmine/files
  #attachments_storage_path:

將包含剛剛在上一步中創(chuàng)建的數(shù)據(jù)文件的目錄路徑輸入“attachments_storage_path”行。

注意:您必須在字符“:”之后的路徑“/ opt / redmine / files”的開頭添加一個(gè)空格

十四.為Redmine創(chuàng)建虛擬主機(jī)

在端口80上為Redmine應(yīng)用程序創(chuàng)建Apache配置文件。

$ ln -s /var/www/redmine/public/ /var/www/html/redmine
$ nano /etc/httpd/conf.d/redmine.conf

復(fù)制下面的文本并粘貼到編輯器窗口,記下要更改域名的信息。

<VirtualHost *:80>

        DocumentRoot /var/www/html/redmine

        ErrorLog logs/redmine_error_log

        PassengerAppRoot /var/www/redmine/
</VirtualHost>

十五.保存文件配置并退出

在第一次執(zhí)行Redmine之前,我們必須對(duì)安裝Redmine的目錄進(jìn)行權(quán)限并重新啟動(dòng)Apache服務(wù)。

$ cd /var/www
$ chown -R apache:apache redmine
$ chmod -R 755 redmine
$ service httpd restart

Redmine將在以下地址URL運(yùn)行:

HTTP://您的域

使用管理員帳戶登錄系統(tǒng):admin / admin

您可以在成功登錄后更改密碼。

我們可以看到Redmine已經(jīng)運(yùn)行但非常原始,在接下來的步驟中我們將安裝支持插件和自定義Redmine使用專業(yè)。

參考資料:
1.https://www.redmine.org/projects/redmine/wiki/Install_Redmine_25x_on_Centos_65_complete
2.https://blog.csdn.net/yyycheng/article/details/79753032
3.https://blog.csdn.net/u011304615/article/details/78871479
4.http://www.bubuko.com/infodetail-2276084.html

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容