Ad_Feed

Thursday, January 7, 2010

Install Redmine in Ubuntu 9.10 using Mysql

This tutorial demonstrates how to install Redmine on Ubuntu 9.10, using Mysql-server. The scenario here is that we want to install Redmine on the Ubuntu server using and configure IP-based Name virtual host to point to the Redmin installation.

The redmine installation will be referenced with project.domain.com.

For this to be possible, we need a system with two IP addresses. Either with two NIC or one NIC with possibly a virtual IP address.

If the first IP address is 192.168.0.1 (eth0) and 192.168.0.2 (eth0:1), Redmine (project.domain.com) will be installed on eth0:1.

  • Update you ubuntu installation

Issue the following commands to update your local package database and install any outstanding updates.

apt-get update
apt-get dist-upgrade

  • Basic system configuration
Issue the following commands to set your system hostname.
echo "project" > /etc/hostname
hostname -F /etc/hostname

Edit your /etc/hosts file to resemble the following, substituting your IP address for 192.168.0.2:

File: /etc/hosts

127.0.0.1       localhost.localdomain   localhost
192.168.0.1 mail.domain.com mail
192.168.0.2 project.domain.com project

  • Install Required Packages

Issue the following commands to install required packages. Note that the "apt-get install" command spans multiple lines.

apt-get install make build-essential libapache2-mod-passenger
rubygems ruby1.8-dev libopenssl-ruby apache2 apache2-doc
apache2-utils rake zip libpq-dev libapache2-mod-ruby
subversion mysql-server

gem install fastthread
gem install -v=2.1.2 rails


  • Setup database in mysql server
Replace dbname with database name, username with the desired username and my_password with chosen password.
create database dbname character set utf8;
create user 'username'@'localhost' identified by 'my_password';
grant all privileges on dbname.* to 'username'@'localhost';


  • Configure Apache
Edit your /etc/apache2/ports.conf file to include a named reference to your project.domain.com IP address. Append to the file:

NameVirtualHost 192.168.0.2:80

Create a virtual host configuration file for your Redmine installation resembling the following:

File: /etc/apache2/sites-available/project.domain.com


ServerName project.domain.com
ServerAlias www.
project.domain.com
DocumentRoot /
var/www/project.domain.com/redmine-0.8/public

Issue the following commands to create the proper directory structure for your site and enable required Apache functionality:
mkdir -p /var/www/project.domain.com
a2ensite project.domain.com
/etc/init.d/apache2 reload


  • Obtain Redmine

As of this writing, version 0.8 is stable; issue the following commands to check it out using subversion and create a link to the "public_html" location.

cd /var/www/project.domain.com/
svn co http://redmine.rubyforge.org/svn/branches/0.8-stable redmine-0.8
ln -s redmine-0.8/public/ ./public_html

****You can use "svn up" from the redmine-0.8 directory to keep it up to date in the future.


  • Configure Redmine
Issue the following commands to create a database configuration file:
cd redmine-0.8/
cp config/database.yml.example config/database.yml

Edit the file config/database.yml to match the following:

File: config/database.yml


production:
adapter: mysql
database: redmine
host: localhost
username: redmine
password: my_password
socket: /var/run/mysqld/mysqld.sock

Issue the following commands to complete redmine database configuration:
rake config/initializers/session_store.rb
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data

  • Final Configuration and Testing

Issue the following commands to set ownership and permissions on your Redmine files:

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

Issue the following command to start the WEBrick HTTP server, which may be used for testing your installation:

ruby script/server webrick -e production

Direct your browser to http://project.domain.com:3000. You should see the Redmine home page, and you should be able to log in with the username "admin" and password "admin". Provided Redmine is functioning correctly, you may press Ctrl+c in your terminal to stop WEBrick. Your Redmine installation should be accessible at http://project.domain.com.