Install Redmine on Ubuntu 22.04

|
Last Updated:
|
|

In this guide, you will learn how to install Redmine on Ubuntu 22.04. Redmine is cross-platform and cross-database, flexible project management tool written on Ruby on Rails Framework.

Install Redmine on Ubuntu 22.04

Redmine Features

Some of the main features of Redmine are:

  • Multiple projects support
  • Flexible role based access control
  • Flexible issue tracking system
  • Gantt chart and calendar
  • News, documents & files management
  • Feeds & email notifications
  • Per project wiki
  • Per project forums
  • Time tracking
  • Custom fields for issues, time-entries, projects and users
  • SCM integration (SVN, CVS, Git, Mercurial and Bazaar)
  • Issue creation via email
  • Multiple LDAP authentication support
  • User self-registration support
  • Multilanguage support
  • Multiple databases support

Read more about Redmine features on the features page.

Run system update

To begin with, ensure that your system packages are up-to-date.

apt update

Redmine is not available on the default Ubuntu 22.04.

Therefore, to install Redmine, you need to build and install it from the source.

Install Required Build Tools and Dependencies

To install Redmine from the source code, you need install the required build tools and dependencies.

apt install build-essential \
	ruby-dev \
	libxslt1-dev \
	libmysql++-dev \
	libxml2-dev \
	zlib1g-dev \
	imagemagick \
	libmagickwand-dev \
	curl \
	gnupg2 \
	bison \
	libbison-dev \
	libgdbm-dev \
	libncurses-dev \
	libncurses5-dev \
	libreadline-dev \
	libssl-dev \
	libyaml-dev \
	libsqlite3-dev \
	sqlite3 -y

Install Apache HTTP Server on Ubuntu 22.04

Install Apache web server and Apache modules for the Passenger, lightweight web server for Ruby.

apt install apache2 libapache2-mod-passenger

Start and enable Apache to run on system boot.

systemctl enable --now apache2

Install Ruby interpreter

Redmine version 5.1 supports upto Ruby 3.2 as of this post update!

Ruby is installed as part of the above package dependencies. To check the current version of installed Ruby;

ruby -v
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux-gnu]

This falls within the supported versions.

Create Redmine System User

Create a Redmine system user that can be used to install Redmine Ruby dependencies via bundler command. Set its home directory to /opt/redmine as this is where we will install Redmine app.

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

Add Apache web server user to Redmine group.

usermod -aG redmine www-data

Install MySQL Database on Ubuntu 22.04

Run the command below to install MySQL 8 database server on Ubuntu 22.04

apt install mysql-server

MySQL is started and enabled to run on boot upon installation.

systemctl status  mysql
● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2024-03-03 11:47:41 UTC; 1min 41s ago
    Process: 12582 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
   Main PID: 12590 (mysqld)
     Status: "Server is operational"
      Tasks: 37 (limit: 2241)
     Memory: 364.0M
        CPU: 1.598s
     CGroup: /system.slice/mysql.service
             └─12590 /usr/sbin/mysqld

Mar 03 11:47:40 osboxes systemd[1]: Starting MySQL Community Server...
Mar 03 11:47:40 osboxes mysqld[12590]: 2024-03-03T11:47:40.726951Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.36-0ubuntu0.22.04.1) starting as process 125>
Mar 03 11:47:40 osboxes mysqld[12590]: 2024-03-03T11:47:40.732580Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
Mar 03 11:47:40 osboxes mysqld[12590]: 2024-03-03T11:47:40.926104Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
Mar 03 11:47:41 osboxes mysqld[12590]: 2024-03-03T11:47:41.084287Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
Mar 03 11:47:41 osboxes mysqld[12590]: 2024-03-03T11:47:41.084318Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are n>
Mar 03 11:47:41 osboxes mysqld[12590]: 2024-03-03T11:47:41.105453Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: />
Mar 03 11:47:41 osboxes mysqld[12590]: 2024-03-03T11:47:41.105476Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.36-0ubuntu0.22.04.>
Mar 03 11:47:41 osboxes systemd[1]: Started MySQL Community Server.

