Monday, March 2, 2015

Install Redmine 3.0 on Ububtu 14.10 with PostgreSQL

# install system packages:

sudo apt-get install ruby ruby-dev
sudo apt-get install postgresql libpq-dev
sudo apt-get install libmagickwand-dev imagemagick libmagickcore-dev


# PostgreSQL database:

createuser redmine

createdb -O redmine -E UTF8 redmine

psql -d redmine -c "ALTER DATABASE redmine SET datestyle=\"ISO,MDY\";"


# if restore beckup:

pg_restore -d redmine -Fc -v redmine.backup

vacuumdb --all --analyze


# Ruby:
tar xvf redmine-3.0.0.tar.gz

cd redmine-3.0.0/

sudo gem install bundler

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


# in config/database.yml:

# PostgreSQL configuration example
production:
  adapter: postgresql
  database: redmine_default
  host: localhost
  username: redmine
  encoding: utf8
  password: "postgres"




bundle install --without development test mysqlclientlib

rake generate_secret_token

# if new database:
# rake RAILS_ENV=production db:create
RAILS_ENV=production rake db:migrate
rake RAILS_ENV=production redmine:load_default_data

# if restore
bundle exec rake db:migrate RAILS_ENV=production
bundle exec rake redmine:plugins:migrate RAILS_ENV=production
bundle exec rake tmp:cache:clear tmp:sessions:clear RAILS_ENV=production



# Puma web server (optional)
#sudo gem install puma



#Start bash script redmine.sh :

#!/bin/bash

cd /opt/redmine-3.0.0
export RAILS_ENV=production
nohup ruby bin/rails server webrick -e production &