DEV Community

Henri Sekeladi
Henri Sekeladi

Posted on

How to Install Redmine with MySQL on Ubuntu 24.04

Redmine is a flexible and open-source project management and issue-tracking web application. It is widely used for managing projects, tracking bugs, and handling tasks and deadlines. Developed using Ruby on Rails, Redmine is highly customizable and supports a wide range of features for team collaboration and project organization.

Redmine is a popular alternative to commercial project management tools due to its flexibility, customization, and open-source nature.

In this article we will install Redmine on VPS hosted on AWS EC2 Instance with MySQL as database server.

Connect to Server

We can connect to server with SSH Client installed on my machine with Termius.

Termius Client

from CLI, we can use :

ssh ubuntu -i private_key.pem ubuntu@ip_address_server

then we can check our OS detail.

# cat /etc/os-release

before we installed any tools, we need to update our server.

# apt update

Install dependencies.

First, we need to install some libraries and tools to support our installation.

# apt install build-essential ruby-dev libxslt1-dev libmariadb-dev gnupg2 bison libbison-dev libgdbm-dev libncurses-dev libncurses5-dev libxml2-dev zlib1g-dev imagemagick libmagickwand-dev libreadline-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3

Create Redmine User

We will create a new system user in this stage named “redmine.” To manage redmine application.

# useradd -r -m -d /opt/redmine -s /bin/bash redmine

Option /opt/redmine as its home directory, the command will create the user “redmine,” who should be able to execute shell commands. Additionally, we must set user www-data, the user of our web server, in our Redmine group.

# usermod -aG redmine www-data

Install Passenger and Nginx Webserver

We will install Nginx as webserver for our redmine application.

# apt install nginx
# service nginx start
# systemctl enable nginx

after we installed nginx, we neet to install passenger as webserver for ruby application.



# apt install -y dirmngr gnupg apt-transport-https ca-certificates curl
# curl https://oss-binaries.phusionpassenger.com/auto-software-signing-gpg-key.txt | gpg --dearmor | tee /etc/apt/trusted.gpg.d/phusion.gpg >/dev/null
# sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger noble main > /etc/apt/sources.list.d/passenger.list'


Enter fullscreen mode Exit fullscreen mode

then we update our packages and install module nginx with passenger

# apt update

# apt install libnginx-mod-http-passenger -y

lastly, restart our nginx server.

# systemctl restart nginx

Create virtualhost/ nginx server block

We will create a virtual host in nginx configuration with domain name on it. In this case we use Route 53 from AWS to set our domain.

Route 53 - Hosted Zone

# nano /etc/nginx/conf.d/redmine.withenri.tech.conf

Insert this text below to our virtualhost.



server {
listen 80;
server_name redmine.withenri.tech;

root /opt/redmine/public;

access_log /var/log/nginx/your_domain.com.access.log;
error_log /var/log/nginx/your_domain.com.error.log;

passenger_enabled on;
passenger_min_instances 1;
client_max_body_size 10m;
}


Enter fullscreen mode Exit fullscreen mode

Save the file and exit from the nano editor. (ctrl + x then hit Enter)

Restart our nginx server, after virtualhost configuration.

systemctl restart nginx

Install MySQL Database

Next, we will install MySQL database server as storage data for our redmine application

sudo apt install mysql-server -y

Enable our database when server up.

systemctl enable mysql

and then start our database server.

systemctl start mysql

then login to our database with command.

sudo mysql

run command below to create database, user and add privileges.



mysql> CREATE DATABASE redminedb;
mysql> CREATE USER 'redmineuser'@'localhost' IDENTIFIED BY 'my_password';
mysql> GRANT ALL PRIVILEGES ON redminedb.* TO 'redmineuser'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> Exit

Enter fullscreen mode Exit fullscreen mode




Setup Redmine Application

It is time to setup our redmine application code on our server. First, we need to download the source code.

wget https://www.redmine.org/releases/redmine-5.1.3.tar.gz

tar -xzvf redmine-5.0.5.tar.gz -C /opt/redmine/ --strip-components=1

chown -R redmine: /opt/redmine/

Let’s now move to the user “redmine.”

# su - redmine

Next, we duplicate and rename some configuration.

$ cp -a /opt/redmine/config/configuration.yml{.example,}

$ cp -a /opt/redmine/config/database.yml{.example,}

$ cp -a /opt/redmine/public/dispatch.fcgi{.example,}

After the configuration copied, we change our database configuration.

$ nano /opt/redmine/config/database.yml

don't forget to save the new database configuration. Press ctl + x and the hit Enter.

Now we need to exit from user 'redmine'.

$ exit

We back as root user.

run this command to install bundler.

cd /opt/redmine && gem install bundler

Now we back again as user redmine

# su - redmine

Next, we proceed with installation process.

$ bundle config set --local path 'vendor/bundle'

$ bundle install

$ bundle update

then generate key and database migration

bundle exec rake generate_secret_token

RAILS_ENV=production bundle exec rake db:migrate

We can add default configuration data to the database when the database conversion is complete:

RAILS_ENV=production REDMINE_LANG=en bundle exec rake redmine:load_default_data

the we exit as user 'redmine'.

$ exit

Now, let’s update the gem.

# gem update

this update will take times.

Then we can access our redmine server with http://public_ip_address.

Default admin username and password is admin.

Redmine web

Redmine default username and password (admin)

Redmine Admin

Hope this article help you!

Top comments (0)