Learn how to Install and Configure Redmine on Centos 7 step by step. Redmine is a great web-based project management tool written with the Ruby on Rails framework. Redmine is open source and licensed under the GPL and is designed as a cross-platform and cross-database. In this article, we are going to discuss how to install and configure this powerful project manager in CentOS 7. You can visit the packages available in Eldernode to purchase a CentOS VPS server.
Table of Contents
Tutorial Install and Configure Redmine on Centos 7
Prerequisites for Installing Redmine
Before you start installing Redmine on Centos 7, you need to make sure of the following prerequisites:
1) The domain name that points to the public IP of your server. In this tutorial, we have considered the domain name eldernode.com. So you have to enter the domain name you want.
2) The next prerequisite you need to install Redmine on Centos 7 is a Ruby application server for which we will use Passenger with Nginx.
3) Finally you need to have a database. In this tutorial, we have used the MariaDB database. You can have your own database depending on your needs.
Install and Configure Redmine on Centos 7
The first step in getting ready to install Redmine is to install the necessary ruby and Redmine packages. To install these packages, you must type and execute the following commands:
$ 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
In the next step, you must install the desired database. In this tutorial we will install MariaDB on CentOS 7:
$ sudo yum install mariadb-server
Now you need to type and execute the following commands to activate the database (MariaDB):
$ sudo systemctl start mariadb
$ sudo systemctl enable mariadb
After you have installed the database, you can check its installation status using the following command:
$ sudo systemctl status mariadb
Now you have to type and execute the following command to install security scripts as well. After executing the following command, you will be asked a few questions. Enter “Y” in response to them:
$ sudo mysql_secure_installation
Tutorial Create a MySQL Database
To create a MySQL database, you first need to log in to your MySQL shell using the following command:
$ sudo mysql
Now you need to type and run the following command to create a new database in the MySQL shell:
mysql> CREATE DATABASE redmine CHARACTER SET utf8;
After you have successfully created a new database within the MySQL shell, you must now create an account in MySQL using the following command. You also need to provide this user with access to the database. In the following command, you need to type your desired password instead of EnterPasswordHere.
mysql> GRANT ALL ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'EnterPasswordHere';
Learn how to install Passenger and Nginx
In the rest of this article, we will try to teach you how to install the Passenger module for Nginx. Passenger is an open-source web and application server that greatly simplifies the deployment of Ruby applications, Python, and Node.js. Passenger is a convenient way to deploy and host Ruby on Rails applications on all DreamHost servers. It should be noted that Passenger is free in every DreamHost hosting plan.
In the first step you must use the following commands to install the EPEL repository:
$ sudo yum install epel-release yum-utils pygpgme
$ sudo yum-config-manager --enable epel
After installing the required packages, you should now activate the Phusionpassenger repository.
$ sudo yum-config-manager --add-repo https://oss-binaries.phusionpassenger.com/yum/definitions/el-passenger.repo
Now it’s time to type and run the following command to install Passenger and Nginx:
$ sudo yum install nginx passenger passenger-devel
In the continuation of this article, before we teach you how to install Redmine on CentOS 7, we will teach you how to create a new system user as well as how to install Ruby. Please join us.
How to Create a New System User
The purpose of creating a new system user is to be able to run Redmine. So you have to type and execute the following command:
$ sudo useradd -m -U -r -d /opt/redmine redmine
In the next step, you need to add the Nginx user to the new user group. Therefore, you must type and execute the following command:
$ sudo usermod -a -G redmine nginx
To access Nginx, enter the following command:
$ sudo chmod 750 /opt/redmine
Tutorial install Ruby
The last thing you need to do to get ready to install Redmine on a CentOS 7 distribution is to install Ruby. In the first step, you must go to the Redmine user by typing the following command:
$ sudo su - redmine
In the second step, you must enter the GPG key by typing and executing the following command:
$ gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
Now you need to install RVM:
$ curl -sSL https://get.rvm.io | bash -s stable
After you can install the RVM, in the next step, you must source the RVM file to use it. To do this, type and run the following command:
$ source /opt/redmine/.rvm/scripts/rvm
Now type the following command line to install Ruby. It should be noted that in the following commands, 2.7.2 indicates the latest version of Ruby, which you can change if there is a new version.
$ rvm install 2.7.2
$ rvm --default use 2.7.2
How to install Redmine on CentOS 7
First log in as a Redmine user. Then you need to download the Redmine archive using the Curl command below:
$ curl -L http://www.redmine.org/releases/redmine-4.1.1.tar.gz -o redmine.tar.gz
Now you need to unzip the downloaded file:
$ tar -xvf redmine.tar.gz
The next step is to configure the Redmine database, which you can do using the following example:
$ cp /opt/redmine/redmine-4.1.1/config/database.yml.example /opt/redmine/redmine-4.1.1/config/database.yml
Then open the file using a text editor:
nano /opt/redmine/redmine-4.1.1/config/database.yml
Enter the created database information by searching in the production section. Note that you must enter the password you want instead of EnterPasswordHere. Then save it.
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: “EnterPasswordHere”
encoding: utf8
Next, you will need to install all the ruby dependencies and bundler. To do this, head on over to the redmine-4.1.1 directory, open the terminal, and enter the following commands:
$ cd ~/redmine-4.1.1
$ gem install bundler --no-rdoc --no-ri
$ bundle install --without development test postgresql sqlite
In the next step, by typing the following commands, you must generate the keys and move the database:
$ bundle exec rake generate_secret_token
$ RAILS_ENV=production bundle exec rake db:migrate
Another step you must do before running Redmine is to configure Nginx. Just switch to your sudo user:
$ exit
Create a Nginx server block by reopening your favorite text editor:
$ sudo nano /etc/nginx/conf.d/example.com.conf
After replacing the Redmine domain you want with www.example.com in the text below, copy it and paste it into the file you opened:
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.1.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; }
If you have successfully completed all the tasks and steps, you should see the following output:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Finally restart the Nginx server:
sudo systemctl restart nginx
The last step to fully install Redmine is to encrypt Nginx with SSL. To do this, you must first open the Nginx configuration file using the command line below:
$ sudo nano /etc/nginx/conf.d/example.com.conf
Then you need to edit your Redmine domain instead of example.com in the following commands. Doing so completes the Redmine installation and you can access it:
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.1.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; }
Conclusion
In this article, we first introduce the free and open-source Redmine program as a project control program. Then, after explaining the necessary prerequisites for installing this software, we taught you how to Install and Configure Redmine on Centos 7.
Dear Michael,
As I am following your blog for Redmine installation but I’m facing some issues can you please help me to install the Redmine via screen-sharing.
Thanks&Regards,
Imran Shaikh
Please state your problem clearly.