Installing Redmine on Debian.

Tech Notes

http://www.redmine.org/wiki/redmine/RedmineInstall

sudo aptitude install  ruby ruby1.8-dev libzlib-ruby rdoc irb rubygems mysql-server libmysql-ruby1.8 subversion librmagick-ruby

sudo vi /usr/bin/gem
require 'rubygems'
require 'rubygems/gem_runner'
Gem.manage_gems

sudo gem update --system
sudo gem install rails -v=2.1.2

mysql -u root -p -e "create database redmine character set utf8;"
mysql -u root -p -e "grant all privileges on redmine.* to 'redmine'@'localhost'"
mysql -u root -p -e "set password for 'redmine'@'localhost' = password('letmein')"

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

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

sudo adduser redmine
mkdir tmp
sudo chown -R redmine:redmine files log tmp
sudo chmod -R 755 files log tmp

sudo su - redmine
cd /usr/local/redmine-0.8/

ruby script/server -e production

cp config/email.yml.example config/email.yml
vi config/email.yml

sudo vi /etc/init.d/redmine
cd /usr/local/redmine/
sudo -u redmine ruby script/server -e production > /dev/null &

sudo chmod 755 /etc/init.d/redmine
sudo update-rc.d redmine defaults 

sudo vi /etc/cron.daily/redmine
#       backup database
sudo -u redmine /usr/bin/mysqldump -u redmine --password=letmein redmine | gzip > /home/redmine/backups/db/redmine_`date +%y_%m_%d`.gz
#       backup attachments
sudo -u redmine rsync -a /usr/local/redmine/files /home/redmine/backups/files

sudo chmod 755 /etc/cron.daily/redmine

# integrate svn with redmine
sudo aptitude install libnss-mysql libpam0g-dev libssl-dev libmysqlclient15-dev libpam-mysql

cd /usr/local/redmine/extra/svn
mysql --user=root redmine -p < create_views.sql

mysql --user=root -p
create user redmine_nss@localhost identified by 'averylongpassword';
grant SELECT on redmine.nss_groups to redmine_nss@localhost;
grant SELECT on redmine.nss_users to redmine_nss@localhost;
grant SELECT on redmine.nss_grouplist to redmine_nss@localhost;
create user redmine_pam@localhost identified by 'averylongpassword';
grant SELECT on redmine.ssh_users to redmine_pam@localhost;