Install the project management tool "Redmine" on CentOS8 (database is Postgre)

version

CentOS Linux release 8.2.2004 (Core)

What is Redmine?

An open source project management tool. A web application that runs on the framework "Ruby on Rails" of the programming language "Ruby".

It is written in various ways on the Japanese version page of Redmine. https://redmine.jp/overview/

etc.

Original installation manual

~~ Here http://blog.redmine.jp/articles/3_4/install/centos/ In this article, I'm just going according to the manual, but the manual is based on CentOS 7.3. ~~

~~ Maybe you need special settings only for version 8 ... I feel like I'm doing that kind of verification. ~~

When I tried to install CentOS8 by the method of CentOS7.3, it failed brilliantly ... (´ ・ ω ・ `) To start over from the beginning ... There are 8 for 8 and 7 for 7.

Reference site

I traced this procedure. https://serverbuild.net/2020/03/12/centos8-redmine-howtoinstall/

Installation of necessary software

I wonder if the transition from yum to dnf is different from CentOS 7.

dnf -y update
dnf -y groupinstall "Development Tools"
dnf -y install openssl-devel readline-devel zlib-devel curl-devel libffi-devel subversion
dnf -y install postgresql-server postgresql-devel
dnf -y install httpd httpd-devel

Ruby installation

Download, unzip, install from source code.

cd /opt/
wget https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.5.tar.gz
tar zxvf ruby-2.6.5.tar.gz
cd ruby-2.6.5/
./configure --disable-install-doc
make
make install

ruby -After checking the version of Ruby with v, 2.6.It wasn't 5 ...


 Is it a remnant of when Redmine installation failed? Hmm ... I don't know ... (´ ・ ω ・ `)

 So it's a little detour.
 ** rbenv ≒ Prepare a guy who can install Ruby by specifying the version **.

 Reference site
https://qiita.com/lenore/items/259556172e62a0ae8e50

 First, prepare the tools needed to install rbenv.

yum -y install git bzip2 gcc gcc-c++ openssl-devel readline-devel zlib-devel yum -y install epel-release yum -y install nodejs


 Clone the rbenv code in Git.

git clone https://github.com/rbenv/rbenv.git /usr/local/rbenv git clone https://github.com/rbenv/ruby-build.git /usr/local/rbenv/plugins/ruby-build


 Create a new file called /etc/profile.d/rbenv.sh.
 The contents are as follows.

export RBENV_ROOT=/usr/local/rbenv export PATH={RBENV_ROOT}/bin:PATH eval "$(rbenv init --no-rehash -)"


 Execute the created sh.

source /etc/profile.d/rbenv.sh


 After that, change the sudo permission setting with the ``` visudo``` command.

 Add the following line.

Defaults env_keep += "RBENV_ROOT"


 Changed the following (Defaults secure_path).

Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/rbenv/bin:/usr/local/rbenv/shims



 Now, check if rbenv was installed with ``` rbenv --version```.


 If you can install rbenv ... Specify the version and Ruby insco. The following command.

rbenv install 2.6.5


 Install until 2.6.5 is applied. The following command.

rbenv global 2.6.5 rbenv rehash


 Check again if the Ruby version is 2.6.5 with ``` ruby -v```!


# bundler installation
 Install with the following command.

gem install bundler



# Postgre initialization

 First, the initialization command.

postgresql-setup initdb


 Then edit /var/lib/pgsql/data/pg_hba.conf.
 Add the following under ``` configuration parameter, or via the -i or -h command line switches.``` in the conf file.

host redmine redmine 127.0.0.1/32 md5 host redmine redmine ::1/128 md5


 Set to start up automatically when Postgre starts and restarts.

systemctl start postgresql systemctl enable postgresql


 Create user for Redmine in Postgre.

-u postgres createuser -P redmine

 "What is the password for user name = redmine?" ], So set an arbitrary password.
 Obviously, make a note of your password. (Because I write it in the Redmine configuration file)


 Create database for Redmine in Postgre.

-u postgres createdb -E UTF-8 -O redmine -T template0 redmine



# Remine installation
 First, download the source code of Redmine.

cd /opt/ wget https://www.redmine.org/releases/redmine-4.0.6.tar.gz


 However, I get a certificate revoked error.
 It's possible to not validate the certificate with the --no-check-certificate option ...
 Just in case, I downloaded the compressed file by another method and put it in / opt /.

 Defrost. And move.

tar zxvf redmine-4.0.6.tar.gz mv /opt/redmine-4.0.6 /var/lib/redmine

 Note that if the / var / lib / redmine folder exists, it will be moved to /var/lib/redmine/redmine-4.0.6! The deployment described below will fail.
 (There are times when Redmine Insco fails and starts over)


 Create a new /var/lib/redmine/config/database.yml.
 The contents are as follows.

production: adapter: postgresql database: redmine host: localhost username: redmine password: "Postgre username=redmine password" encode: utf8


 Deploy with the following command.

