How to Install Redmine on Ubuntu 18.04

 In Dedicated, VPS, Web


  • A registered domain name pointing to your server IP address. In this tutorial we will use (optional)
  • Full SSH root access or a user with sudo privileges.
  • SSL certificate installed for your domain. In our tutorial we will use a free Let’s Encrypt SSL certificate. (optional)

Step 1: Connect to your Server

To connect to your server via SSH as the root user, use the following command:


and replace “IP_ADDRESS” and “PORT_NUMBER” with your actual server IP address and SSH port number.

Once logged in, make sure that your server is up-to-date by running the following commands:

$ apt-get update
$ apt-get upgrade

Step 2: Install MySQL

Next, we need to install the MySQL server. Ubuntu 18.04 has the latest stable version of MySQL ready for installation through the pre-installed repositories.

The following command will install the latest MySQL 5.7 server from the official Ubuntu repositories:

$ apt-get install mysql-server

The MySQL web server will be started automatically as soon as the installation is completed.

You can also enable the MySQL service to automatically start up upon server reboot with the following command:

$ systemctl enable mysql

Run the following command to further secure your installation:

$ mysql_secure_installation

This script will help you to perform important security tasks like setting up a root password, disable remote root login, remove anonymous users, etc. If the script asks for the root password, just press the [Enter] key, as no root password is set by default.

Step 3: Create a Database for Redmine

Next, we need to create a database for our Redmine installation. Log in to your MySQL server with the following command and enter your MySQL root password:

$ mysql -uroot -p

In this section, we will create a new MySQL database:

GRANT ALL PRIVILEGES ON redmine_db.* TO 'redmine_user'@'localhost' IDENTIFIED BY 'Password';

Make sure to replace the password “Password” with a real, strong password.

Step 4: Install Ruby

The easiest way to install Ruby on your Ubuntu 18.04 server is through the apt package manager. The current version in the Ubuntu repositories is 2.5.1 which is the latest stable version of Ruby at the time of writing this tutorial.

Install Ruby with the following command:

$ apt-get install ruby-full

To verify everything is done correctly, use the command ruby –version.
The output should be similar to the following:

$ ruby --version
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]

Step 5: Install Nginx and Passenger

To install Nginx on your Ubuntu 18.04 server, you need to enter the following command:

$ apt-get install nginx

Enable Nginx to start on boot and start the service using these two lines:

$ systemctl start nginx
$ systemctl enable nginx

To install Passenger, an Nginx module, start by installing the necessary package prerequisites:

$ apt-get install dirmngr gnupg apt-transport-https ca-certificates

Import the repository GPG key and enable the “Phusionpassenger” repository:

$ apt-key adv --recv-keys --keyserver hkp:// 561F9B9CAC40B2F7
$ add-apt-repository 'deb bionic main'

Once the repository is enabled, update the packages list and install the Passenger Nginx module with:

$ apt-get update
$ apt-get install libnginx-mod-http-passenger

Step 6: Download and Install Redmine

We need to install the dependencies necessary to build Redmine:

$ apt-get install build-essential libmysqlclient-dev imagemagick libmagickwand-dev

Go to Redmine’s official website and download the latest stable release of the application. At the time of this article being published, the latest version of Redmine is version 4.0.2.

$ wget -o /opt/

Once the tar.gz archive is downloaded, unpack it to the /opt directory on your server:

$ cd /opt
$ unzip
$ mv redmine-4.0.2 /opt/redmine

Now apply the following required file and folder permissions (these are needed in order for Nginx to have access to the files):

$ chown -R www-data:www-data /opt/redmine/
$ chmod -R 755 /opt/redmine/

Configure database settings:

$ cd /opt/redmine/config/
$ cp configuration.yml.example configuration.yml
$ cp database.yml.example database.yml

Open the database.yml file using your preferred text editor and update the username/password details based on the ones you set in Step 3:

$ nano database.yml
  adapter: mysql2
  database: redmine_db
  host: localhost
  username: redmine_user
  password: "Password"
  encoding: utf8

Then save and exit the file.

Step 7: Install Ruby Dependencies, Generate Keys, and Migrate the Database

Navigate to the Redmine directory and install bundler and other Ruby dependencies:

$ cd /opt/redmine/
$ gem install bundler --no-rdoc --no-ri 
$ bundle install --without development test postgresql sqlite

Run the following command to generate the keys and migrate the database:

$ bundle exec rake generate_secret_token
$ RAILS_ENV=production bundle exec rake db:migrate

Step 8: Configure Nginx

Open your preferred text editor and create the following Nginx server block file:

$ nano /etc/nginx/sites-available/
# Redirect HTTP -> HTTPS
server {
    listen 80;

    include snippets/letsencrypt.conf;
    return 301$request_uri;

# Redirect WWW -> NON WWW
server {
    listen 443 ssl http2;

    ssl_certificate /etc/letsencrypt/live/;
    ssl_certificate_key /etc/letsencrypt/live/;
    ssl_trusted_certificate /etc/letsencrypt/live/;
    include snippets/ssl.conf;

    return 301$request_uri;

server {
    listen 443 ssl http2;

    root /opt/redmine/public;

    # SSL parameters
    ssl_certificate /etc/letsencrypt/live/;
    ssl_certificate_key /etc/letsencrypt/live/;
    ssl_trusted_certificate /etc/letsencrypt/live/;
    include snippets/ssl.conf;
    include snippets/letsencrypt.conf;

    # log files
    access_log /var/log/nginx/;
    error_log /var/log/nginx/;

    passenger_enabled on;
    passenger_min_instances 1;
    client_max_body_size 10m;

Then save and exit the file.

To enable the server configuration that we just created, run the following command:

$ ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/

Now, check the config file to make sure that there are no syntax errors. Any errors could crash the web server on restart.

$ nginx -t


nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

If there are no errors, you can reload the Nginx config.

$ service nginx reload

Step 9: Access Redmine

Finally, you can start your browser and the installation is successful, a screen similar to the following will appear when you access

The default login credentials for Redmine are:

  • Username: admin
  • Password: admin

Once you change the password you will be redirected to the admin account page.

That’s it. You have successfully installed Redmine on your Ubuntu 18.04 VPS.

Recommended Posts

Start typing and press Enter to search