2014年6月26日星期四

Install Redmine on Ubuntu

Redmine 2.4.2.stable
MySQL 5.5.37-0ubuntu0.14.04.1
Ubuntu 14.04 desktop i386

1. Update package in Ubuntu

This may take a little bit of time...

sudo apt-get update
sudo apt-get upgrade


2. Install MySQL

You may need to set a password to your mysql root during the installation.

sudo apt-get install mysql-server


3. Setup database and user for Redmine

CREATE DATABASE redmine CHARACTER SET utf8;
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'my_password';


4. Install Redmine

Redmine provides 3 choices, MySQL, PostgreSQL and SQL Server, of database. MySQL is picked here.

sudo apt-get install redmine redmine-mysql


5. Config database settings

The database.yml is located under /etc/redmine/default. Edit it by vim.

sudo vim /etc/redmine/default/database.yml


The contents of database.yml file look like followings after edited.

production:
  adapter: mysql
  database: redmine
  host: localhost
  port:
  username: redmine
  password: my_password
  endcoding: utf8

The Redmine website suggests mysql2 adapter using ruby 1.9. But it works fine with mysql adapter in my case. You can specify another port number here. Username, password, database and endcoding should be the same as those when you setup database for Redmine.

6. Create database schema objects

Go to Redmine application root directory.

cd /usr/share/redmine


Run following command

RAILS_ENV=production rake db:migrate


Run following command to set default data (I skip this step. It doesn't make anything wrong after Redmine was started)

RAILS_ENV=production rake redmine:load_default_data


7. Config log settings

Make a log folder

sudo mkdir /usr/share/redmine/log


Edit production.rb file

sudo vim /usr/share/redmine/config/environments/production.rb


Add followings codes to specify the log file name, location and log level

config.logger = Logger.new('/usr/share/redmine/log/production.log', 7, 1048576)
config.logger.level = Logger::INFO


8. Start WEBrick to run application

Let's use WEBrick to run Redmine. Enter following command to start WEBrick.

sudo ruby /usr/share/redmine/script/rails server -e production


Try it at 

http://localhost:3000