使用者工具

網站工具


server:redmine:centos7_安裝_redmine

CentOS7 安裝 Redmine

安装环境说明

* CentOS 7.6.1810
* Apache 2.4.6
* MariaDB 5.5
* Ruby 2.1.9
* Passenger 5.3.4
* redmine 3.4.6

1. Update the system

此步驟請使用 root

yum update

因為有更新 kernel 所以要重啟系統

reboot

2. Install necessary packages

yum groupinstall -y "Development tools"
yum install curl zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel ftp wget ImageMagick-devel gcc-c++ patch readline readline-devel zlib libyaml-devel libffi-devel make bzip2 autoconf automake libtool bison subversion sqlite-devel

3. Install Apache

yum -y install httpd

Start Apache & default Enable

systemctl start httpd
systemctl enable httpd

4. Install MariaDB

yum install mariadb-server mariadb

Start MariaDB & default Enable

systemctl start mariadb
systemctl enable mariadb

When the installation is complete, run the following command to secure your installation

mysql_secure_installation

Add new user for remote

mysql -u root -p

MariaDB [(none)]> use mysql;
MariaDB [(none)]> CREATE USER 'root'@'%' IDENTIFIED BY 'a*****6';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
MariaDB [(none)]> quit

Create a database for Redmine installation

mysql -uroot -p

MariaDB [(none)]> CREATE DATABASE redmine CHARACTER SET utf8;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'redmine_passwd';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> \q

5. Install Ruby

Install Ruby using RVM

curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -sSL https://get.rvm.io | bash -s stable --ruby

出現錯誤

gpg: Signature made Wed 08 May 2019 10:14:49 PM CST using RSA key ID 39499BDB
gpg: Can't check signature: No public key
GPG signature verification failed for '/usr/local/rvm/archives/rvm-1.29.8.tgz' - 'https://github.com/rvm/rvm/releases/download/1.29.8/1.29.8.tar.gz.asc'! Try to install GPG v2 and then fetch the public key:

    gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

or if it fails:

    command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
    command curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -

In case of further problems with validation please refer to https://rvm.io/rvm/security

依說明再執行以下

curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -
curl -sSL https://get.rvm.io | bash -s stable --ruby
or
curl -L get.rvm.io | bash -s stable

載入RVM環境

source /usr/local/rvm/scripts/rvm
source /etc/profile.d/rvm.sh
rvm reload

確認相依性套件

rvm requirements run

安裝Ruby 2.4.x、並檢查Ruby版本

rvm install "ruby-2.6.3"

檢查Ruby版本

rvm list
rvm --default use ruby
ruby --version

6. Install Redmine

Create Redmini folder

cd /usr/local
mkdir redmine

Download Redmine by SVN

cd redmine
svn co https://svn.redmine.org/redmine/branches/4.0-stable redmine-4.0

Config Redmine

cd redmine-4.0
cp config/configuration.yml.example config/configuration.yml
cp config/database.yml.example config/database.yml

Open the database.yml file and update username/password

vim config/database.yml
production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "redmine"
  encoding: utf8

7. Install Gems

cd $REDMINE
gem install bundler
bundle install --without development test

Prepare the database

rake generate_secret_token
RAILS_ENV=production rake db:migrate
RAILS_ENV=production REDMINE_LANG=en rake redmine:load_default_data

8. Start Redmine

bundle exec rails server webrick -e production -p 3000

9. Config Firewall

firewall-cmd --add-port=3000/tcp --permanent
firewall-cmd --reload
firewall-cmd --list-all

10. Test Redmine

http://x.x.x.x:3000

預設帳號密碼為 admin/admin

11. Apache Passenger 安裝設定

安裝Passenger套件後,可以讓Apache與Ruby on Rails的網頁溝通界接
Passenger的全名是Phusion Passenger,称为mod_rails或mod_rack,它是一个与Apache集成的Web应用程序,它可以作为Ruby On Rails应用程序的独立Web服务器支持。

cd $REDMINE
gem install passenger

系統提示須複制以下內容去Apache config

Please edit your Apache configuration file, and add these lines:

   LoadModule passenger_module /usr/local/rvm/gems/ruby-2.6.3/gems/passenger-6.0.2/buildout/apache2/mod_passenger.so
   <IfModule mod_passenger.c>
     PassengerRoot /usr/local/rvm/gems/ruby-2.6.3/gems/passenger-6.0.2
     PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.6.3/wrappers/ruby
   </IfModule>

After you restart Apache, you are ready to deploy any number of web
applications on Apache, with a minimum amount of configuration!
[root@webserver redmine-4.0]# cat /etc/httpd/conf.modules.d/pasenger.conf
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.6.3/gems/passenger-6.0.2/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
  PassengerRoot /usr/local/rvm/gems/ruby-2.6.3/gems/passenger-6.0.2
  PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.6.3/wrappers/ruby
</IfModule>
[root@webserver redmine-4.0]#
[root@webserver redmine-4.0]# cat /etc/httpd/conf.d/redmine.conf
<VirtualHost *:80>
    ServerName redmine.lang.idv.tw
    DocumentRoot "/usr/local/redmine/redmine-4.0"

    PassengerAppRoot "/usr/local/redmine/redmine-4.0"

    ErrorLog logs/redmine_error_log
    LogLevel warn

    <Directory "/usr/local/redmine/redmine-4.0">
        Options Indexes ExecCGI FollowSymLinks
        Require all granted
        AllowOverride all
    </Directory>
</VirtualHost>

Disable SELinux

nano /etc/sysconfig/selinux 
# 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
reboot

Test: http://redmine.lang.idv.tw

Reference

【Redmine安装–CentOS篇】Redmine3.4.x (CentOS Linux release 7.5 , MySQL 5.6, Apache2 , Phusion Passenger)
https://www.jianshu.com/p/4db895ceebdd

How To Install Redmine on CentOS 7
https://www.rosehosting.com/blog/how-to-install-redmine-on-centos-7/

CentOS 7安装Redmine
https://blog.csdn.net/h1101723183/article/details/80954587#%E5%AE%89%E8%A3%85redmine

CentOS 7.6上安裝專案管理系統 Redmine 3.4.7
https://blog.tomy168.com/2018/12/centos-76-redmine-347.html

server/redmine/centos7_安裝_redmine.txt · 上一次變更: 2019/05/19 07:41 由 eddie