YouTube Icon

Code Playground.

How to Install and Configure Redmine on CentOS 7

CFG

How to Install and Configure Redmine on CentOS 7

Redmine is one of the most mainstream open-source venture the board and issue following programming devices. It is cross-stage and cross-information base and based on top of the Ruby on Rails structure. 

Redmine incorporates uphold for different undertakings, wikis, issue global positioning framework, gatherings, schedules, email notices, and significantly more. 

In this instructional exercise we will cover the means expected to introduce and design the most recent form of Redmine on a CentOS 7 worker utilizing MariaDB as an information base back-end and Passenger + Nginx as a Ruby application worker. 

Prerequisites

Ensure that you have met the accompanying essentials prior to proceeding with this instructional exercise: 

Area name highlighting your worker public IP. In this instructional exercise we will utilize example.com. 

Signed in as a client with sudo advantages . 

Introduce the bundles needed for building Redmine and Ruby from source: 

sudo yum install curl gpg gcc gcc-c++ make patch autoconf automake bison libffi-devel libtool  
sudo yum install readline-devel sqlite-devel zlib-devel openssl-develh readline  glibc-headers glibc-devel
sudo yum install mariadb-devel zlib libyaml-devel bzip2 iconv-devel ImageMagick ImageMagick-devel

Creating MySQL database

Redmine upholds MySQL/MariaDB, Microsoft SQL Server, SQLite 3 and PostgreSQL . In this instructional exercise we'll utilize MariaDB as an information base back-end. 

On the off chance that you don't have MariaDB or MySQL introduced on your CentOS worker you can introduce it by adhering to these guidelines . 

Login to the MySQL shell by composing the accompanying order: 

sudo mysql

From inside the MySQL shell, run the accompanying SQL proclamation to make another information base : 

CREATE DATABASE redmine CHARACTER SET utf8;

Next, make a MySQL client record and award admittance to the information base : 

GRANT ALL ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'change-with-strong-password';

Ensure you change-with-solid secret word with a solid secret key. 

When complete, leave the mysql shell by composing: 

EXIT;

Installing Passenger and Nginx

Traveler is a quick and lightweight web application worker for Ruby, Node.js and Python that can be coordinated with Apache and Nginx. We will introduce Passenger as a Nginx module. 

Introduce the EPEL archive and the necessary bundles: 

sudo yum install epel-release yum-utils pygpgme
sudo yum-config-manager --enable epel

Empower the Phusionpassenger store: 

sudo yum-config-manager --add-repo https://oss-binaries.phusionpassenger.com/yum/definitions/el-passenger.repo

When the store is empowered, update the bundles list and introduce both Nginx and Passenger with: 


sudo yum install nginx passenger passenger-devel

Creating New System User

Make another client and gathering, which will run the Redmine occurrence, for straightforwardness we will name the client redmine: 

sudo useradd -m -U -r -d /opt/redmine redmine

Add the nginx client to the new client gathering and change the/pick/redmine registry authorizations so the Nginx can get to it: 

sudo usermod -a -G redmine nginx
sudo chmod 750 /opt/redmine

Installing Ruby

The variant of Ruby in the CentOS vaults is pretty obsolete and not upheld by Redmine. We'll introduce Ruby utilizing RVM. 

Change to the client redmine by composing: 

sudo su - redmine

Import the GPG keys and introduce RVM: 

gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable

To begin utilizing RVM source the rvm document: 

source /opt/redmine/.rvm/scripts/rvm

Presently we can introduce Ruby by running: 

rvm install 2.5
rvm --default use 2.5

On the off chance that you need to introduce Ruby by means of Rbenv check this guide . 

Installing Redmine on CentOS

At the hour of composing this article, the most recent stable form of Redmine is adaptation 4.0.1. 

Prior to proceeding with the subsequent stages you should check the Redmine download page to check whether a more current adaptation is accessible. 

Ensure you are running the accompanying strides as redmine client. 

1. Downloading Redmine

Download the Redmine file with the accompanying twist order : 

curl -L http://www.redmine.org/releases/redmine-4.0.1.tar.gz -o redmine.tar.gz

Once the download is finished concentrate the document: 

