A few days ago I needed to setup a FreeBSD server from scratch, in order to have a dedicated ticketing and project management system at work. We decided to use the popular Open Source Project Management Software, Redmine, since some of us had some previous (positive) experiences with it.
Looking through the Redmine community wiki, I noticed that the guides on how to install Redmine on a FreeBSD system were either outdated, or in a language I couldn’t understand. In contrast, one can find so many (and up to date!) guides for Debian and Ubuntu. Well, I could not let this injustice stand, so I set out to document the whole process.
Installing Redmine on FreeBSD isn’t hard, but it requires many steps (especially if the machine you are working on is bare and has just the minimum software ports installed.
This guide has the prerequisites of a working FreeBSD server with Apache and MySQL configured and ready to work on (there’s plenty of guides out there to set those up). Preferably, you should also have super user rights on the machine, otherwise this whole venture might prove more difficult than it should be.
If your server is already setup with Ruby, GIT, Passenger and ImageMagick, you can skip past most of the introductory stuff and go straight to the Redmine Installation part.
Compile all the things
We’ll be needing a few packages before we can actually install Redmine on our server. I’ll be documenting the steps I went through on the basis that none of this is already installed (as it wasn’t on my machine either). First thing to do would be to update our
[crayon-5ba9295151539393902985/] We’ll need
curl to install Ruby Version Manager, so let’s get that out of the way too:
Wget is optional, but it’ll come in handy later when we download the Redmine source:
[crayon-5ba9295151549238648150/] Next up is
ImageMagick. This will take a while, but it’s worth it if you want to have properly working Gantt exports and other image manipulation features (ie. with some of Redmine’s plugins).
NOTICE: Make sure to install
ImageMagick WITHOUT HDRI support, since the rmagick gem which we’ll be installing later on doesn’t play along with it.
[crayon-5ba929515154d793352379/] If you haven’t installed bash yet on the server, you’ll be needing it later on:
Setting up RVM
Using RVM (Ruby Version Manager) will allow you to more easily handle multiple ruby versions, gemsets and rails applications on your server. I think it’s a must have on environments where mor ethan one applications might be deployed in the future. If you don’t like RVM, there’s also Sam Stepehenson’s rbenv available, which has a more to-the-point approach to the same issue.
First of all, let’s add a new user for RVM:
[crayon-5ba9295151557403589665/] Login as the RVM user
curl. This line will also install the latest stable Ruby version.
[crayon-5ba9295151561495546177/] Make sure to follow the instructions at the end of RVM’s installation process and reload your Bash profile.
[crayon-5ba9295151564400824103/] Check that everything runs smoothly.
[crayon-5ba9295151567874161623/] The above should return
rvm is a function
[crayon-5ba929515156a978796351/] Set the ruby version as the system default
[crayon-5ba929515156d226560198/] Let’s also create a default gemset which will be used by our Redmine installation:
[crayon-5ba9295151571228238821/] Finally, check that your ruby version is the one we just installed
Setting up Redmine
With all the introductory stuff out of the way, we can move on to installing Redmine on our server. First, let’s install the bundler gem:
[crayon-5ba9295151577544845403/] Get the latest version of Redmine from this link (if you don’t have wget installed, just visit the link download the tar.gz file and upload it to your server) and untar it:
[crayon-5ba929515157a393761517/] Cd into the new directory and run bundler to install all the required gems (skipping unnecessary gems)
[crayon-5ba929515157e416846478/] We’ll also install the MySQL C bindings for Ruby, they provide a significant performance increase and there’s really no reason to have a rails app running without them.
[crayon-5ba9295151581041433733/] Next up, create a database and a user specific to Redmine.
[crayon-5ba9295151584205437746/] We need to create a database.yml file for the Redmine installation to use.
[crayon-5ba9295151587569492397/] Change the adapter to mysql2 (if you’ve installed the mysql2 gem above), then change the database name, username and password to the ones you’ve set when creating your redmine database for the production namespac ie:
[crayon-5ba929515158b039535317/] Now we’re ready to run database migrations and secret key generators for the production environment. This will also load a default data set for Redmine with sample categories, task sets etc.
In order for the Redmine application to spawn on Apache, we’ll need some kind of interface to run it from. Here, it’s up to you to decide what kind of modules or servers you want to be running, I went with Passenger. We’ll need to install the Passenger gem & the corresponding module for Apache.
[crayon-5ba9295151592844538612/] Now that passenger’s installed, we’ll need to add a few lines to cnfigure it properly in order to run with Apache. Inside your httpd.conf (in /usr/local/etc/apache22/httpd.conf) add the lines:
[crayon-5ba9295151595712768148/] Notice here that I use
/home/rvm/ which means that I installed RVM for the user ‘rvm’. Next, we’ll also need to modify our
vhosts file as well. Open
/usr/local/etc/apache22/Includes/your.domain.com.conf with an editor (or create it first if it doesn’t exist) and add the following:
[crayon-5ba929515159a060454696/] Finally, restart Apache:
[crayon-5ba929515159e382718547/] Try visiting your site via a browser, and you should now see a working Redmine installation. The default login credentials are
- username: admin
- password: admin
There’s quite a few steps to take if you’re starting out with a basic server setup, but all in all it is a straight forward process. If you’ll excuse me now, I’ll get back to creating some tasks…