LinuxTutorialsUbuntu

How To Install Redmine on Ubuntu 18.04 LTS

Install Redmine on Ubuntu 18.04 LTS

In this tutorial, we will show you how to install Redmine on Ubuntu 18.04 LTS. For those of you who didn’t know, Redmine is a project management web app that allows users to manage projects flexibly while offering robust monitoring tools and a broad library of plug-ins. This free and open-source solution offers a substitute for paid job management tools and contains support for wikis, forums, calendars, and information visualization programs.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Redmine on an Ubuntu 18.04 (Bionic Beaver) server.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 18.04 (Bionic Beaver).
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Redmine on Ubuntu 18.04 LTS Bionic Beaver

Step 1. First, make sure that all your system packages are up-to-date by running the following apt-get commands in the terminal.

sudo apt update
sudo apt upgrade
sudo apt install build-essential libmysqlclient-dev imagemagick libmagickwand-dev

Step 2. Installing MySQL server.

MySQL needs to be configured so that Redmine can store data, so we will install MySQL server:

apt-get install mysql-server mysql-client

By default, MySQL is not hardened. You can secure MySQL using the mysql_secure_installation script. You should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MySQL.

mysql_secure_installation

Configure it like this:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

Next, we will need to log in to the MySQL console and create a database for the Redmine. Run the following command:

mysql -u root -p

This will prompt you for a password, so enter your MySQL root password and hit Enter. Once you are logged in to your database server you need to create a database for Redmine installation:

CREATE DATABASE redmin
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'PASSWORD';
FLUSH PRIVILEGES;
\q

Step 3. Installing Ruby.

Install Ruby using the following command:

sudo apt install ruby-full

Step 4. Installing Passenger and Nginx.

Passenger is a fast and lightweight web application server for Ruby, Node.js, and Python that can be integrated with Apache and Nginx. We will install Passenger as an Nginx module:

sudo apt install dirmngr gnupg apt-transport-https ca-certificates

Next, import the repository GPG key and enable the Phusionpassenger repository:

sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 561F9B9CAC40B2F7
sudo add-apt-repository 'deb https://oss-binaries.phusionpassenger.com/apt/passenger bionic main'

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

sudo apt update
sudo apt install libnginx-mod-http-passenger

Step 5. Installing Redmine on Ubuntu 18.04.

First, download the latest version of Redmine, at the moment of writing this article it is version 4:

sudo curl -L http://www.redmine.org/releases/redmine-4.0.1.tar.gz -o /tmp/redmine.tar.gz
sudo tar zxf /tmp/redmine.tar.gz
sudo mv /tmp/redmine-4.0.1 /opt/redmine

Make the following changes to the database.yml file:

sudo cp /opt/redmine/config/database.yml.example /opt/redmine/config/database.yml
sudo nano /opt/redmine/config/database.yml

Add the following content:

  production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "change-with-strong-password"
  encoding: utf8

Install the Ruby dependencies and migrate the database:

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

Generate the secret token using the following command:

cd /opt/redmine/
sudo bundle exec rake generate_secret_token
sudo RAILS_ENV=production bundle exec rake db:migrate

Then, set the correct permissions by issuing the following chown command:

sudo chown -R www-data: /opt/redmine/

Step 6. Configure Nginx.

Open your text editor and create the following Nginx vhost file:

sudo nano /etc/nginx/sites-available/example.com
# Redirect HTTP -> HTTPS
server {
    listen 80;
    server_name www.example.com example.com;

    include snippets/letsencrypt.conf;
    return 301 https://example.com$request_uri;
}

# Redirect WWW -> NON WWW
server {
    listen 443 ssl http2;
    server_name www.example.com;

    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
    include snippets/ssl.conf;

    return 301 https://example.com$request_uri;
}

server {
    listen 443 ssl http2;
    server_name example.com;

    root /opt/redmine/public;

    # SSL parameters
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
    include snippets/ssl.conf;
    include snippets/letsencrypt.conf;

    # log files
    access_log /var/log/nginx/example.com.access.log;
    error_log /var/log/nginx/example.com.error.log;

    passenger_enabled on;
    passenger_min_instances 1;
    client_max_body_size 10m;
}

Enable the server block by creating a symbolic link to the sites-enabled directory:

sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/

Restart the Nginx web server for the changes to take effect:

sudo systemctl restart nginx

Step 6. Accessing Redmine.

Redmine will be available on HTTP port 80 by default. Open your favorite browser and navigate to http://example.com and complete the required steps to finish the installation using the default credentials (admin/admin). If you are using a firewall, please open port 80 to enable access to the control panel.

Congratulations! You have successfully installed Redmine. Thanks for using this tutorial for installing the Redmine project management web app on Ubuntu 18.04 LTS  (Bionic Beaver) system. For additional help or useful information, we recommend you to check the official Redmine website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button