tar -xvf redmine.tar.gz

2. Configuring Redmine Database

Duplicate the Redmine model information base design document: 

cp /opt/redmine/redmine-4.0.1/config/database.yml.example /opt/redmine/redmine-4.0.1/config/database.yml

Open the document with your content tool: 

nano /opt/redmine/redmine-4.0.1/config/database.yml

Quest for the creation area and enter the MySQL information base and client data we made beforehand: 

/opt/redmine/redmine-4.0.1/config/database.yml

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "change-with-strong-password"
  encoding: utf8

When done, spare the document and leave the supervisor. 

3. Installing Ruby dependencies

Explore to the redmine-4.0.1 registry and introduce bundler and other Ruby conditions: 

cd ~/redmine-4.0.1
gem install bundler --no-rdoc --no-ri
bundle install --without development test postgresql sqlite

4. Generate Keys and Migrate the Database

Run the accompanying order to create keys and relocate the information base: 

bundle exec rake generate_secret_token
RAILS_ENV=production bundle exec rake db:migrate

Configuring Nginx 

Switch back to your sudo client: 

exit

Open your content tool and make the accompanying Nginx worker block document: 

sudo nano /etc/nginx/conf.d/example.com.conf

/etc/nginx/conf.d/example.com.conf

passenger_root /usr/share/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /opt/redmine/.rvm/gems/default/wrappers/ruby;
passenger_instance_registry_dir /var/run/passenger-instreg;

server {
    listen 80;
    server_name example.com www.example.com;

    root /opt/redmine/redmine-4.0.1/public;

    # log files
    access_log /var/log/nginx/example.com.access.log;
    error_log /var/log/nginx/example.com.error.log;

    passenger_enabled on;
    passenger_min_instances 1;

    client_max_body_size 10m;
}

Remember to supplant example.com with your Redmine area. 

Prior to restarting the Nginx administration make a test to be certain that there are no grammar mistakes: 

sudo nginx -t

On the off chance that there are no mistakes the yield should resemble this: 

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

At long last, restart the Nginx administration by composing: 

sudo systemctl restart nginx

Configure Nginx with SSL

In the event that you don't have a believed SSL declaration for your space, you can produce a free Let's Encrypt SSL testament by adhering to these guidelines . 

When the testament is created alter the space Nginx setup as follows: 

sudo nano /etc/nginx/conf.d/example.com.conf

/etc/nginx/conf.d/example.com

passenger_root /usr/share/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /opt/redmine/.rvm/gems/default/wrappers/ruby;
passenger_instance_registry_dir /var/run/passenger-instreg;

# Redirect HTTP -> HTTPS
server {
    listen 80;
    server_name www.example.com example.com;

    include snippets/letsencrypt.conf;
    return 301 https://example.com$request_uri;
}

# Redirect WWW -> NON WWW
server {
    listen 443 ssl http2;
    server_name www.example.com;

    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
    include snippets/ssl.conf;

    return 301 https://example.com$request_uri;
}

server {
    listen 443 ssl http2;
    server_name example.com;

    root /opt/redmine/redmine-4.0.1/public;

    # SSL parameters
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
    include snippets/ssl.conf;
    include snippets/letsencrypt.conf;

    # log files
    access_log /var/log/nginx/example.com.access.log;
    error_log /var/log/nginx/example.com.error.log;

    passenger_enabled on;
    passenger_min_instances 1;
    client_max_body_size 10m;
}

Remember to supplant example.com with your Redmine area and set the right way to the SSL endorsement records. All the HTTP solicitations will be diverted to HTTPS . 

Accessing Redmine

Open your program , type your space and accepting the establishment is fruitful, a screen like the accompanying will show up: 

The default login accreditations for Redmine are: 

  • Username: administrator 
  • Secret key: administrator 

At the point when you login unexpectedly, you will be provoked to change the secret word as demonstrated as follows: 

When you change the secret phrase you will be diverted to the client account page. 

Conclusion

You have effectively introduced Redmine on your CentOS framework. You should now check the Redmine Documentation and study how to design and utilize Redmine. 

In the event that you hit an issue or have input, leave a remark underneath.




CFG