Project

General

Profile

Actions

HowTo Install Redmine in Ubuntu » History » Revision 20

« Previous | Revision 20/70 (diff) | Next »
Peter Hobor, 2011-01-23 22:28


Ubuntu 10.4 LTS using mod_cgi

As of 10.04, Redmine is available through Ubuntu's package manager, and installation is simple:

$ sudo apt-get install redmine redmine-mysql subversion

The second package, redmine-mysql, can be replaced by either redmine-pgsql or redmine-sqlite if you want to use either of those databases.

Redmine will now be installed in /usr/share/redmine and /etc/redmine

Configuration

Using Ubuntu Server 10.04.1, configuring Redmine via mod_cgi as described in this section does not seem to work. If you can successfully make this work, please update these instructions! Otherwise follow the instructions in the next section for installing on Ubuntu 10.04 using Passenger if mod_cgi does not work for you.

Symlink /usr/share/redmine/public to your desired web-accessible location. E.g.:

$ sudo ln -s /usr/share/redmine/public /var/www/redmine

The other files that you need to modify/create are as follows:

/etc/redmine/default/database.yml:

production:
  adapter: mysql
  database: redmine
  host: localhost
  username: redmine
  password: pa55w0rd
  encoding: utf8

/usr/share/redmine/public/dispatch.cgi:

#!/usr/bin/ruby

require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)

require "dispatcher" 

ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
Dispatcher.dispatch

/usr/share/redmine/public/.htaccess:

RewriteEngine On
RewriteBase /redmine
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

And that's it! If these instructions didn't work for you, please expand them to include whatever is needed.

Ubuntu 10.04 using Passenger

If you can't get it working with mod_cgi, you might want to try mod_passenger (it's also quicker):

$ sudo apt-get install redmine redmine-mysql subversion

The second package, redmine-mysql, can be replaced by either redmine-pgsql or redmine-sqlite if you want to use either of those databases.

Ubuntu should prompt you for all the interesting details.

Redmine will now be installed in /usr/share/redmine and /etc/redmine

Configuration

Symlink /usr/share/redmine/public to your desired web-accessible location. E.g.:

$ sudo ln -s /usr/share/redmine/public /var/www/redmine

By default, passenger runs as 'nobody', so you'll need to fix that. In /etc/apache2/mods-available/passenger.conf, add a PassengerDefaultUser www-data directive.

You'll also need to configure the /var/www/redmine location in /etc/apache2/sites-available/default:

<Directory /var/www/redmine>
    RailsBaseURI /redmine
    PassengerResolveSymlinksInDocumentRoot on
</Directory>

$ sudo a2enmod passenger

Restart apache2 and you should be good to go.

If you receive a "403: Forbidden" error after setting up Redmine, the Redmine 'public' folder may have incorrect permissions set. The executable bit on the public folder must be enabled or you will receive a "403: Forbidden" error when attempting to access Redmine.

$ sudo chmod a+x /usr/share/redmine/public

Redmine Installation on Virtual or Normal Ubuntu < 10.04

This page is a guide to installing Redmine on either a virtual or actual installation of the Ubuntu operating system. If you follow all instructions correctly you will be installed your Redmine server successfully almost an hour.

Step 1: Install Ubuntu

If you are installing on a non-virtual Ubuntu instance, please skip this section.

Installing VirtualBox:

1.Download last version of Sun VirtualBox (version 3.0.10 or newer) tool in your system.
2.Install to your system by following the instructions.

Installing Ubuntu on VirtualBox:

1.Download last version of Ubuntu(version 9.10 or newer) OS in your system.
2.After installed VirtualBox on your system you will create a new virtual operating which will be Linux type and Ubuntu subtype. If you don't know anything about VirtualBox and/or its usage please refer to the google.

3.While installing Ubuntu you should type the related configurations as follows:
(These all configurations are optional, you can give any name what you what.)
Q: What is your name? A: Redmine Server
Q: What name do you want to use to login? A: redmine
Q: Choose to password to keep your account safe? A: redmine
Q: What is the name of this computer? A: redmine-server
Choose “Log in automatically.” radio button.

4.When you finished up installation all of them open up your new VirtualBox Ubuntu OS and open up terminal(console) screen and issuing these commands:

sudo apt-get update
sudo apt-get upgrade

Configuring VirtualBox:

1.If you want to reach your VirtualBox Ubuntu OS from different machine, you have to configure VirtualBox Ubuntu OS's network setting to Bridged Adapter. So you can reach your VirtualBox Ubuntu from internal IP address easily. Because it get's same IP block as you from DHCP easily. I mean your guest and host computer is same IP block as different network client.

2.If you had assigned a static IP to your Network Consult by giving your static ethernet MAC address, you have to assign unique MAC address your VirtualBox Ubuntu OS by Setting->Network->MAC address initialization box. By this MAC address, you can get static ip easily or you can configure your Ubuntu system to not use DHCP, instead of that you can assign static IP manually.

