This how-to is designed to help you install Redmine and Subversion on Ubuntu 10.04. It may work on other versions of Ubuntu, and for that matter Linux but I haven’t tested or tried it out.
This guide aims to:
- Install Subversion with a basic setup
- Install and setup Ruby on Rail to use Apache via Passenger
- Install and setup Redmine in a basic configuration
This guide does not:
- Consider advanced features of Subversion, Redmine, Passenger or Ruby on Rails
- Look into using other server methods, e.g. mongrel and thin
This is not to say I cannot help you with more advanced configurations, or won’t post about it in the future, I just wanted this guide to help you get up and running with Redmine and subversion as quickly as possible. While this may seem simple, it can be more difficult than first thought, due to Ubuntu’s quirks.
Prerequisites
There are a couple of things that need to be installed before you can begin this guide, effectively you need a LAMP configuration, of which this series of blog posts describes how to install and configure. Now that the server is all setup, lets start by installing subversion
Subversion Installation and Configuration
The main reason for installing Subversion, or SVN for short, is because it is needed to check out some components later. So lets get stuck in and install SVN.
sudo apt-get install subversion libapache2-svn
The next thing to do is configure the user access for subversion this is done by executing
sudo htpasswd -c /etc/subversion/passwd <username>
Where <username> is a new user. All subsequent users are created by doing the following
sudo htpasswd /etc/subversion/passwd <username>
Now you need to decide where you want to put your repositories. I suggest you put them all under one root path, for example /home/svn. For each repository you want create a new folder in the svn root folder and then run the following command to turn it into a repository
svnadmin create /home/svn/yourproject
One thing to note is that we are going to use apache to serve the repositories so we need to make the svn root folder and all subsequent child files and folders accessable by apache. This is typically done by using the following command
sudo chown -R www-data:www-data /home/svn/
The final part to getting your repositories to be accessed from a web address, like www.toyertech.org/svn/evec, is to add the following code to your sites apache config file nomally located in /etc/apache2/sites-available
<Location /svn> DAV svn SVNPath /home/svn AuthType Basic AuthName "Your repository name" AuthUserFile /etc/subversion/passwd Require valid-user </Location>
The last thing to do is restart apache after saving the file
sudo /etc/init.d/apache2 restart
A couple of caveats. Firstly this only allows you to view and upload to the repository if you have a username and password, and secondly all password details are sent via plain text not via ssl. Configuring subversion to allow gest to view, or upload to, a repository and allowing only ssl access are outside the scope of this document. Check out the Apache and Subversion website for more advance configurations
Redmine Installation and Configuration
The first thing to note is that the current version of Redmine is 1.0.0RC, although a bugfix version, 1.0.1 is a couple of weeks away. This is important as it requires some specific versions of some applications, which might change in future releases, although I will try to keep this up-to-date.
The second thing to note is that Redmine runs on Ruby on Rails rather than things like php. So we will need to install and setup Ruby on Rails first.
Ruby on Rails Installation
The first thing to do is install ruby, and it’s here that a big quirk of Ubuntu crops up. If you were to install the standard ruby package several key parts for running Redmine are left out so instead the following is executed, to install all required components.
sudo apt-get install ruby-full build-essential
If you want to you can get the installation version by running
ruby –v
You should get something like
ruby 1.8.7p5000 (2009-02-22) [i686-linux]
Importantly if your version of ruby is NOT 1.8.6 or 1.8.7 Redmine will fail to work.
Ruby Gems
In order to install a lot of the required components for Redmine, an install called RubyGems will be installed. Unfortunately the current version of RubyGems in Ubuntu seems not to work properly instead download the latest version from the RubyGems Rubyforge site. For me the latest version is 1.3.7. So lets download RubyGems and extract the files
wget http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz tar xzvf rubygems-1.3.7.tgz
The next thing to do is run the setup file and make sure we can use RubyGems using the gem prefix instead of the gem1.8 prefix. This is accomplished by creating a symbolic link.
sudo ruby rubygems-1.3.7/setup.rb sudo ln –s /usr/bin/gem1.8 /usr/bin/gem
Finally lets just do a bit of housekeeping
rm rubygems-1.3.7.tgz rm -r rubygems-1.3.7
Rails
Now we are ready to install Rails, and a couple of other things required for Redmine to work. It is important to add the version number after each application as these are required version for Redmine and current versions are not compatible with Redmine.
sudo gem install rails -v=2.3.5 sudo gem install rack -v=1.0.1 sudo gem install rake -v=0.8.3
Be patient when installing. It may take some time and seem to have crashed, it hasn’t. A way to speed up the install is by adding the “–no-rdoc” command. The documentation is normally the longest part of the install.
MySQL Optimisation
A quick tip that can help performance of a Ruby on Rails application that accesses MySQL is to install the Ruby interface components and the MySQL gem
sudo apt-get install libmysql-ruby libmysqlclient-dev sudo gem install mysql
Redmine Installation
Now you have installed all the prerequisits of Redmine, its time to get down to intalling the actual product, Redmine. You can either download the latest version of Redmine from here, and extract it to the location you are hosting your Redmine site, or like me, check it out from the SVN repository. First go to the folder you want to contain Redmine then check it out and update the owner of the new folder
cd /path/to/your/site sudo svn co http://redmine.rubyforge.org/svn/branches/1.0-stable redmine sudo chown -R www-data:www-data redmine
The final “redmine” part indicates the folder you want to check out Redmine into. Assuming you’ve installed phpmyadmin to administer MySQL, fire it up and open the sql tab and enter the following to create a new database for Redmine. (If you haven’t installed phpmyadmin go to this post to ensure you have php installed, and this one to install phpmyadmin)
create database redmine character set utf8; create user 'redmine'@'localhost' identified by 'my_password'; grant all privileges on redmine.* to 'redmine'@'localhost';
Now we have the database we need to tell Redmine all about, so we’ll jump into the Redmine folder and configure the database file
cd redmine sudo cp config/database.yml.example config/database.yml sudo nano config/database.yml
This will copy the example database file and open it so you can update the file. You need to update the production section so it looks something like this:
production: adapter: mysql database: redmine host: localhost username: redmine password: my_password
Of course, you need to update it with your database details. We now need to create a session store for Redmine and create the database. This is carried out using the following commands
rake generate_session_store RAILS_ENV=production rake db:migrate
Now you have an empty database. This is all well and good but I suggest you load the default data in so that you get an idea of how Redmine works
RAILS_ENV=production rake redmine:load_default_data
So now we’ve pretty much done all the work to test that Redmine does in fact work the permissions and the database. We can test is using the built in WEBrick web server, which is good for testing but not for production. So lets allow it through our firewall and start it up
sudo ufw allow 3000 sudo ruby script/server webrick -e production
Now all you need to is navigate to http://localhost:3000/ and you should see Redmine. The default login details are
login:admin password:admin
When you have finished testing press ctrl+c in the shell to stop WEBrick. I would suggest now you’ve finished testing Redmine you close the port for WEBrick
sudo ufw deny 3000
Redmine and Apache
So we have Redmine and you will quickly see that if you were to navigate to its path you won’t be able to access it. What we need to do is set up Apache to work with it. There are plenty of ways you can run Ruby on Rails applications. I prefer to use Passenger so that’s what I’ll describe here. So lets install Passenger
sudo gem install passenger
Apache unfortunately has some quirks attached to it which make using Passenger out of the box a bit of a pain, so we need to install some more components
sudo apt-get install apache2-prefork-dev libapr1-dev libaprutil1-dev
Now Apache is ready to interface with Passenger, so lets go ahead and install it
passenger-install-apache2-module
We now need to modify the Apache config files so that Passenger will handle Ruby applications when Apache is pointed to one so execute the following command
sudo nano /etc/apache2/apache2.conf
And add the following to the bottom of the file
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/ext/apache2/mod_passenger.so PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.15 PassengerRuby /usr/bin/ruby1.8
Once this is done a reboot of Apache is required to tell it we have updated its configuration.
sudo /etc/init.d/apache2 restart
Redmine is almost at the stage it can be through Apache, just a couple more steps. First open your websites config file
cd /etc/apache2/sites-available sudo nano siteconfig.conf
And modify the file so it looks something like this
<VirtualHost *:80>
DocumentRoot /path/to/redmine/site/public
ServerName example.com
PassengerPoolIdleTime 0
<Directory "/path/to/redmine/site/public">
PassengerEnabled on
AllowOverride
Options -MultiViews
</Directory>
</VirtualHost>
Or if you access SVN from the same file like this
<VirtualHost *:80>
DocumentRoot /path/to/redmine/site/public
ServerName example.com
PassengerPoolIdleTime 0
<Directory "/path/to/redmine/site/public">
PassengerEnabled on
AllowOverride
Options -MultiViews
</Directory>
<Location /svn>
DAV svn
SVNPath /home/svn
AuthType Basic
AuthName "Your repository name"
AuthUserFile /etc/subversion/passwd
Require valid-user
</Location>
</VirtualHost>
I just want to explain a couple of things. Firstly, PassengerPoolIdleTime set to 0 means that Passenger will never close down its running applications. Secondly, PassengerEnabled on ensures that Apache understands that it need to call passenger for this directory. Finally, for me leaving AllowOverride as it is seems to work for me.
I hope you found this useful. I’m opening this one up to comments so that anyone who has problems can let me know
21 comments
2 pings
Michel says:
August 25, 2010 at 11:57 (UTC 0 )
This was the first tutorial about redmine that I was able to complete without banging my head on the wall and look silly
Thank you James no end.
However the:
sudo ln –s /usr/bin/gem1.8 /usr/bin/gem
did not work. I had to omit the -s and use a hard link. Does it matter?
James Toyer says:
August 25, 2010 at 12:36 (UTC 0 )
It shouldn’t matter, but it is interesting you couldn’t make a symbolic link.
What details were given when you tried to create a symbolic link?
Michel says:
August 25, 2010 at 15:45 (UTC 0 )
I got the following:
ln: target `/usr/bin/gem’ is not a directory
Michel says:
August 25, 2010 at 16:15 (UTC 0 )
There is a typo in:
sudo svn co http:://redmine.rubyforge.org/svn/branches/1.0-stable redmine
There should be 1 : and not 2
Michel says:
August 25, 2010 at 16:49 (UTC 0 )
Finally it is running. After installation I struggled getting it to work. I added a /public at the end of the DocumentRoot path/to/redmine/site in the virtualhost directive.
Should the public be added to the Directory
James Toyer says:
August 25, 2010 at 16:56 (UTC 0 )
@Michel
This is strange as you are not trying to link to a directory but a file. I’m not sure why that is happening
James Toyer says:
August 25, 2010 at 17:06 (UTC 0 )
@Michel
Michel. Check your emails. I’ve sent you some clarification. Unfortunately word press didn’t like me displaying tags
Roman says:
September 3, 2010 at 16:45 (UTC 0 )
Thank you gazziiilions!!
Very helpful indeed!
Chris says:
September 22, 2010 at 16:59 (UTC 0 )
@Michel
The reason for this is that copy/pasting “-” (hyphens) from this blog and pasting into Ubuntu CLI (command line interface) results in the character changing to a “.” (period). The resulting incorrect command then looks like “sudo ln .s /usr/bin/gem1.8 /usr/bin/gem”.
All you have to do is copy/paste into the CLI, and fix the incorrect character.
Draulio says:
October 7, 2010 at 13:18 (UTC 0 )
Hi,
If I don’t use a VirtualHost, how I make it work?
Anything changes?
At the end, how I access the Redmine?
Thanks.
James Toyer says:
October 7, 2010 at 21:52 (UTC 0 )
@Draulio
My suggestion is that you do use a virtual host as this is how Apache is normally set up. I haven’t tried without setting it up as a virtual host so I don’t know.
If you’ve set it up correctly you should be able to your server website address or ip. Redmine will be at the root
Gulab Pasha says:
October 11, 2010 at 09:41 (UTC 0 )
Hi,
I was using redmine on my ubuntu 10.04, recently i have updated my ubuntu server. But unfortunately my redmine stopped working and when try to reset the same it gives an error.
When i run the below commands to set the Rails environment it gives error.
root@sfdlabs:/home/redmine# rake generate_session_store
(in /home/redmine)
root@sfdlabs:/home/redmine# RAILS_ENV=production rake db:migrate
(in /home/redmine)
rake aborted!
/home/redmine/config/environment.rb:65: syntax error, unexpected ‘:’, expecting ‘}’
ENV['PATH'] = “#{ENV['PATH']:/svn”
^
/home/redmine/config/environment.rb:65: unterminated string meets end of file
(See full trace by running task with –trace)
root@sfdlabs:/home/redmine# RAILS_ENV=production rake redmine:load_default_data
(in /home/redmine)
rake aborted!
/home/redmine/config/environment.rb:65: syntax error, unexpected ‘:’, expecting ‘}’
ENV['PATH'] = “#{ENV['PATH']:/svn”
^
/home/redmine/config/environment.rb:65: unterminated string meets end of file
(See full trace by running task with –trace)
root@sfdlabs:/home/redmine#
Please help how can I resolve the issue.
James Toyer says:
October 11, 2010 at 22:21 (UTC 0 )
@Gulab Pasha
The first thing to say is to make sure that things that have to be of a certain version haven’t been updated. For example rails, rack and rake. See above to make sure you install the correct version. Secondly, if all that seems to be in check then open up /home/redime/config/environment.rb and find line 65. Make sure that it reads ENV['PATH'] =”#{ENV['PATH']}/svn”. That would be what I would do. Failing that download Redmine again, or if you used svn, check out the latest version and follow the steps here
Jason says:
December 2, 2010 at 01:59 (UTC 0 )
Does this guide still work on 10.04.1?
I’ve seen a few guides out there that were broken (in 10.04.1) and I can’t seem to get Redmine installed and running correctly with any of them. Can someone confirm?
frustrated redmine firstimer says:
December 15, 2010 at 09:04 (UTC 0 )
Thank you for adding what appears to be useful documentation. I wish it worked for me.
I can say that none of the tutorials at redmine nor this one works for 10.04.1. Why? I do not know. No guide has been thorough enough to make any sense as to what configuration directives mean nor what packages are essential.
When noted as essential I’ve built from gem repositories, otherwise Ubuntu packages because I do not want the management burden of staying up on patches on a production system. Installing a web application (redmine) from a package seems sloppy and linking from the package-installed destination to a real web space on a separate partition is just a janky way of doing things.
My attempts at getting libapache2-mod-passenger operational fails miserably. My redmine setup works great from command-line webrick startup. Converting to Apache serving the web application is something still alluding me.
About your application’s environment
Ruby version 1.8.7 (i486-linux)
RubyGems version 1.3.5
Rack version 1.0
Rails version 2.3.5
Active Record version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Edge Rails revision unknown
Application root /data/www/administrationApps/redmine-1.0.4
Environment production
Database adapter mysql
Database schema version 20100819172912
James Toyer says:
December 15, 2010 at 21:23 (UTC 0 )
There seems to be many people complaining about this.
I must admit I haven’t tried it with ubuntu 10.04.1, however, I feel I should probably do an updated version of this guide for 10.04.1 and 10.10 in the near future. Most likely I’ll do it over Christmas
James
Pier-Luc Caron St-Pierre says:
December 17, 2010 at 03:15 (UTC 0 )
Hello,
In the line
sudo apt-get install apache2-prefork-dev libapr1-dev libaprutil1-dev
I think you miss the libcurl4-openssl-dev. The line should be :
sudo apt-get install apache2-prefork-dev libapr1-dev libaprutil1-dev libcurl4-openssl-dev
Thanks you very much for your tutorial!
hendro utomo says:
December 29, 2010 at 03:05 (UTC 0 )
thank you very much for your tutorial
hendro utomo says:
December 29, 2010 at 03:29 (UTC 0 )
hi,….i want to ask something,…for my redmine instance, i want it to run through http://localhost/redmine,..how do i do it exactly? any help please?
Bill Ellis says:
May 14, 2011 at 21:59 (UTC 0 )
it worked with Ubuntu 11.04 I am looking for advance subversion now has anyone got that working yet?
TJ says:
August 24, 2011 at 00:00 (UTC 0 )
I got until rake generate_session_store, and I got the following error(s):
root@tjs-laptop:/var/www/redmine# rake generate_session_store
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
rake aborted!
uninitialized constant ActiveSupport::Dependencies::Mutex
(See full trace by running task with –trace)
Any help??
Redmine and Subversion | Software Development & Technical Theatre says:
August 2, 2010 at 01:34 (UTC 0 )
[...] Installing Redmine and Subversion on Ubuntu 10.04 [...]
Le weblog de François says:
November 29, 2010 at 22:11 (UTC 0 )
Retour au bercail…
Retour de mon blog sur jan.nom.fr : j’ai rapatrié le répertoire upload, réinstallé serendipity depuis les dépôts officiels et j’ai importé la base de données MySQL après avoir pris soin de changer le nom de la base que mon hébergeur m’avait contrain…