HowTo Install Redmine 5.0.x on Ubuntu 20.04/22.04 with Apache2

Based on RedmineInstall but limited to Ubuntu & MySQL, this will take on an empty Ubuntu 20.04 VM, this will install Redmine 5.0.1 with Apache2 and local MySQL database. For any questions or feedback, feel free to write to

Installing dependencies

# update & upgrade 
sudo apt-get update && sudo apt-get upgrade -y

# install required packages
sudo apt install -y apache2 ruby ruby-dev build-essential libapache2-mod-passenger libmysqlclient-dev

# if you want to install mysql server locally
sudo apt install -y mysql-server

Download & Extract Redmine

Go grab the latest version from here. For this example it will be 5.0.1

# download and extract
cd /opt
sudo tar -xvzf ~/redmine-5.0.1.tar.gz

# symlink to remove version reference
sudo ln -s redmine-5.0.1 redmine

Configure database

Create a database and create a user for redmine. Example for localhost installation below:

sudo mysql

CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'secretPassword';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';

Edit database configuration file

# copy the example file
cd /opt/redmine
cp config/database.yml.example config/database.yml

# edit config file with your editor of choice (mine is vi)
vi config/database.yml

Replace or update the production: block with your configuration. One example based on the mysql config above.

  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "secretPassword" 
  # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7
  encoding: utf8mb4

Install Ruby dependencies

in redmine path

# install bundler
sudo gem install bundler

# install redmine bundle (give sudo password when prompted)
bundle install # installation of 22.04 seems to require this to be executed as sudo

Run Redmine scripts

# generate secret token
bundle exec rake generate_secret_token

# migrate database
RAILS_ENV=production bundle exec rake db:migrate

# load default data
RAILS_ENV=production bundle exec rake redmine:load_default_data

Configure Apache

Create an apache configuration file in /etc/apache2/sites-available (e.g. redmine.conf) with the following content:

<VirtualHost *:80>
    RailsEnv production
    DocumentRoot /opt/redmine/public

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

    ErrorLog ${APACHE_LOG_DIR}/redmine_error.log
        CustomLog ${APACHE_LOG_DIR}/redmine_access.log combined

If this is a new standalone installation, it will have created a default apache site. Disable it and enable the redmine config created above.

# disable default apache sites
sudo a2dissite 000-default.conf

# enable redmine
sudo a2ensite redmine.conf

# reload apache
sudo systemctl reload apache2

Test Redmine

Point your browser to the IP/DNS Name of the server and it should show the default Redmine screen.
Login with admin/admin


Updated by Marc Morocutti 10 months ago · 11 revisions