Step 2: Install Redmine

Once you have a functioning Ubuntu operating system up and running, you can continue with installing Redmine.

Install dependencies

The following packages are required to install and run Redmine. Please install them by running apt-get as root:

sudo apt-get package-name

where package-name is each of:
  • apache2
  • apache2-threaded-dev
  • build-essential
  • libapache-dbi-perl
  • libapache2-mod-perl2
  • libapache2-svn
  • libdigest-sha1-perl
  • libgemplugin-ruby
  • libgemplugin-ruby1.8
  • libruby-extras
  • libruby1.8-extras
  • mongrel
  • mysql-server
  • rails
  • rake
  • ruby
  • rubygems
  • rubygems1.8
  • ruby1.8-dev
  • subversion

(Could someone please clean up this list?)

Package Installation and Setup

1.Once you’ve installed the VirtualBox Ubuntu OS 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 packages by issuing:

sudo apt-get install
sudo apt-get install

The packages we’re installing above are MySQL, phpMyAdmin, Rails, Ruby Gems, Mongrel and Ruby Dev environment.
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. To make simplicity you can set all passwords to “redmine”.

2.Create a new directory for Redmine. I put mine in /opt/redmine. And download last version of Redmine in it with wget command line downloader and extract it by issuing:

sudo mkdir /opt/redmine
sudo cd /opt/redmine
sudo wget http://rubyforge.org/frs/download.php/66633/redmine-0.8.6.tar.gz
tar -xvf redmine-0.8.6.tar.gz

Database Setup

1.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://localhost/phpmyadmin. You should be presented with the phpMyAdmin login screen.
Type in “root” and the MySQL “password” you created when installing MySQL.

2.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”.

3.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 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.

4.Log out of phpMyAdmin.

Redmine Database Connection Configuration

1.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” issuing:

sudo cd /opt/redmine/redmine-0.8.6/config

2.So now, assuming you’re in the “/opt/redmine/redmine-0.8.6/config” directory, issue:

sudo cp database.yml.example database.yml

3.Then, open the “database.yml” file, issue:

sudo gedit 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 save “database.yml” file and exit to the command prompt.
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 “/opt/redmine/redmine-0.8.6/tmp/mysqld.sock”.)

4.Create the database structure, by running the following command under the application root directory(I mean “/opt/redmine/redmine-0.8.6”):

sudo rake db:migrate RAILS_ENV="production"

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

5.Insert default configuration data in database, by issuing:

sudo 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, work flows and enumerations. While loading default data command prompt wants to given language selection by you.)

Setting up Permissions

1.The user who runs Redmine must have write permission on the following sub directories: “files”, “log”, “tmp” (create the last one if not present). You probably already have a “tmp” directory in /opt/redmine/redmine-0.8.6, but if you don’t, create one now by issuing:

sudo mkdir /opt/redmine/redmine-0.8.6

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

sudo useradd redmine

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

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

Testing the Installation

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

sudo cd /opt/redmine/redmine-0.8.6
sudo 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:

1.Use default administrator account to log in:
Login : admin
Password : admin

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

Setting Up Static IP

1.A more easy method for configuring a static IP address is to use your local DHCP server to assign a permanent IP to the VirtualBox OS mac address. That way you will not have to do anything inside VBS. Consult your network administrator.

2.Or you should learn configuration parameters as given below, and can configure your system to get static IP address:
The desired IP address
Network mask and broadcast address
Gateway address
Your local DNS server address(es)

Assigning Host Name and Domain for VirtualBox OS

1.A more easy method for adding your IP address - Host name pair configurations to your DNS server . Consult your network administrator.

Configuring the Passenger Apache module

Passenger is a module for apache2 that allow apache to run ruby on rails applications. Install it thus:

$ sudo gem install passenger

Then go to the passenger apache2 module installation directory and run passenger-install-apache2-module

$ cd /var/lib/gems/1.X/gems/passenger-X.X.X/

$ sudo bin/passenger-install-apache2-module

Next, configure Apache:

In /etc/apache2/mods-available/passenger.load we will add next line

LoadModule passenger_module /var/lib/gems/1.X/gems/passenger-X.X.X/ext/apache2/mod_passenger.so

We have to edit the conf of the passenger apache2 module in /etc/apache2/mods-available/passenger.conf

PassengerRoot /var/lib/gems/1.X/gems/passenger-X.X.X
PassengerRuby /usr/bin/ruby1.X

And now we active the module

$ sudo a2enmod passenger

Apache virtualhost for redmine web app

    <VirtualHost *:80>
        ServerName redmine.server.com

        DocumentRoot /var/www/redmine/public

        ServerAdmin user@server.com
        LogLevel warn
        ErrorLog /var/log/apache2/redmine_error
        CustomLog /var/log/apache2/redmine_access combined

        <Directory /var/www/redmine/public>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
        </Directory>
    </VirtualHost>

