Contents

How to Install Redmine on Ubuntu 16.04

05 Mar 2018 0 10  0
How to Install Redmine on Ubuntu 16.04
How to Install Redmine on Ubuntu 16.04

 

In this guide we are going to show you how you can install and configure Redmine on Ubuntu 16.04, along with Nginx and MySQL . Redmine is an open-source and free issue tracking, and project management system made to support teams so they achieve and reach their project goals. It grants users the ability to configure it according to their needs and suit their business needs. Redmine has a lot of useful functionalities and plugins which could help you with the project management and plugins which could help you with the project management and all related processes. Installing Redmine on Ubuntu 16.04 is simple, just follow the steps shown in this guide.

Step 1: Installing the dependencies

Begin by logging to your Ubuntu VPS via SSH as user root

ssh [email protected]_Address -p Port_number

Update every package installed on your VPS to the latest version by running the command below:

apt-get update && apt-get upgrade

Execute the command below so all the dependencies required are installed.

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

Step 2: Installing MySQL Server:

Redmine needs an empty MySQL database, therefore we will install the MySQL server:

apt-get install mysql-server mysql-client

After the installation is done execute the mysql_secure_installation post installation script and follow the on-screen instructions to ensure the installation is secured, and afterwards set your MySQL root password.

Now, login to the MySQL server as user root and make a fresh MySQL user and database:

mysql -u root -p

 

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

Remember to swap ‘PASSWORD’ with an actual, strong password:

Step 3: Installing Ruby and Ruby Version Manager (RVM)

Install the latest version of Ruby by executing the command below:

gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3

curl -L https://get.rvm.io | bash -s stable --ruby=2.4.1

Execute the commands below so RVM loads:

source /usr/local/rvm/scripts/rvm

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

Step 4: Installing and Configuring Nginx and Phusion Passenger

Passenger is a feature-rich web app server which is able to ingegrate with Apache and Nginx. We are going to install it and integrate it with Nginx:

gem install passenger --no-ri --no-rdoc

passenger-install-nginx-module

You are going to be asked to choose a language which is supported, choose Ruby. On the next step select ‘Yes:download, compile and install Nginx for me. (recommended)’ option. The command should compile and install every required module, including Nginx on your server, however it might take some time.

Now, we will open the Nginx configuration file and update the server section as shown 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;

           }

}

Step 5: Configure Nginx to start as a service

In order for Nginx to start as a service, we will need to 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 system services and initiate Nginx:

systemctl daemon-reload

systemctl start nginx

Step 6: Installing and Configuring Redmine

Download the latest version of Redmine (this guide was written when 3.4 was the latest one) with 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

We will now do 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 with the command below:

bundle exec rake generate_secret_token

Step 7: Restarting the webserver

Restart the web server so the changes take effect

systemctl restart nginx

This is all, if you followed the steps in this tutorial, you will be able to access Redmine on your Ubuntu 16.04 server at http://yourdomain.com with the default redentials (admin/admin).

0 Comments
Add a comment

Leave a Reply