How-to Install Redmine on Ubuntu 8.04

July 4, 2008 by

This tutorial assumes that you have some knowledge of Linux and know how to install Ubuntu. It further assumes you have root access and are logged in as root on the server on which you will install Redmine. If you’re not logged in as root, all command below needs to be prepended with sudo, like:

> sudo apt-get install ...

If you follow the tutorial step-by-step, you should have a functioning Redmine installation in less than an hour. I’ve tried to be as detailed as possible so that even beginners can get a Redmine system up and running. This is tutorial is more or less a cut-and-paste tutorial.

A lot of the instructions for this tutorial were copied verbatim from the excellent Redmine installation instructions here:

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

Requirements for installing Redmine:

  • Ruby on Rails 2.0.2 (Redmine 0.7.x is not compatible with Rails 2.1)
  • MySQL 4 or higher

Optional:

  • SVN binaries (>= 1.3), for repository browsing (must be available in your PATH)
  • RMagick (Gantt export to a png image)

(Note that Rails has some compatibility issues with ruby 1.8.7. The recommended ruby version is 1.8.6.)

Installing Ubuntu

First off, install Ubuntu 8.04 Server. I installed mine on Ubuntu JeOS 8.04. If you will be running Redmine on a virtual server, Ubuntu JeOS is a good choice. JeOS is optimized for virtualization and doesn’t come with a bunch of packages that you don’t need. As such, JeOS will typically create a smaller OS footprint. However, the packages you do need, you will probably have to install manually.

Make sure your server installation is up-to-date by issuing:

> apt-get update
> apt-get upgrade

Package installation and setup

Once you’ve installed the server and updated it, you need to install a bunch of packages that we will prepare the server for the Redmine installation. So, as root, install the following:

> apt-get install build-essential
> apt-get install ssh openssh-server mysql-server phpmyadmin rails rubygems mongrel libmagick9-dev ruby1.8-dev

The packages we’re installing above are MySQL, phpMyAdmin, Rails, Ruby Gems, Mongrel, LibMagick and Ruby Dev environment.

The last two, LibMagick and Ruby Dev, we install to prepare the system for later installation of RMagick to show some fancy Gantt charts. ๐Ÿ™‚

During the installation of the packages, when MySQL is installed, it will prompt you to create a password. Make sure you remember it. You will need it later to log in to the phpMyAdmin.

If you installed Ubuntu JeOS 8.04 like me, then you probably also want to install:

> apt-get install wget nano cron

Create a new directory for Redmine. I put mine in /opt/redmine, so:

> mkdir /opt/redmine

Then:

> cd /opt/redmine

Download the latest archive from Redmine into your newly created /opt/redmine directory:

> wget http://rubyforge.org/frs/download.php/38377/redmine-0.7.2.tar.gz

In my case the latest stable release was: http://rubyforge.org/frs/download.php/38377/redmine-0.7.2.tar.gz. However, that is likely to change, so look here for the latest release: http://rubyforge.org/frs/?group_id=1850.

Now, untar the file you just downloaded:

>tar xvfc redmine-0.7.2.tar.gz

Database setup

Now it’s time to create an empty database for Redmine. As you may have noticed, we installed phpMyAdmin earlier. phpMyAdmin will come in handy now. Head over to:

http://192.168.1.10/phpmyadmin

You should be presented with the phpMyAdmin login screen.

Type in root and the MySQL password you created when installing MySQL.

First, click on “Databases.” Then, at the bottom of the screen, in the “Create new database” text box create a new database called redmine and set “Collation” to utf8_general_ci.

Now, go back to the home screen and click on:

  • “Privileges”
  • “Add a new User”

Fill out the “Login Information” boxes. Call your user redmine. Make sure you remember the password you create here. It will be used when you set up the database connection details in Redmine.

In the “Database for user” section, check “Create database with same name and grant all privileges” and click on the “Go” button.

