How to Setup Redmine with Nginx on Ubuntu Linux

|

,

|

Redmine is a flexible project management web platform, designed to help businesses automate and streamline project interactions across multiple devices. It’s built on an open-source core and Ruby on Rails framework. Installation involves setting up Nginx HTTP Server and MariaDB Database Server, creating a Redmine database, installing Passenger, and configuring Nginx. The platform is compatible…

This article explains how to set up Redmine on Ubuntu Linux with Nginx support.

Redmine is a flexible enterprise project management web platform written in the Ruby on Rails framework. and is great for projects and time tracking, wiki, document management, and more. It also integrates with popular open-source plugins to make managing your projects easy.

Setting up Redmine with Nginx on Ubuntu Linux is a great way to manage your projects, time tracking, wiki, document management, and more. Nginx is a popular open-source web server that provides a stable, scalable, and high-performance environment for Redmine.

The combination of Redmine and Nginx provides a reliable and flexible project management and collaboration platform. Additionally, Redmine is built on an open-source core with support for open standards, making it an excellent choice for enterprises and business owners who need to collaborate and automate engagements with users across multiple devices, including mobile.

For more about Redmine, please check their Homepage

To get started with installing Redmine, follow the steps below:

Install Nginx HTTP Server

Redmine requires a web server, and the Nginx HTTP server is probably the second most popular open-source web server available today. To install the Nginx server, run the commands below:

sudo apt update
sudo apt install nginx

After installing Nginx, the commands below can be used to stop, start, and enable the Nginx service to always start up with the server boots.

sudo systemctl stop nginx.service
sudo systemctl start nginx.service
sudo systemctl enable nginx.service

Now that Nginx has been installed browse your browser to the URL below to test whether the web server works.

http://localhost

If you see the page above, then Nginx is successfully installed.

Install MariaDB Database Server

Redmine also requires a database server to store its content. MariaDB is a great place to start if you want a genuinely open-source database server. To install MariaDB, run the commands below:

sudo apt-get install mariadb-server mariadb-client

After installing MariaDB, the commands below can stop, start, and enable the service to start when the server boots.

Run these on Ubuntu 16.04 LTS

sudo systemctl stop mysql.service
sudo systemctl start mysql.service
sudo systemctl enable mysql.service

Run these on Ubuntu 18.10 and 18.04 LTS

sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

Next, run the commands below to secure the database server with a root password if you were not prompted to do so during the installation.

sudo mysql_secure_installation

When prompted, answer the questions below by following the guide.

  • Enter current password for root (enter for none): Just press the Enter
  • Set root password? [Y/n]: Y
  • New password: Enter password
  • Re-enter new password: Repeat password
  • 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

Once MariaDB is installed, run the commands below to test whether the database server was installed.

sudo mysql -u root -p

Type the root password when prompted.

The server was successfully installed if you see a similar screen.

Create Redmine Database

Once you’ve installed all the packages required for Redmine to function, continue below to start configuring the servers. First, run the commands below to create a blank Redmine database.

To log on to the MariaDB database server, run the commands below.

sudo mysql -u root -p

Then, create a database called Redmine

CREATE DATABASE redmine;

Create a database user called redmineuser with a new password

CREATE USER 'redmineuser'@'localhost' IDENTIFIED BY 'new_password_here';

Then, grant the user full access to the database.

GRANT ALL ON redmine.* TO 'redmineuser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;

Finally, save your changes and exit.

FLUSH PRIVILEGES;
EXIT;

Install Passenger

Passenger is a fast and lightweight web application server for Ruby, Node.js, and Python that can be integrated with Apache and Nginx.

Follow the steps below to install the passenger module.

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

Import the repository GPG key and enable the Phusionpassenger repository:

sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 561F9B9CAC40B2F7
sudo sh -c 'echo "deb https://oss-binaries.phusionpassenger.com/apt/passenger $(lsb_release -sc) main" >> /etc/apt/sources.list.d/passenger.list'

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

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

Install Redmine

Now that you have installed Nginx and MariaDB run the commands below to install Redmine packages.

sudo apt-get install redmine redmine-mysql

During the installation, you will be asked to configure Redmine. Choose Yes and continue.

 ┌──────────────────────────┤ Configuring redmine ├──────────────────────────┐
 │                                                                           │ 
 │ The redmine/instances/default package must have a database installed and  │ 
 │ configured before it can be used. This can be optionally handled with     │ 
 │ dbconfig-common.                                                          │ 
 │                                                                           │ 
 │ If you are an advanced database administrator and know that you want to   │ 
 │ perform this configuration manually, or if your database has already      │ 
 │ been installed and configured, you should refuse this option. Details on  │ 
 │ what needs to be done should most likely be provided in                   │ 
 │ /usr/share/doc/redmine/instances/default.                                 │ 
 │                                                                           │ 
 │ Otherwise, you should probably choose this option.                        │ 
 │                                                                           │ 
 │ Configure database for redmine/instances/default with dbconfig-common?    │ 
 │                                                                           │ 
 │               <Yes>                            <No>                       |
 │                                                                           │ 
 └───────────────────────────────────────────────────────────────────────────┘ 

Then, choose MySQL and the database type you want to use.

          ┌─────────────────┤ Configuring redmine ├─────────────────┐
          │ Database type to be used by redmine/instances/default:  │ 
          │                                                         │ 
          │                        sqlite3                          │ 
          │                        mysql                            │ 
          │                                                         │ 
          │                                                         │ 
          |             <Ok>                <Cancel>
          │                                                         │ 
          └─────────────────────────────────────────────────────────┘ 

Next, create a password for the Remind instance to register with the database.

 ┌──────────────────────────┤ Configuring redmine ├──────────────────────────┐
 │ Please provide a password for redmine/instances/default to register with  │ 
 │ the database server. If left blank, a random password will be generated.  │ 
 │                                                                           │ 
 │ MySQL application password for redmine/instances/default:                 │ 
 │                                                                           │ 
 │ ********_________________________________________________________________ │ 
 │                                                                           │ 
 │                 <Ok>                   <Cancel>                           |
 │                                                                           │ 
 └───────────────────────────────────────────────────────────────────────────┘

Next, install gem bundler packages.

sudo gem update
sudo gem install bundler

After that, continue below to set up the Nginx site for Redmine. First, run the commands below to create a symbolic link to the Redmine document root.

sudo ln -s /usr/share/redmine/public /var/www/html/redmine

Next, adjust these directories to the Nginx user.

sudo touch /usr/share/redmine/Gemfile.lock
sudo chown www-data:www-data /usr/share/redmine/Gemfile.lock

Configure Nginx

Finally, configure the Apahce2 site configuration file for Redmine. This file will control how users access Redmine content. Run the commands below to create a new configuration file called redmine.conf.

sudo nano /etc/nginx/sites-available/redmine.conf

Then copy and paste the content below into the file and save it. Replace the highlighted line with your domain name and directory root location.

server {
    listen 80;
    listen [::]:80;
    root /var/www/html/redmine;
    server_name  example.com www.example.com;

     client_max_body_size 100M;
     passenger_enabled on;
     passenger_min_instances 1;
  
     autoindex off;

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

Save the file and exit.

Enable the Redmine Site

After configuring the VirtualHost above, please enable it by running the commands below.

sudo ln -s /etc/nginx/sites-available/redmine.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx.service

Then, open your browser, browse the server domain name, and see the Redmine home page.

http://example.com/

Log in with the username and password below:

Username: admin
Password: admin

That’s it!

Congratulation! You have successfully installed Redmine on Ubuntu 16.04 | 18.04 and 18.10.

You may also like the post below:

Like this:



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.