Redmine is a powerful project management software and issue tracking tool that is free and open-source. It is built using the Ruby on Rails framework and can be integrated with various version control systems. With features such as project management, wikis, forums, time tracking, and role-based access control, Redmine is a versatile tool for managing projects efficiently. In this tutorial, we will guide you through the process of installing Redmine on a Rocky Linux 8 based server, ensuring you have all the necessary prerequisites and step-by-step instructions to get started.
Prerequisites
Before installing Redmine on your Rocky Linux 8 server, there are a few prerequisites that need to be met:
- A server running Rocky Linux.
- A non-sudo user with root privileges.
- SELinux disabled.
- Ensure all packages are up to date by running the following command:
$ sudo dnf update
Now that we have the prerequisites in place, let’s move on to the installation process.
Step 1 – Configure Firewall
The first step in setting up Redmine is configuring the firewall on your Rocky Linux server. Rocky Linux uses Firewalld Firewall to manage network traffic. To check the status of the firewall, run the following command:
$ sudo firewall-cmd --state
If the firewall is not running, start it using the following command:
$ sudo systemctl start firewalld
To open port 3000, which is used to access Redmine, run the following command:
$ sudo firewall-cmd --permanent --add-port=3000/tcp
Next, allow HTTP and HTTPS ports:
$ sudo firewall-cmd --permanent --add-service=http $ sudo firewall-cmd --permanent --add-service=https
To apply the changes, reload the firewall:
$ sudo firewall-cmd --reload
With the firewall properly configured, we can now move on to installing and setting up the necessary components for Redmine.
Step 2 – Install Apache Server
Redmine requires a web server to run, and in this tutorial, we will be using Apache as our server of choice. To install Apache, run the following command:
$ sudo dnf install httpd
Once the installation is complete, enable and start the Apache service:
$ sudo systemctl enable --now httpd.service
Now, we need to grant your current user the necessary access to the /var/www/redmine
directory. This can be done by adding your user to the apache
group:
$ sudo usermod -aG apache $USER
With Apache installed and configured, we can move on to the next step, which is installing and configuring the MySQL database server.
Step 3 – Install and Configure MySQL Server
Redmine requires a database to store its data, and we will be using MySQL as our database server. Rocky Linux’s Appstream repository ships with the latest version of MySQL, so we can install it using the following command:
$ sudo dnf install mysql-server
Once the installation is complete, enable and start the MySQL service:
$ sudo systemctl enable --now mysqld
After starting the MySQL service, it is recommended to secure the installation by running the mysql_secure_installation
command:
$ sudo mysql_secure_installation
This command will guide you through the process of securing your MySQL installation by setting a root password, removing anonymous users, disabling remote root login, and removing the test database. Follow the prompts and choose the options that best suit your requirements.
Once the MySQL server is secured, we can proceed to create a new user and database specifically for Redmine. Start by logging into the MySQL shell:
$ mysql -u root -p
Enter your root password when prompted. Once logged in, create a new user and database for Redmine:
mysql> CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'Your_password2'; mysql> CREATE DATABASE redmine CHARACTER SET utf8mb4; mysql> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost'; mysql> FLUSH PRIVILEGES; mysql> EXIT;
Make sure to replace 'Your_password2'
with a strong password of your choice. These commands create a new MySQL user, a database named “redmine,” and grant the necessary privileges to the user on the database.
With the database server set up, we can proceed to the next step, which is installing the necessary repositories and packages.
Step 4 – Install EPEL Repository
Some of the packages required by Redmine are available in the EPEL (Extra Packages for Enterprise Linux) repository. To install the EPEL repository, run the following command:
$ sudo dnf install epel-release
Next, enable the PowerTools repository:
$ sudo dnf config-manager --set-enabled powertools
With the necessary repositories enabled, we can now proceed to install Ruby and other required packages.
Step 5 – Install Ruby and other requisites
Ruby is the programming language on which Redmine is built, so we need to install it along with other dependencies. Rocky Linux 8 ships with multiple versions of Ruby, but for this tutorial, we will be installing Ruby 2.7. To install Ruby and other required packages, run the following command:
$ sudo dnf install ruby ruby-devel rpm-build wget libxml2-devel make automake libtool ImageMagick ImageMagick-devel mariadb-devel httpd-devel openssl-devel libcurl-devel gcc gcc-c++
Once the installation is complete, verify the Ruby installation by running the following command:
$ ruby -v
You should see the Ruby version installed on your system.
With Ruby and the necessary packages installed, we can proceed to the next step, which is installing Redmine itself.
Step 6 – Install Redmine
To install Redmine, you first need to download the latest stable version from the Redmine website. Visit the Redmine downloads page and check for the latest stable version. At the time of writing this tutorial, the latest version is 4.2.3. To download Redmine, run the following command:
$ wget https://redmine.org/releases/redmine-4.2.3.tar.gz
Once the download is complete, extract the files and move them to the /var/www/redmine
directory:
$ tar xfz redmine-4.2.3.tar.gz $ sudo mv redmine-4.2.3 /var/www/redmine
Next, navigate to the Redmine directory:
$ cd /var/www/redmine
We now need to create the Redmine configuration files using the provided examples. Run the following commands to copy the example files:
$ cp config/configuration.yml.example config/configuration.yml $ cp config/database.yml.example config/database.yml $ cp public/dispatch.fcgi.example public/dispatch.fcgi
Open the config/database.yml
file for editing:
$ nano config/database.yml
In the database.yml
file, find the section that starts with production:
and configure your database settings. Replace the username
and password
fields with the username and password you created earlier for the Redmine user in MySQL. Save the file and exit the editor.
Next, we need to install the necessary gems (Ruby libraries) required by Redmine. Run the following commands to install Bundler and the dependencies:
$ gem install bundler $ bundle config set --local without 'development test' $ bundle install
If you encounter any issues with gem versions, you can use the following command to restore them:
$ sudo gem pristine --all
To generate a random secret key for Redmine, run the following command:
$ bundle exec rake generate_secret_token
Next, we need to create the necessary database structure. Run the following command to migrate the database:
$RAILS_ENV=production bundle exec rake db:migrate
Once the database migration is complete, insert the initial data into the database:
$RAILS_ENV=productionREDMINE_LANG=en bundle exec rake redmine:load_default_data
With the database structure and initial data in place, we need to create the necessary directories and set the correct file permissions. Run the following commands:
$ mkdir -p tmp/pdf $ mkdir -ppublic/plugin_assets $ chown -R $USER:$USER files log tmp public/plugin_assets $ chmod -R 755 /var/www/redmine/
Now, we can start the Redmine server by running the following command:
$ bundle exec rails server webrick -e production
You should see output indicating that the server is running. Open a web browser and navigate to http://<your-server-IP>:3000/login
to access the Redmine login screen. The default credentials are admin/admin
, and you will be prompted to change the password upon logging in for the first time.
Congratulations! You have successfully installed Redmine on your Rocky Linux 8 server. However, we still have some additional steps to perform to serve Redmine securely using HTTPS. Let’s move on to the next steps.
Step 7 – Install Phusion Passenger
Phusion Passenger is a Ruby application server that allows us to serve Redmine via a 3rd party server. In this tutorial, we will be using Apache as our web server with Phusion Passenger. To install Passenger, run the following command:
$ gem install passenger
Next, install the Passenger module for Apache:
$ passenger-install-apache2-module
Follow the on-screen instructions to complete the installation. Once the installation is complete, you will receive a message with instructions on how to configure Apache. We will come back to this later.
Configure Apache Server
Now, we need to configure Apache to work with Passenger and serve Redmine. Let’s create a module configuration file for Passenger:
$ sudo nano /etc/httpd/conf.modules.d/00-passenger.conf
Paste the following code into the file:
LoadModule passenger_module /home/shapehost/.gem/ruby/gems/passenger-6.0.12/buildout/apache2/mod_passenger.so <IfModule mod_passenger.c> PassengerRoot /home/shapehost/.gem/ruby/gems/passenger-6.0.12 PassengerDefaultRuby /usr/bin/ruby </IfModule>
Save the file and exit the editor.
Next, create another Apache configuration file specifically for the Redmine site:
$ sudo nano /etc/httpd/conf.d/redmine.conf
Paste the following code into the file:
Listen 3000 <IfModule mod_passenger.c> PassengerRoot /home/shapehost/.gem/ruby/gems/passenger-6.0.12 PassengerDefaultRuby /usr/bin/ruby </IfModule> <VirtualHost *:3000> ServerName redmine.example.com DocumentRoot "/var/www/redmine/public" CustomLog logs/redmine_access.log combined ErrorLog logs/redmine_error_log LogLevel warn <Directory "/var/www/redmine/public"> Options Indexes ExecCGI FollowSymLinks Require all granted AllowOverride all </Directory> </VirtualHost>
Make sure to replace redmine.example.com
with your actual domain name or IP address. Save the file and exit the editor.
Now, open the main Apache configuration file for editing:
$ sudo nano /etc/httpd/conf/httpd.conf
Find the line that starts with ServerName
and uncomment it by removing the #
symbol. Set the value as follows:
ServerName redmine.example.com
Make sure to replace redmine.example.com
with your actual domain name or IP address. Save the file and exit the editor.
To verify the Apache configuration syntax, run the following command:
$ sudo httpd -t
If the syntax is correct, you should see Syntax OK
as the output. If there are any errors, review the configuration files and correct them.
Now, restart the Apache service to apply the configuration changes:
$ sudo systemctl restart httpd
At this point, Redmine should be accessible through Apache at http://redmine.example.com:3000
. However, this is not an ideal setup as it uses the insecure HTTP protocol and a non-standard port. To improve security and usability, we will install Nginx as a reverse proxy and serve Redmine over HTTPS.
Step 8 – Install SSL
To secure our Redmine installation, we will use Let’s Encrypt to generate an SSL certificate. To install Certbot, the Let’s Encrypt client, run the following command:
$ sudo dnf install certbot
Once Certbot is installed, stop the Apache server:
$ sudo systemctl stop httpd
Next, generate the SSL certificate using Certbot. Replace redmine.example.com
with your actual domain name or IP address:
$ sudo certbot certonly --standalone --agree-tos --no-eff-email --staple-ocsp --preferred-challenges http -m admin@shapehost.com -d redmine.example.com
Follow the prompts and provide the necessary information. Certbot will automatically generate and install the SSL certificate for your domain.
After the SSL certificate is installed, start the Apache server again:
$ sudo systemctl start httpd
To enhance the security of the SSL connection, we will generate a Diffie-Hellman group certificate. Run the following command:
$ sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
Now, let’s create a challenge webroot directory for Let’s Encrypt auto-renewal:
$ sudo mkdir -p /var/lib/letsencrypt
To automate the SSL certificate renewal process, we can create a cron job. Open the cron job file for editing:
$ sudo nano /etc/cron.daily/certbot-renew
Paste the following code into the file:
#!/bin/sh certbot renew --cert-name redmine.example.com --webroot -w /var/lib/letsencrypt/ --post-hook "systemctl restart nginx"
Make sure to replace redmine.example.com
with your actual domain name or IP address. Save the file and exit the editor.
Change the permissions on the cron job file to make it executable:
$ sudo chmod +x /etc/cron.daily/certbot-renew
With SSL set up, let’s move on to installing and configuring Nginx as a reverse proxy.
Step 9 – Install and Configure Nginx as Reverse-proxy
Nginx will act as a reverse proxy for Apache, enabling us to serve Redmine securely over HTTPS. To install Nginx, run the following command:
$ sudo dnf install nginx
Once the installation is complete, verify the Nginx version:
$ nginx -v
Next, let’s install and enable the 1.20 version of Nginx:
$ sudo dnf module reset nginx $ sudo dnf module enable nginx:1.20
With Nginx installed, we need to configure it to work as a reverse proxy for Redmine. Open the Nginx configuration file for Redmine:
$ sudo nano /etc/nginx/conf.d/redmine.conf
Paste the following code into the file:
server { listen 80; server_name redmine.example.com; return 301 https://$host$request_uri; } server { listen 443 ssl http2; server_name redmine.example.com; ssl_certificate /etc/letsencrypt/live/redmine.example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/redmine.example.com/privkey.pem; ssl_trusted_certificate /etc/letsencrypt/live/redmine.example.com/chain.pem; ssl_session_timeout 5m; ssl_session_cache shared:MozSSL:10m; ssl_session_tickets off; ssl_protocols TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers on; ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; ssl_ecdh_curve X25519:prime256v1:secp384r1:secp521r1; ssl_stapling on; ssl_stapling_verify on; ssl_dhparam /etc/ssl/certs/dhparam.pem; resolver 8.8.8.8; access_log /var/log/nginx/redmine.example.com.access.log main; error_log /var/log/nginx/redmine.example.com.error.log; location / { proxy_pass http://localhost:3000; proxy_redirect off; proxy_buffering off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }
Make sure to replace redmine.example.com
with your actual domain name or IP address. Save the file and exit the editor.
Open the main Nginx configuration file for editing:
$ sudo nano /etc/nginx/nginx.conf
Add the following line before the line include /etc/nginx/conf.d/*.conf;
:
server_names_hash_bucket_size 64;
Save the file and exit the editor.
To verify the syntax of the Nginx configuration file, run the following command:
$ sudo nginx -t
If the syntax is correct, you should see Syntax OK
as the output. If there are any errors, review the configuration files and correct them.
Now, start the Nginx service to apply the configuration changes:
$ sudo systemctl start nginx
Congratulations! You have successfully installed and configured Redmine on your Rocky Linux 8 server, serving it securely over HTTPS using Nginx as a reverse proxy. You can now access your Redmine installation at https://redmine.example.com
.
Conclusion
In this tutorial, we have covered the step-by-step process of installing Redmine on a Rocky Linux 8 server. We started by configuring the firewall, then proceeded to install Apache, MySQL, and other required packages. We then installed Redmine, configured Apache with Phusion Passenger, and secured the installation with SSL using Let’s Encrypt. Finally, we installed and configured Nginx as a reverse proxy to serve Redmine securely over HTTPS.
Redmine is a powerful project management tool that can help you streamline your workflow and collaborate effectively. By following this tutorial, you have set up a solid foundation for managing your projects efficiently. If you have any questions or need further assistance, feel free to reach out to our support team at Shape.host. We provide reliable and scalable cloud hosting solutions, including Cloud VPS, to empower businesses like yours with efficient and secure hosting services.