Log out of phpMyAdmin.

Redmine database connection configuration

It’s time to configure the database connection. If you installed Redmine as I did above, then copy config/database.yml.example to config/database.yml and edit this file in order to configure your database settings for “production” environment. You’ll find the database.yml.example here:

/opt/redmine/redmine-0.7.2/config

So now, assuming you’re in the /config directory, do:

> cp database.yml.example database.yml

Then, open the database.yml file, so:

> nano database.yml

… and edit it as in the example for a MySQL database below:

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

Then hit Ctrl+X to exit and answer Y to the prompt and hit enter to write to the database.yml file.

On Ubuntu the mysql.sock is located in /var/run/mysqld/mysqld.sock, as noted in the config above. (The standard Redmine installation assumes the socket is located in /tmp/mysqld.sock.)

Create the database structure, by running the following command under the application root directory:

> rake db:migrate RAILS_ENV="production"

It will create the necessary tables in the redmine database you created earlier and an administrator account.

Insert default configuration data in database, by running the following command:

> rake redmine:load_default_data RAILS_ENV="production"

(This step is optional but highly recommended, as you can define your own configuration from scratch. It will load default roles, trackers, statuses, workflows and enumerations.)

Setting up permissions

The user who runs Redmine must have write permission on the following subdirectories: files, log, tmp (create the last one if not present).

You probably already have a /tmp directory in /opt/redmine/redmine-0.7.2, but if you don’t, create one now:

> mkdir tmp

If you haven’t created a Redmine user, do it now by issuing:

> useradd redmine

Now, assuming you run Redmine with a redmine user, from your /opt/redmine/redmine-0.7.2 directory issue:

> chown -R redmine:redmine files log tmp
> chmod -R 755 files log tmp

A little fancy graphics

To get those fancy looking Gantt charts, install RMagick too:

> gem install rmagick

Testing the installation

It should all be working now. Test the installation by running the WEBrick web server:

> ruby script/server -e production

Once WEBrick has started, point your browser to http://localhost:3000/. Or, if you are using a browser on another computer than what you installed Redmine on, point your browser to http://192.168.1.10:3000/ (if that’s the IP address you gave your Redmine server). You should now see the application welcome page.

Log in

Use default administrator account to log in:

  • Login: admin
  • Password: admin

You can go to Admin & Settings to modify application settings.

SMTP server configuration>

In config/environment.rb, you can set parameters for your SMTP server:

config.action_mailer.smtp_settings: SMTP server configuration
config.action_mailer.perform_deliveries: set to false to disable mail delivering

Don’t forget to restart the application after any change.

Start application boot time

To automatically start the application on booting your server you need to modify your crontab, like so:

export EDITOR=nano
crontab -e

Your crontab file will be presented. This is the list of programs that start at certain times or at boot. Add the following to the crontab (all on one line):

@reboot cd /opt/redmine/redmine-0.7.2 ; rm -f log/mongrel.pid ; mongrel_rails start -e production -p 3000 -d

Backups

Running backups is always a good idea. Right? Redmine backups should include:

  • data (stored in your redmine database)
  • attachments (stored in the files directory of your Redmine install)

Here is a simple shell script that can be used for daily backups (assuming you’re using a mysql database):

# Database
/usr/bin/mysqldump -u -p | gzip > /path/to/backup/db/redmine_`date +%y_%m_%d`.gz

# Attachments
rsync -a /path/to/redmine/files /path/to/backup/files

