Howto: Install Redmine 1.4 using MySQL on Debian 6 (Squeeze)

These notes are mostly because I had a hard time figuring this out – I ran in to all kinds of stupid errors. But here I present, a guide for installing Redmine 1.4 on Debian – a guide that actually works!

This guide assumes that you have a working MySQL server.

You need a bunch of packages, start by installing those:

apt-get install ruby libruby libopenssl-ruby libpgsql-ruby \
rubygems apache2 libapache2-mod-passenger subversion libmagick9-dev libmysqlclient-dev

Next, create appropriate folder and download redmine:

cd /var/www
svn co http://redmine.rubyforge.org/svn/branches/1.4-stable redmine
cd redmine

Now you need to create a user and a database in MySQL. Then continue by copying the database config sample and editing it:

cp config/database.yml.example config/database.yml
vi config/database.yml

You want to change the stanza for production:

production:
  adapter: mysql
  database: redmine
  host: localhost
  username: redmine
  password: YourPasswordForMySQL
  encoding: utf8

Save that.

Next, you need to change the Gemfile, because we don’t need sqlite and pgsql.

vi Gemfile

Then remove the following things:

platforms :mri, :mingw do
  group :postgresql do
    gem "pg", ">= 0.11.0"
  end

  group :sqlite do
    gem "sqlite3"
  end
end

And these:

  group :postgresql do
    gem "activerecord-jdbcpostgresql-adapter"
  end

  group :sqlite do
    gem "activerecord-jdbcsqlite3-adapter"
  end

Next, time to upgrade gem

REALLY_GEM_UPDATE_SYSTEM=1 gem update --system

Install bundler

gem install bundler
bundle install --without development test

Initialize session store. Ignore the warning about RDoc

RAILS_ENV=production rake config/initializers/session_store.rb
rake generate_session_store

Make the database:

RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data

Set appropriate permissions

chown -R www-data:www-data *
chmod -R 755 files/ log/ tmp/ public/plugin_assets/

Create an Apache virtual host with the following content:

<VirtualHost *:80>
ServerName your.domain.tld

DocumentRoot /var/www/redmine/public
PassengerDefaultUser www-data
RailsEnv production
RailsBaseURI /redmine
SetEnv X_DEBIAN_SITEID "your.domain.tld"

<directory /var/www/redmine>
Order allow,deny
allow from all
AllowOverride all
Options -MultiViews
</directory>
</VirtualHost>

That’s it! You’re done!

This entry was posted in Linux, Nerdy. Bookmark the permalink. Both comments and trackbacks are currently closed.