cd /var/lib/redmine bundle install --without development test rmagick --path vendor/bundle bundle exec rake generate_secret_token RAILS_ENV=production bundle exec rake db:migrate RAILS_ENV=production REDMINE_LANG=ja bundle exec rake redmine:load_default_data gem install passenger -v 5.1.12 --no-doc passenger-install-apache2-module --auto --languages ruby


# httpd settings
 Changed DocumentRoot in /etc/httpd/conf/httpd.conf.

DocumentRoot "/var/lib/redmine/public"

 To be ...

 And the following command.

passenger-install-apache2-module --snippet


 Then, create a new /etc/httpd/conf.d/redmine.conf.
 The contents are as follows.

<Directory "/var/lib/redmine/public"> Require all granted

LoadModule passenger_module /usr/local/rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/passenger-5.1.12/buildout/apache2/mod_passenger.so PassengerRoot /usr/local/rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/passenger-5.1.12 PassengerDefaultRuby /usr/local/rbenv/versions/2.6.5/bin/ruby

 However, LoadModule passenger_module… The following is the return value when `` `passenger-install-apache2-module --snippet``` is executed.


 Restart Apache. And set Apache to start automatically when the OS is restarted.

systemctl restart httpd systemctl enable httpd


 Hit the IP of CentOS with a browser, and if the figure below is displayed, it's OK.
 ![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/706116/52f89593-0188-90d8-d961-2ac378c2811f.png)
 For the time being, I was able to ** display the home screen **, so thank you for your hard work.
 Since the article has become long, I will leave the initial settings in Redmine such as "Create account" as a separate article.



# If http communication is not possible ... Part 1
 It may be blocked by a firewall.
 So, I will leave the permission setting method of the firewall.

 Enable with the following command.

firewall-cmd --zone=public --add-service=http --permanent


```success```Don't worry with the response!
 It is set until the firewall is reloaded and reflected. The following command.

firewall-cmd --reload


```success```If is returned, the setting is ok.

 Is that true? Is that really the case?
 That's why the confirmation command.

firewall-cmd --zone=public --list-services


 OK if the response contains `` `http```.


# If http communication is not possible ... Part 2
 May be blocked by SELinux.
 So, I will leave the SELinux invalidation method.


 I think it's better to enable SELinux, but this article aims to ** make it usable anyway **, so disable it.

 So, first of all, is SELinux ** enabled now? ** ** Is it disabled? ** You have to know.
 Type the following command.

getenforce


```disabled```If so, it has been invalidated, so this process is through.

 If it is enabled, it will be disabled. Edit the following SELinux configuration file with an editor.

/etc/sysconfig/selinux

 Save as ``` SELinux = disabled``` as shown below. Then restart CentOS to reflect the settings!
 ![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/706116/f7803484-f1ef-4b74-346b-a86c93630fc5.png)


# Serpentine
 I think Postgre is better than MySQL for Redmine database.
 Reading the official documentation gives the impression that Postgre is Redmine's de facto standard.
 The de facto standard means ... With Postgre, there is a high possibility that "it is optimized and works smoothly" and "there is a lot of know-how for troubleshooting"!

 Since I repeated trials and errors, various files were messed up ... (´ ・ ω ・ `)
 I want to be able to handle Docker.


 The remaining challenges.

 * Let's write an article about the minimum usage of vi.
 * I have a good understanding of what SELinux does. (Difference between enabling or disabling)
 * Let's enable Redmine after enabling SELinux.
 * Don't just copy and paste commands, just understand what they are for.


# Next article
 [Let's make a minimum initial setting and test project in Redmine immediately after installation Jamaica](https://qiita.com/waokitsune/items/f214ad783c7dd073aaaf)


Recommended Posts

Install the project management tool "Redmine" on CentOS8 (database is Postgre)
Install Redmine 4.1.1 on CentOS 7
Install the webmail client Rainloop on CentOS 8
Install Golang on CentOS 8
Install Vertica 10.0 on CentOS 6.10
Install the latest hardware drivers from ELRepo on CentOS
Install PostgreSQL 12 on Centos8
Install nginx on centOS7
Install Python 3 on CentOS 7
Install kuromoji on CentOS7
Install Mattermost on CentOS 7
Install PostGIS 2.5.5 on CentOS7
Install jpndistrict on CentOS 7
Install MySQL 5.6 on CentOS6 [How to specify the version]
Install ag (the silver searcher) [on CentOS / Ubuntu / Mac]
Smokeping Install on CentOS7
Install PostgreSQL 13 on CentOS 7.5
Install OpenFOAM v2006 on CentOS
Install Jenkins on Docker's CentOS
Install Apache on CentOS on VirtualBox
Install Ruby 2.7 on CentOS 7 (SCL)
How to install and configure the monitoring tool "Graphite" on Ubuntu
Install Java Open JDK 8 on CentOS 7
How to install MariaDB 10.4 on CentOS 8
Check H2 database on the web
Install apache 2.4.46 from source on CentOS7
Steps to install MySQL 8 on CentOS 8
Use the iostat command on CentOS 8
Steps to install devtoolset-6 on CentOS 7
Install Java 9 on windows 10 and CentOS 7