Installing Redmine on Debian 7 with Plesk 12

First Steps

Let us begin with a clean installation of Debian 7 and Plesk. We are going to install redmine on a subdomain, so first we log in to plesk and create a new customer for the given domain. After this we navigate to the domain’s control panel and create a new subdomain „redmine.your.domain“.

Connect to your server via ssh terminal, like putty, login as root and update your apt:

apt-get update && apt-get upgrade

Get Ruby

EDIT: This is not the most correct way to install ruby, since it will be not available for all other users. So if you want to install gitlab after installing redmine, do not use the code below to install ruby. Do it in the way it is described in the other tutorial (TODO: How to Install Gitlab and Redmine on Debian 7 managed by Plesk)

You can check the compatible version on Redmine’s official site.

# curl is already installed, by this time you can use ruby 2.0 for redmine 2.6
# since i want to install gitlab later on, i take 2.1.5
command curl -sSL https://rvm.io/mpapis.asc | gpg --import
curl -sSL https://get.rvm.io | bash -s stable --ruby=2.1.5
# start using RVM with
source /usr/local/rvm/scripts/rvm
# check, if the installation was successfull with :
rvm list known

Prepare MySQL

MySQL is already installed in the plesk distribution. However we need to install client-dev package for the installation of mysql2 gem

apt-get install libmysqlclient-dev

Now, via Plesk, navigate to databases and create a new database „redmine“ with user name „redmine“ and „your_password“.

 Get and Configure Redmine

First let us get the latest RedMine

# i plan to use svn and git later, so
apt-get install git subversion
# redmine will need imagemagick:
apt-get install imagemagick libmagickwand-dev
# now let us checkout the latest redmine version:
mkdir /opt/redmine
cd /opt/redmine
svn co http://svn.redmine.org/redmine/branches/2.6-stable current
cd current
# adjust permissions for later on
mkdir -p tmp tmp/pdf public/plugin_assets
chown -R www-data:www-data files log tmp public/plugin_assets
chmod -R 755 files log tmp public/plugin_assets
# and here are the roots for our repositories:
mkdir -p /opt/redmine/repos/svn /opt/redmine/repos/git
chown -R www-data:www-data /opt/redmine/repos

Now the basic configuration of RM

cp config/configuration.yml.example config/configuration.yml
cp config/database.yml.example config/database.yml
vi config/database.yml
# in the production section change the DB's username and password

Next we can install all the gem dependencies

bundle install --without development test

… and fill our database with the default data:

bundle exec rake generate_secret_token
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:load_default_data

Configure the web Server

First let us configure Plesk to open the /opt/redmine/current/public  folder, when we open our subdomain. Navigate to the subdomain in plesk and on the main page select „Web Server Setting“:

Add

DocumentRoot /opt/redmine/current/public/
ErrorLog /opt/redmine/current/log/redmine_error_log

into the additional directives for https and lets us add a redirect to https for http:

RewriteEngine On
#RewriteCond %{HTTP_HOST} ^[^\./]+\.[^\./]+$
RewriteRule ^/(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
<IfModule mod_header.c>
 ## Enable Strict Transport: http://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security
 Header add Strict-Transport-Security "max-age=15768000"
</IfModule>

So it will goint to look like this:web-server-settings-plesk-debianAfter saving, you can navigate to redmine.your.domain and you can already see, that the redmine’s directory is already reachable. The last thing we need to install is: passenger

Install Phusion Passenger

# some dependencies first:
apt-get install libcurl4-openssl-dev apache2-threaded-dev libapr1-dev libaprutil1-dev
# install passenger gem
gem install passenger
# create apache configuration
passenger-install-apache2-module
# confirm the ruby installation

Passenger will generate some code for you. Do not use the code below, because it will probably do not work for you. Since your passenger knows the correct paths on your server, use your own code from the console output. However, we have do add something – the default passenger user, who should be www-data. It is very important! Otherwise passenger will run as nobody and you will get permission conflicts on the directories we have changed the access rights before. So your code should look like this now:

#Load Passenger
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.0.0-p598/gems/passenger-4.0.56/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
  PassengerRoot /usr/local/rvm/gems/ruby-2.0.0-p598/gems/passenger-4.0.56
  PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.0.0-p598/wrappers/ruby
  PassengerDefaultUser www-data 
</IfModule>

We are going to add it to the running apache2 configuration:

# open apache config
vi /etc/apache2/apache2.conf
# add the copied lines to the very bottom of the configuration and restart apache after that
service apache2 restart

Thats it! Visit https://redmine.your.domain, log in with admin:admin and start using RedMine!

Be Happy! 🙂

It Works! Redmine running on subdomain on Debian 7 with Plesk

It Works! Redmine running on subdomain on Debian 7 with Plesk

 

p.s. Credits go to this guide, which i have used as base for mine.

VN:F [1.9.22_1171]
Rating: 10.0/10 (2 votes cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)
Installing Redmine on Debian 7 with Plesk 12, 10.0 out of 10 based on 2 ratings

Comments are closed.