If not already started, run the command below to start it;

systemctl enable --now mysql

Run initial MySQL database secure script to remove default databases, test tables, disable remote root login,

mysql_secure_installation

Create Redmine Database and Database User

Once MySQL is installed, login as root user and create Redmine database and database user.

Replace the names of the database and the database user accordingly.

mysql -u root -p
create database redminedb;
create user redmineuser@localhost identified by 'P@ssW0rD';
grant all on redminedb.* to redmineuser@localhost;

Reload privilege tables and exit the database.

flush privileges;
quit

Download and Install Redmine

Navigate Redmine releases page and grab Redmine tarball for the current stable release version.

You can simply download and extract the Redmine tarball to the Redmine install directory, /opt/redmine.

VER=5.1.1
curl -s https://www.redmine.org/releases/redmine-$VER.tar.gz | \
sudo -u redmine tar xz -C /opt/redmine/ --strip-components=1

Configuring Redmine on Ubuntu 22.04

Once you have installed Redmine under the /opt/redmine directory, you can now proceed to configure it.

Create Redmin Configuration Files

Create Redmine configuration file by renaming the sample configuration files as shown below;

su - redmine
cp /opt/redmine/config/configuration.yml{.example,}
cp /opt/redmine/public/dispatch.fcgi{.example,}
cp /opt/redmine/config/database.yml{.example,}

Configure Redmine Database Settings

Open the created Redmine database configuration setting and set the Redmine database connection details for MySQL.

vim /opt/redmine/config/database.yml
...
production:
  adapter: mysql2
  database: redminedb
  host: localhost
  username: redmineuser
  password: "P@ssW0rD"
  # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7
  encoding: utf8mb4
...

Save and exit the file.

Install Redmine Ruby Dependencies

Logout as redmine user by running the exit.

exit

 As privileged user, navigate to Redmine install directory and install the Ruby dependencies.

cd /opt/redmine

Install Bundler for managing gem dependencies.

sudo gem install bundler

Install the Base64 module.

sudo gem install base64

Next, install the required gems dependencies as redmine user.

su - redmine
bundle config set --local path 'vendor/bundle'
bundle install

Also update the gems;

bundle update

Install updated io-wait and strscan gems;

gem install io-wait strscan webrick --user-install

Generate Secret Session Token

To prevent tempering of the cookies that stores session data, you need to generate a random secret key that Rails uses to encode them.

bundle exec rake generate_secret_token

Create Database Schema Objects

Create Rails database structure by running the command below;

Ensure you set the correct database credentials above,

RAILS_ENV=production bundle exec rake db:migrate

Once the database migration is done, insert default configuration data into the database by executing;

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

You can safely ignore the Ruby warnings.

Configure FileSystem Permissions

Ensure that the following directories are available on Redmine directory, /opt/redmine.

  • tmp and tmp/pdf
  • public and public/plugin_assets
  • log
  • files

If they do not exist, simply create them and ensure that they are owned by the user used to run Redmine.

for i in tmp tmp/pdf public/plugin_assets; do [ -d $i ] || mkdir -p $i; done
chown -R redmine:redmine files log tmp public/plugin_assets
chmod -R 755 /opt/redmine

Testing Redmine Installation

The setup of Redmine on Ubuntu 22.04 is now done.

Redmine listens on TCP port 3000 by default. Hence, before running the tests, open port 3000/tcp on firewall if it is running.

redmine@ubuntu22:~$ exit
sudo ufw allow 3000/tcp

You can now test Redmine using WEBrick by executing the command below;

su - redmine

Add webrick to Gemfile;

echo 'gem "webrick"' >> Gemfile

Install webrick gem and test the installation;

bundle install
bundle exec rails server -u webrick -e production

Sample output;

=> Booting WEBrick
=> Rails 6.1.7.6 application starting in production http://0.0.0.0:3000
=> Run `bin/rails server --help` for more startup options
[2024-03-03 11:59:32] INFO  WEBrick 1.8.1
[2024-03-03 11:59:32] INFO  ruby 3.0.2 (2021-07-07) [x86_64-linux-gnu]
[2024-03-03 11:59:32] INFO  WEBrick::HTTPServer#start: pid=14164 port=3000

