how to install redmine on ubuntu

How to Install Redmine on Ubuntu 16.04

Spread the love

We will show you, how to install and configure Redmine on Ubuntu 16.04, with Nginx and MySQL. Redmine is completely free and open source issue tracking, and project management system designed to help teams to achieve their desired project goals. It allows users to configure it according to their needs and suit their business needs. Redmine comes with a lot of useful features and plugins that can help you with the project management and all related processes. IInstalling Redmine on Ubuntu 16.04 is an easy task, just follow the steps below carefully.

1. Install dependencies

Login to your Ubuntu VPS via SSH as user root

ssh root@IP_Address -p Port_number

update all packages installed on your VPS to the latest version

apt-get update && apt-get upgrade

Run the following command to install all neccessary dependencies

apt-get install python-software-properties curl autoconf subversion bison software-properties-common imagemagick libmagickwand-dev build-essential libssl-dev libreadline-dev libyaml-dev zlib1g-dev git libcurl4-openssl-dev

2. Install MySQL server

Redmin requires an emtpy MySQL database, so we will install MySQL server

apt-get install mysql-server mysql-client

Once the installation is completed run the mysql_secure_installation post installation script and follow the on-screen instructions to secure the installation and set your MySQL root password.

Next, login to the MySQL server as user root and create a new MySQL user and database

mysql -u root -p

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

Don’t forget to replace ‘PASSWORD’ with an actual, strong password.

3. Install Ruby and Ruby Version Manager (RVM)

Install the latest version of Ruby with the following command

gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
curl -L https://get.rvm.io | bash -s stable --ruby=2.4.1

Run the following commands to load RVM

source /usr/local/rvm/scripts/rvm
echo '[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm"' >> ~/.bashrc

4. Install and configure Nginx and Phusion Passenger

Passenger is feature-rich web app server that integrates with Apache and Nginx. We will install it and integrate it with Nginx

gem install passenger --no-ri --no-rdoc
passenger-install-nginx-module

You will be prompted to select a language that will be supported, select Ruby. On the next step select the ‘Yes: download, compile and install Nginx for me. (recommended)’ option. The command will compile and install all necessary modules, including Nginx on your server and it may take some time.

Next, open the Nginx configuration file and update the server section as described below:

nano /opt/nginx/conf/nginx.conf

server {
        listen       80;
        server_name  yourdomain.com;

        root /var/www/html/redmine/public;
        passenger_enabled on;
        client_max_body_size      10m; # Max attachemnt size

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

5. Configure Nginx to start as a service

To configure Nginx to start as a service, create a nginx.service file with the following content

nano /lib/systemd/system/nginx.service

[Unit]
Description=NGINX server
After=syslog.target network.target remote-fs.target nss-lookup.target
 
[Service]
Type=forking
PIDFile=/opt/nginx/logs/nginx.pid
ExecStartPre=/opt/nginx/sbin/nginx -t
ExecStart=/opt/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
 
[Install]
WantedBy=multi-user.target

Reload the systemd services and start Nginx

systemctl daemon-reload
systemctl start nginx

6.Install and configure Redmine

Download the latest version of Redmine (at the moment of writing this article it is version 3.4) using the svn command

cd /var/www/html
svn co http://svn.redmine.org/redmine/branches/3.4-stable redmine

Change the current working directory and the example configuration files

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

Make the following changes to the database.yml file

nano config/database.yml

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: PASSWORD
  encoding: utf8

Install the Ruby dependencies and migrate the database

gem install bundler --no-ri --no-rdoc
bundle install
bundle exec rake db:migrate
bundle exec rake redmine:plugins

Generate the secret token using the following command

bundle exec rake generate_secret_token

7. Restart the webserver

Restart the web server for the changes to take effect

systemctl restart nginx

That’s all. If you closely followed the steps in this tutorial, you should be able to access Redmine on your Ubuntu 16.04 server  at http://yourdomain.com using the default credentials (admin/admin).

For more information on how to configure and use Redmine, pleae check their official guide.


Of course, you don’t have to install Redmine on Ubuntu 16.04, if you use one of our Linux Server Support Services, in which case you can simply ask our expert Linux admins to install Redmine on Ubuntu 16.04 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post on how to install Redmine on Ubuntu 16.04, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Leave a Reply

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