I have been using Trac for my last two projects. It works mostly as expected and the integration of Wiki+Ticketing+Subversion saves a lot of time. I have been fairly satisfied with it.
Satisfied, that is, until now.
As our projects started growing, it became tedious to install and use a different version of Trac for every new project.
So, I decided to try out Redmine, which is an application very similar to Trac, but boasts of several more features, prominent among them being:
- Support for multiple projects
- Role based access system
- Project Scheduling (Gantt charts, etc)
- Ajax interface
The catch: It is written in Ruby, and most distributions don't have ready-made bundles for it (Redmine).
Nevertheless, I decided I would be brave and go where all wise men have been before. To search on Google.com. The search yielded an excellent tutorial
The Howto linked above was written for CentOs5 / RHEL5, but I found it equally valid on Fedora Core 10. Further, that Howto suggests the use of MySQL, but I altered some steps to make it work for Postgresql DB.
Here is the modified version.
- This HOWTO is written for Fedora core 10 (might also work on CentOS and RHEL)
- Replace [FQDN] with either your IP address or the hostname (or FQDN) which you’ll be using to access the interface.
- Replace [user] with the username under whose home directory the Subversion repository database will be located. e.g. /home/[user]/svn-repos
- This HOWTO will make the following assumptions:
- You already have the “httpd” (apache) package installed
- You will be running apache as the user ‘apache’
- The subversion repository root folder will be under /home/[user]/subversion/
- The vhost’s folder locationg will be /var/www/svn
- The subversion repository to be created will be called ‘example-repo’
Install and setup Subversion
Strictly speaking, this step is optional, since many features of Redmine don't require integration with an SCM. However, I am assuming that in most cases, users would want SCM integration.
yum install mod_dav_svn subversion
Add the group [user] to the user apache and make the subversion base URL readable and writable…
usermod -aG [user] apache chmod g+x /home/[user] mkdir /home/[user]/subversion chmod g+rwx /home/[user]/subversion chown -R [user]:[user] /home/[user]/subversion
Make the web directory:
mkdir /var/www/svn chown apache.apache /var/www/svn
Put the following into /etc/httpd/conf.d/svn.conf (this is for a subversion repository called ‘example-repo’)
NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot "/var/www/svn" ServerName [FQDN] <Location /example-repo> DAV svn SVNPath /home/[user]/subversion/example-repo AuthType Basic AuthName "Subversion repo" AuthUserFile /var/www/passwd Require valid-user </Location> <Directory "/var/www/svn"> allow from all Options +Indexes </Directory> </VirtualHost>
Add an HTTP auth user…
htpasswd -cm /var/www/passwd [user]
Create a proper SVN repository
cd /home/[user]/subversion su [user] -c "svnadmin create example-repo"
(This creates a blank repository, which is enough for the purpose of this tutorial)
Install Ruby on Rails
Let’s get Ruby up and running first. The original Howto recommends disabling SELinux.
yum install httpd httpd-devel apr make gcc-c++ postgresql postgresql-server ruby-postgres ruby ruby-devel ruby-docs ruby-ri \ ruby-libs ruby-mode ruby-tcltk ruby-irb ruby-rdoc fcgi fcgi-devel mod_fcgid rubygems subversion-ruby
Now we’ll install passenger (aka mod_rails)
gem install passenger passenger-install-apache2-module
Create and insert this text into /etc/httpd/conf.d/rails.conf (or alternatively edit the existing svn.conf created when we set up subversion)
The below configuration is specific to the installation of redmine (hence the DocumentRoot)
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2 PassengerRuby /usr/bin/ruby NameVirtualHost *:80 <VirtualHost *:80> ServerName 192.168.10.17 DocumentRoot /var/www/rails/redmine/public </VirtualHost>
Now on to Redmine itself
Get Redmine 0.8.x from here
Assuming you downloaded the Redmine package into ~/Dowload/redmin-0.8.x.tar.gz
mkdir /var/www/rails/ cd /var/www/rails/ tar xzf ~/Download/redmine-0.8.x.tar.gz mv redmine-0.8.x redmine chown -R apache.apache redmine cd redmine
If this is the first time you have installed Postgresql, initialise the database:
service postgresql initdb
You should now setup the password for user 'postgres'. The exact steps depend on how you want to setup authentication. I found this link useful.
Now start postgresql
service postgresql restart
Before proceeding, check if you are able to login to postgres server with user-name=postgres and your chosen password.
psql -U postgres
Now, create a database for redmine:
psql -U postgres create database redmine; create user redmine; grant all on database redmine to redmine; alter user redmine with password 'red'; \q
Copy the example database file to the “live” location
cd /var/www/rails/redmine cp config/database.yml.example config/database.yml
Enter the appropriate settings for the [production] section ensuring that host is set to 127.0.0.1
Set up email
cd /var/www/rails/redmine cp config/email.yml.example config/email.yml
Enter the appropriate settings for the [production] section ensuring that “address” is set to the IP address of the SMTP host
Install rails and postgresql connector for redmine using gem…
cd /var/www/rails/redmine/app/ gem install -v=2.1.2 rails gem install activerecord-postgresql-adapter
Import the redmine database into the live database specified in the above config file
cd /var/www/rails/redmine/app/ rake db:migrate RAILS_ENV="production"
Install default configuration data in database (this is entirely optional, but recommended).
cd /var/www/rails/redmine/app/ rake redmine:load_default_data RAILS_ENV="production"
Bring up the testing webserver, once loaded check your config by browsing to http://[FQDN]:3000
cd /var/www/rails/redmine/ ruby script/server -e production
Make sure your apache config file edits are ok and that the services will start at boot by doing:
service httpd configtest service httpd restart chkconfig httpd on chkconfig mysqld on
Taking Backups (entirely optional)
Add the following to your crontab which will create a database backup in the /home/[user] directory
pg_dump -i -h 127.0.0.1 -p 5432 -U postgres --format=plain -C -D -v "redmine" | gzip > /home/[user]/redmine_`date +%y_%m_%d`.gz
Email using Gmail and other secure servers
Out of the box, Redmine doesn't support Gmail's SMTP server (or any other secure SMTP server with TLS).
A workaround is here.
I am paraphrasing those tips here.
Install the action_mailer_optional_tls plugin
The action_mailer_optional_tls_plugin adds a TLS option to Redmine's emailing library, ActionMailer. TLS is a version of SSL which is required by GMail in order to send email.
To install this plugin, use the script/plugin command in your Redmine directory:
cd /var/www/rails/redmine/ ruby script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git
If you don't have GIT, don't fret:
cd /var/www/rails/redmine/ ./script/plugin install http://svn.douglasfshearer.com/rails/plugins/action_mailer_optional_tls
Configure your email.yml
It should now look something like this (note the tls and authentication options)
# File: config/email.yml production: delivery_method: :smtp smtp_settings: tls: true address: "smtp.gmail.com" port: '587' domain: "smtp.gmail.com" authentication: :plain user_name: "email@example.com" password: "your_password"
That's it. You are done. Congratulations!
Do let me know via comments, how it worked for you.