Navigate to the browser and enter the address, http://server-IP-or-Hostname:3000. Replace the server-IP-or-Hostname accordingly.

If all is well, you should land on Redmine web user interface.

Install Redmine on Ubuntu 22.04

Configure Apache for Redmine on Ubuntu 22.04

Now that you have confirmed that Redmine is working as expected, proceed to configure Apache to server Redmine.

Press CTRL+C to stop Redmine in foreground and exit redmine user account.

exit

next, create Redmine Apache VirtualHost configuration file.


cat > /etc/apache2/sites-available/redmine.conf << 'EOL'
Listen 3000
<VirtualHost *:3000>
	ServerName redmine.kifarunix-demo.com
	RailsEnv production
	DocumentRoot /opt/redmine/public

	<Directory "/opt/redmine/public">
	        Allow from all
	        Require all granted
	</Directory>

	ErrorLog ${APACHE_LOG_DIR}/redmine_error.log
        CustomLog ${APACHE_LOG_DIR}/redmine_access.log combined
</VirtualHost>
EOL

Ensure the value of the ServerName, the domain, is resolvable! You can use hosts file to define the IP address if you dont have a DNS server.

Disable the default site configuration.

a2dissite 000-default.conf

Check Apache configuration for errors.

apachectl configtest
Syntax OK

Ensure that Passenger module is loaded;

apache2ctl -M | grep -i passenger
passenger_module (shared)

If not enabled, run the command below to enable it.

a2enmod passenger

Enable Redmine site.

sudo a2ensite redmine

Reload Apache

sudo systemctl restart apache2

Check to ensure that Redmine is now listening on port 3000.

sudo lsof -i :3000
COMMAND  PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
apache2 7630     root    6u  IPv6  48985      0t0  TCP *:3000 (LISTEN)
apache2 7645 www-data    6u  IPv6  48985      0t0  TCP *:3000 (LISTEN)
apache2 7646 www-data    6u  IPv6  48985      0t0  TCP *:3000 (LISTEN)

Access Redmine on Browser

Next, you can now access and sign in to Redmine on browser using the address http://server-IP-or-domain-address:3000.

Click Sign in at the top right corner.

Default credentials: admin:admin.

Install Redmine on Ubuntu 22.04

When prompted, reset your admin password.

Setup your Redmine profile;

install Redmine on Ubuntu

Create Projects

install Redmine on Ubuntu

That concludes our guide on how to install Redmine on Ubuntu. You can now explore this awesome tool.

Read more on how to use Redmine User Guide.

Reference

Redmine Install

Other Tutorials

Install Vtiger CRM on Rocky Linux 8

Install Redmine on Rocky Linux 8

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
koromicha
I am the Co-founder of Kifarunix.com, Linux and the whole FOSS enthusiast, Linux System Admin and a Blue Teamer who loves to share technological tips and hacks with others as a way of sharing knowledge as: "In vain have you acquired knowledge if you have not imparted it to others".

12 thoughts on “Install Redmine on Ubuntu 22.04”

  1. Hello:
    I am so lucky to see your post.
    You are posting in 2022.
    Today, I installed according to your article.
    It is impossible to succeed.
    I guess it should be caused by dependent components.
    I wonder if you have time to try again and correct this post?
    Thank you very much!

    Reply
  2. I really like your instructions for installing Redmine. This instruction worked great until I had to install Ubuntu 22.04 and Redmine from scratch. I assume that in the new installation Bundler uses updated gems, which leads to the inability to display the Redmine page. Moreover, Wibrik and PUMA successfully display the site. Most likely the problem is with mod_passenger (((I would be very grateful if you corrected the algorithm so that it would work again.

    Reply
    • Thank you for catching that, Evgen. We just changed the database from MariaDB to MySQL 8.x. All good now.

      Reply

Leave a Comment