SWAT Blog

Redmine installation on Ubuntu 10.04

December 10th, 2010 by Bhagwan Dass

STEP 1: Install Ruby, build essentials, openssl, postgress and subversion

apt-get install wget build-essential ruby1.8 ruby1.8-dev irb1.8
rdoc1.8 zlib1g-dev libopenssl-ruby1.8 libzlib-ruby libssl-dev
libpq-dev postgresql subversion

STEP 2: Make symbolic links to the installed Ruby:

ln -s /usr/bin/ruby1.8 /usr/bin/ruby
ln -s /usr/bin/irb1.8 /usr/bin/irb

STEP 3: Download and install rubygems

wget http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz
tar -xf rubygems*.tgz
cd rubygems*
ruby setup.rb
ln -s /usr/bin/gem1.8 /usr/bin/gem

STEP 4: Install other required gems

gem install -v=1.0.1 rack
gem install fastthread
gem install -v=2.3.5 rails
gem install postgres

STEP 5: Install Passenger and Nginx

cd /opt
wget http://rubyforge.org/frs/download.php/71376/passenger-2.2.15.tar.gz
tar xzvf passenger*.gz

STEP 6: Run the Phusion Passenger installer for Nginx:

cd passenger*/bin
./passenger-install-nginx-module

It will ask you few configuration things for nginx installation
Press Enter
Press 1
Press Enter

STEP 7: Configure Nginx

Nginx is now installed in /opt/nginx, but we need a way of controlling it. Create a file called #/etc/init.d/nginx and copy the following script contents into it:

vi /etc/init.d/nginx

Paste below code into the file:

#!/bin/sh
### BEGIN INIT INFO
# Provides:          nginx
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts the nginx web server
# Description:       starts nginx using start-stop-daemon
### END INIT INFO
PATH=/opt/nginx/sbin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/opt/nginx/sbin/nginx
NAME=nginx
DESC=nginx
test -x $DAEMON || exit 0
# Include nginx defaults if available
if [ -f /etc/default/nginx ] ; then
. /etc/default/nginx
fi
set -e
case "$1" in
start)
echo -n "Starting $DESC: "
start-stop-daemon --start --quiet --pidfile /opt/nginx/logs/$NAME.pid 
--exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop --quiet --pidfile /opt/nginx/logs/$NAME.pid 
--exec $DAEMON
echo "$NAME."
;;
restart|force-reload)
echo -n "Restarting $DESC: "
start-stop-daemon --stop --quiet --pidfile 
/opt/nginx/logs/$NAME.pid --exec $DAEMON
sleep 1
start-stop-daemon --start --quiet --pidfile 
/opt/nginx/logs/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
;;
reload)
echo -n "Reloading $DESC configuration:"
start-stop-daemon --stop --signal HUP --quiet --pidfile /opt/nginx/logs/$NAME.pid 
--exec $DAEMON
echo "$NAME."
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
exit 1
;;
esac
exit 0

Save & exit:

Run the following command to set system startup links:

chmod +x /etc/init.d/nginx
/usr/sbin/update-rc.d -f nginx defaults

If you want to change the default port 80 to 8080 then edit

vi /opt/nginx/conf/nginx.conf
listen 127.0.0.1:8080;

STEP 8: Installing and Configuring Redmine:-

Download Redmine

mkdir -p /srv/www/redmine
cd /srv/www/redmine/
svn co http://redmine.rubyforge.org/svn/branches/1.0-stable redmine

STEP 9: Create and Configure the Database

Switch to the postgres user and start up the psql shell by issuing the following commands:

su - postgres
psql

Run these commands in the psql shell to set up the database for Redmine. Specify a strong password in place of “secret”.

CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'secret' NOINHERIT VALID UNTIL 'infinity';
CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine TEMPLATE=template0;
ALTER DATABASE "redmine" SET datestyle="ISO,MDY";
q
exit
cd redmine

STEP 10: Create the file config/database.yml with the following contents:

cd config/
vi database.yml

paste these lines into the database.yml file

production:
adapter: postgresql
database: redmine
host: localhost
username: redmine
password: secret
encoding: utf8
schema_search_path: public

Run the following commands to complete database configuration:

chmod 600 config/database.yml
rake config/initializers/session_store.rb
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data

STEP 11: Configure Email Service

Run commands to install exim4 and configure it for outgoing Internet email delivery. You can use Exim installation if you already have SMTP server configured that accepts unauthenticated locally sent mail, although you will still need to create Redmine’s email configuration file.

apt-get install exim4
dpkg-reconfigure exim4-config

Select “internet site” as the type of mail configuration to use.
Specify your systems’s fully qualified domain name as the system mail name.
Enter “127.0.0.1” when asked for the IP address to listen on for SMTP connections. For purposes of allowing Redmine to send mail, we only want to listen on localhost.
Enter “localhost.localdomain” and your fully qualified domain name when asked for the list of recipient domains.
Relay domains and machines should be left blank.
Specify “No” when asked about DNS queries.
When asked about maildirs versus mbox format, you may choose either. Maildirs are increasingly preferred by many modern mail tools.
Specify “No” when asked whether to split the configuration into smaller files.

Create the file config/email.yml and copy in the following contents. Be sure to replace the domain field with your fully qualified domain name.

File: config/email.yml

production:
delivery_method: :smtp
smtp_settings:
address: 127.0.0.1
port: 25
domain: redmine
authentication: :none

This completes email configuration for your Redmine installation.

STEP 12: Final Configuration and Testing:-

Create a “redmine” user to manage the installation. Run the following commands to set ownership and permissions on Redmine files, assign a strong password for Redmine user:

adduser redmine
cd /srv/www/redmine/
chown -R redmine:redmine *
cd redmine
chmod -R 755 files log tmp public/plugin_assets

#Edit the file /opt/nginx/conf/nginx.conf, setting the “user” parameter to “redmine”:

vim /opt/nginx/conf/nginx.conf
user  redmine;

Also, add a server section after the first example server as follows. If #you’re proxying to nginx from another web server, be sure to change the listen #directive to “listen 8080;” instead of the default.

server {
listen 80;
server_name  192.168.1.12;
root /srv/www/redmine/redmine/public/;
access_log /srv/www/redmine/redmine/log/access.log;
error_log /srv/www/redmine/redmine/log/error.log;
index index.html;
location / {
passenger_enabled on;
allow all;
}
}
/etc/init.d/nginx start

Redmine installation should be accessible at
http://localhost

Tags: , , , , ,

3 Responses to “Redmine installation on Ubuntu 10.04”

  1. Hello sir ,

    thanks for posting . it makes so easy to installation of redmine in local ubantu.
    good post .. keep writing ..

    thanks
    Siddharth

  2. Adriano Coldebella says:

    Great guide!
    I installed redmine on my ubuntu server in few minutes!

Leave a Reply

  • © 2004-2015 Special Work & Technology Limited