subversion server config in apache

    <VirtualHost *:80>
    ServerName svn.server.com
    ServerAdmin user@server.com
    ErrorLog /var/log/apache2/svn_error
           CustomLog /var/log/apache2/svn_access combined
        <Location /project>
           DAV svn
           SVNPath /var/lib/svn/project

           AuthType Basic
           AuthName "Trac system for Server projects" 
           AuthUserFile "/var/lib/svn/.htpasswd" 
           Require valid-user 
       <LimitExcept GET PROPFIND OPTIONS REPORT>
               Require valid-user
           </LimitExcept>
       </Location>
    </Virtualhost>

Sendmail Server Configuration

1.Before configure the email support of Redmine, we should download sendmail application for Ubuntu, issue:

sudo apt-get install sendmail
sudo sendmailconfig (Answer Yes to all questions which will be asked you)

2.It’s time to configure the server connection. Copy “config/email.yml.example” to “config/email.yml” and edit this file in order to configure your database settings for “production” environment. You’ll find the “email.yml.example” issue:

sudo cd /opt/redmine/redmine-0.8.6/config

3.So now, assuming you’re in the “/config” directory, issue:

sudo cp email.yml.example email.yml

4.Then, open the “email.yml” file, issue:

sudo gedit email.yml

… and edit it as in the example for sendmail configuration below:

production:
delivery_method: :sendmail
sendmail_settings:
location: /usr/sbin/sendmail
arguments: -i -t
address: smtp.example.net
port: 25
domain: example.net
authentication: :none
user_name:
password: redmine

Then save “email.yml” file and exit to the command prompt.

5.It’s time to configure the “environmet.rb” configuration. Open up the “environment.rb” and change “config.action_mailer.perform_deliveries = false” to “config.action_mailer.perform_deliveries = true” then save and close the “environment.rb”.

Subversion Installation and Configuration

1.Before configure the subversion support of Redmine, we should download subversion application for Ubuntu, issue:

sudo apt-get install subversion

2.If your Redmine can't find the “subversion” command you can help to find by issuing:
· > sudo cd /opt/redmine/redmine-0.8.6/config
· > sudo gedit environment.rb
· Add ENV['PATH'] = "#{ENV['PATH']}:/subversion/path" line in it.
· Save and close the “environment.rb”

Start Application at Boot Time

1.To automatically start the application on booting your server you need to modify your “crontab”, issue:

export EDITOR=gedit
crontab -e

2.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.8.6 ; rm -f log/mongrel.pid ; mongrel_rails start -e production -p 3000 -d

Backup

1.Running backups is always a good idea. Redmine backups should include:
  • data (stored in your redmine database)
    /usr/bin/mysqldump -u -p | gzip > /path/to/redmine/backup/db/redmine_`date +%y_%m_%d`.gz
  • attachments (stored in the files directory of your Redmine install)
    rsync -a /path/to/redmine/files /path/to/redmine/backup/files

2.Or you can use bash shell to automate kind of this operation issue:

sudo cd /opt/redmine/redmine-0.8.6
sudo mkdir backup
sudo mkdir backup/db
sudo mkdir backup/files
sudo gedit backup/runRedmineBackup.bash

And after opened gedit with “runRedmineBackup.bash” write all commands below:

#!/bin/bash
data=`date -I`
mysqldump --user=root --password="redmine" --all-databases | gzip > db/backup-$data.sql.gz
cd db
ftp -i -n << EOF
open ftpserver.example.net
user username password
bin
mput backup-$data.sql.gz
bye
EOF

Then save “runRedmineBackup.bash” file and exit to the command prompt. After creation of runRedmineBackup.bash you can add this bash to run continually between specified periods. Issue:

export EDITOR=gedit
crontab -e

Add 0 0 * * 0 cd /opt/redmine/redmine-0.8.6/backup ; sh runRedmineBackup.bash commands to crontab to backup database weekly.

To work this bush without any permission problem you have to change all of them modes to maxium permission issue:

sudo chmod -R 777 backup
sudo chown -R redmine:redmine backup

That's all. Now we completely installed Redmine our virtual Ubuntu OS and can reach from any machine at our network easily. Congratulations..!

Sources & contributors.

  • Ümit Uzun 06/11/2009.
  • Some of the above material comes from Macada's wiki, licenced under the GNU Free Documentation License 1.2. See Redmine in Ubuntu Jaunty 9.04 by David 'macada', last modified 2010-02-08, accessed 2010-05-26.
  • Sam Wilson 2010-05-26, formatting changes.
  • Allen Yeh 2010-09-08, Added apt-get install subversion into instructions for 10.04 otherwise once redmine is setup an error like this will result this error -> The entry or revision was not found in the repository.

Additional Sources

Updated by Peter Hobor about 13 years ago · 20 revisions