Comments (17)

 

  1. […] MSDN Blog Postings wrote an interesting post today onHere’s a quick excerpt sudo apt-get install … If you follow the tutorial step-by-step, you should have a functioning Redmine installation in less than an hour. Iรขโ‚ฌโ„ขve tried to be as detailed as possible so that even b […]

  2. Matt Cushing says:

    Awesome walk thru! Worked like a charm.

    Any idea why I would have to put sudo in front of all of these commands?

  3. […] this walkthru over at MartinLanner.com is very good if you’re going to Ubuntu, which we decided on as a linux server platform. The server guy and I are familiar with it, as is the VP of IT (man, just make the guy CIO, save me some keystrokes!). […]

  4. Martin says:

    Matt,

    If you don’t have root access you need to gain admin rights for any commands that modifies the system. Sudo allows you to gain admin rights temporarily. If you’re logged in as root, there’s no need to type in “sudo” all the time. Obviously, being logged in as root can have other more grave ramifications in terms of both system security and the damage you can do to your system by issuing a not so well thought out command.

  5. Paris says:

    Hi,

    i’m still following the step-by-step, looks good…fingers crossed…

    fyi, a slight typo in…

    >tar xvfc redmine-0.7.2.tar.gz

    don’t need the ‘c’. should look like…

    >tar xvf redmine-0.7.2.tar.gz

    Thanks!

  6. Joe says:

    Any idea how to get it going with Phusion Passenger aka mod_rails? Cause I can get it to start with webrick but when I do the standard way of getting an app to work with mod_rails I get 500 internal server error.

  7. Martin says:

    Joe,

    No, sorry, I don’t know. To be honest, I had never heard of Phusion Passenger before you posted. Thanks! ๐Ÿ™‚ Very intriguing. I need to take a look at it. But don’t get you hopes up on me figuring it out anytime soon. Too busy with a bunch of other stuff right now. ๐Ÿ™ If or when I do, I’ll post something about my findings.

  8. Leh says:

    I have a redmine setup running using passanger. For configuration see the passanger documentation.

    the only thing you should have an eye on is the user running the application. if you use webrick or mongrel you typically have some kind of “capistrano” or “application” user. If you’re using passanger the application runs as www-data.
    so make sure your www-data user can perform a checkout – you can simulate that with “sudo su – www-data ; svn co your-repo”. There may be an issue for svn writing its configuration to /var/www which is www-datas home.

    I hope this helps.
    greetings

  9. macada says:

    Ive created another good howto about Redmine in Ubuntu Jaunty 9.04.
    let me know wht do you think about it

  10. Daniel says:

    Awsome guide!
    I use Debian(Lenny) and it worked right away ๐Ÿ™‚

    Keep up the work ๐Ÿ™‚

  11. Kyle Amadio says:

    Thank you – set up exactly as noted on Ubuntu Karmic 9.10 64bit. Works perfectly

  12. phz(brazil) says:

    (sorry for my english, this sux! But not have other way)
    For the start redmine on the boot i have make one change in command for crontab.

    original:
    @reboot cd /opt/redmine/redmine-0.7.2 ; rm -f log/mongrel.pid ; mongrel_rails start -e production -p 3000 -d

    change:
    @reboot ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock ;cd /opt/redmine/redmine-0.7.2 ; rm -f log/mongrel.pid ; mongrel_rails start -e production -p 3000 -d

    This because after restart system always get ERROR 500 Internal, a symbolic link was removed when system is shutdown. The new command create one new link.

    I read other pages about installation the redmine, but this is the best, easy and fast.

    Congratulations

    and thx

    phz

  13. TrygveKor says:

    Thanks a Martin, it is really a step-by-step-make-it-work post ๐Ÿ™‚

    Regards.

  14. joko says:

    hello world,
    i have 1 question,
    if I did not install phpmyadmin, whether it be a problem during the installation?? use manual like mysql > create database redmine character set utf8;

  15. Martin says:

    Should work just fine. Also, I think Redmine is now included as a package in Ubuntu 10.04 LTS that you can just apt-get.

  16. joko says:

    yes you’re right,martin….
    i just read the manual.. redmine include as a package, # apt-get install redmine-mysql or # apt-get install redmine-pgsql (CMIIW) ๐Ÿ™‚
    thanx martin,

Leave a Reply