You are here
Home > LinuxAdmin >

Install Redmine on DreamHost VPS Server

Recently we moved to dreamhost VPS server and signed in for 3 year service. We were using redmine in our projects for handling project management activities. After successful installation of latest redmine release on local server, it was time to move on to install and test it on webservers. But when we contacted Dreamhost support they have standard reply,

Thank you for writing into DreamHost Support!

Unfortunately, we cannot assist with custom configs for that application,
My apologies. If you need root access for the install then you would need
to use a dedicated server or DreamCompute and that would not be allowed on your current VPS.

Dreamhost Support Reply

There are multiple resources available across the web about Redmine on Dreamhost, but they’re all quite outdated. Well redmine is flexible project management web application and is free to use opensource software. We did not stop here, as we were so much impressed with capabilities of redmine for project management and reporting. So we have started with installation of ruby on rails on VPS (virtual private server).

Contents

Step 0 – Pre-Build

  1. Enable Passenger (Ruby/NodeJS/Python apps only) under ‘domains’->’Manage Domains’ from dreamhost cpanel
  2. Install RVM (Ruby version Manager) using steps mentioned in dreamhost help center
  3. Install ImageMagick current gem as redmine requires it and DreamHost servers don’t have it
    1. mkdir src && cd src
    2. Get latest source from imagemagic website using $ wget http://www.imagemagick.org/download/
    3. mkdir ~/lib
    4. tar xfz ImageMagick-7.0*
    5. Now navigate to ImageMagick-7.0* folder and configure
    6. ./configure –prefix=/home/username/lib/ImageMagick-7.0.8-68
    7. make
    8. make install
    9. export PKG_CONFIG_PATH=’/home/username/lib/ImageMagick-7.0.8-68/lib/pkgconfig’
    10. export C_INCLUDE_PATH=’/home/username/lib/ImageMagick-7.0.8-68/include’
    11. source ~/.bash_profile
  4. Download latest redmine archive and decompress it in /public folder
    1. wget http://www.redmine.org/releases/redmine-4.0.4.tar.gz
    2. tar xfz redmine-4.0.4.tar.gz –strip-components=1
  5. Install dependencies –
    1. $ gem install bundler
    2. $ bundle install
  6. If you are still getting issue with ImageMagick then bypass rmagick and continue
    1. bundle install –without development test rmagick
  7. Generate session store key
    1. $ bundle exec rake generate_secret_token
  8. After this command, if your VPS is Debian 9.12 (aka Stretch) you will get following error, but don’t worry, just run – $ bundle update
$ bundle exec rake generate_secret_token
Could not find gem 'mysql2 (~> 0.5.0)' in any of the gem sources listed in your Gemfile.

All above steps are required if you are using Dreamhost VPS/Shared server, If you are using dedicated servers then above tricks are not required for you.

Step 1 – Create Database

Create empty database using ‘MySQL database’ section of cpanel from dreamhost. This will create database and hostname, Note down these details along with username and password, as these are required in next step.

Step 2 – Configure Database

Configure the database in config/database.yml file, first rename ‘database.yml.example’ to ‘database.yml’. Open this configuration file and enter details as noted in step 1. The ‘database.yml’ file should look as below,

production:
adapter: mysql2
database: <db_name from step1>
host: <host_name from step1>
username: <user_name from step1>
password: <user_password from step1>

Step 3 – Migrate Database and Load Defaults

Create the database structure by running the redmine migrations

$  RAILS_ENV=production rake db:migrate

OR

$ bundle exec rake db:migrate

At this moment, if you see issue with Sprockets, use steps to upgrade sprockets and you are good to go for final rake command.

rake aborted!
Sprockets::Railtie::ManifestNeededError: Expected to find a manifest file in `app/assets/config/manifest.js`

It is easy as mentioned in the error log also, just create ‘ app/assets/config/manifest.js’ and copy below three lines in manifest file

//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css

Step 4 – Final Rake Command

$RAILS_ENV=production bundle exec rake redmine:load_default_data

Now test your redmine server using wbrick command.

$bundle exec rails server webrick -e production
http://<host_name>:3000/ 
Redmine on VPS server of Dreamhost

Step 5 – (Optional) Run webrick service as background process

With webrick running in background you need not to start the server again and it runs even after you close the session.

$ruby script/server webrick -e production -du
Or Try following  
$ruby script/server webrick -e development -d

Step 6 – Configuration Steps For Apache Server

1. You need to modify two files for apache. The first is /etc/apache2/mods-available/passenger.conf which needs the text PassengerDefaultUser www-data added as seen below.
<IfModule mod_passenger.c>
PassengerDefaultUser www-data
PassengerRoot /usr
PassengerRuby /usr/bin/ruby
</IfModule>

2. Now create a symlink to connect Redmine into the web document space:

$ sudo ln -s /home/ilmp_redmine/<PWD>/public /var/www/html/redmine
3. And modify /etc/apache2/sites-available/000-default.conf as follows
<Directory /var/www/html/redmine>
RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on
</Directory>
4. Create and set the ownership of a Gemfile.lock file so that apache’s www-data user can access it:
$ sudo chown www-data:www-data /home/ilmp_redmine/<PWD>/public/Gemfile.lock

5. Now restart apache:

$ sudo service apache2 restart

Feel free to drop a comment or email @ info@blog.neudeep.com, if you get stuck somewhere, we will try to help you as much as possible. Check out our services and offerings at RedmineLab.com

Thank you for reading this post about ‘install redmine on VPS’ happy redmining using dreamhost.

Top