Digital Flophouse
home

Installing Redmine on Ubuntu 9.10

April 3, 2010 - 3:25pm EDT


So I'm in the process of piecing together an authentication plugin for Redmine (which is complicated by the fact that I don't exactly know Ruby, more on that in another post) and in the process have found the need to install Redmine several times.

Somewhere around the second install (of presumably many more to come), I figured I should document the install process for my own benefit. For reference, my dev box in question is running a fresh install of Ubuntu 9.10 64-bit.

Installing Ruby

First things first, let's install Ruby and Redmine's other Ruby-related dependencies (including a MySQL database server). Thankfully, Aptitude makes this a breeze:

~$ sudo apt-get install ruby rake rubygems libopenssl-ruby librmagick-ruby mysql-server libmysql-ruby

One specific Ruby gem we will have to install ourselves (and a specific version of it at that):

~$ sudo gem install rack -v 1.0.1

Configuring MySQL

Now I'll set up a MySQL database and user. Note that this MySQL installation and the user I'm creating don't have passwords but are simply limited to the local host. You should probably never ever do this in a production environment, unless you block any remote MySQL connections with a firewall of some kind.

~$ mysql -u root
mysql> create database redmine character set utf8;
mysql> create user 'redmine'@'localhost';
mysql> grant all privileges on redmine.* to 'redmine'@'localhost';
mysql> exit

Getting Redmine

Next step is to get the Redmine sources. You can either checkout directly from svn or download and unzip a packaged release. I'm choosing the latter:

~$ wget http://rubyforge.org/frs/download.php/69449/redmine-0.9.3.tar.gz
~$ sudo tar -xvzf redmine-0.9.3.tar.gz -C /opt/
~$ cd /opt/redmine-0.9.3

Connecting Redmine to MySQL

Ok, so we need to tell Redmine where our database is and how to connect to it, so copy and edit the default config (in YAML):

/opt/redmine-0.9.3$ cp config/database.yml.example config/database.yml

This is what I'm using:

# only setting up production since I'll only be running for production
production:
  adapter: mysql
  database: redmine
  host: localhost
  username: root
  password:
  encoding: utf8 

Finishing up the environment

We still need to initialize the session store, migrate in the database schema, and populate a default dataset. That last step isn't always required (if you don't mind configuring by hand) but I will be doing it here for simplicity's sake.

/opt/redmine-0.9.3$ RAILS_ENV=production rake config/initializers/session_store.rb
/opt/redmine-0.9.3$ RAILS_ENV=production rake db:migrate
/opt/redmine-0.9.3$ RAILS_ENV=production rake redmine:load_default_data

Note: Ordinarily, you would want to have a redmine user and ensure it has read permissions to the /opt/redmine-0.9.3 directory, and run Redmine as that user. However, I will be skipping this and just running Redmine as root since this is an already isolated dev box.

Fruits of our labor

Let's start Redmine server via webrick, and visit it in our browser at port 3000. From there, we'll login with the default user admin and password admin, and viola!

/opt/redmine-0.9.3$ sudo ruby script/server webrick -e production

The next steps...

After this point, it really varies on your purposes for Redmine. I will be hacking on a new AuthSource class, which I may document in another post.

Ciao!