This is a tutorial for installing redmine on Ubuntu 11.04 with Git integration, managed by Gitosis and a redmine gitosis plugin.

It’s based on my last tutorial about installing redmine ob Ubuntu 8.04: http://www.x2on.de/2010/10/30/tutorial-redmine-with-svn-git-and-gitosis-on-ubuntu-8-04/ #1. Install redmine Get recent version from github (currently 1.1.3)

apt-get install git-core
mkdir /var/www
cd /var/www
git clone git://github.com/edavis10/redmine.git
cd redmine
git checkout -b 1.1.3 1.1.3

Install packages

apt-get install ruby  ruby1.9.1-dev libgemplugin-ruby libgemplugin-ruby1.8  mysql-server apache2-mpm-prefork wget libruby-extras libruby1.8-extras rake apache2-prefork-dev libapache-dbi-perl libapache2-mod-perl2 libdigest-sha1-perl libmysqlclient15-dev build-essential libcurl4-openssl-dev cron

If you like to use Gant-Charts:

apt-get install librmagick-ruby1.8

Create database

mysql -u root -p
sql
CREATE DATABASE redmine CHARACTER SET utf8;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';
GRANT ALL privileges ON redmine.* TO 'redmine'@'localhost';

Configure Database Settings

cp redmine/config/database.yml.example redmine/config/database.yml
nano redmine/config/database.yml
production:
  adapter: mysql
  database: redmine
  host: localhost
  username: redmine
  password: my_password
  encoding: utf8

Install Rubygem (Ubuntu 11.04 has an older version)

wget http://production.cf.rubygems.org/rubygems/rubygems-1.7.2.tgz
tar xvfz rubygems-1.7.2.tgz
cd rubygems-1.7.2
mv /usr/bin/gem /usr/bin/gem-ubuntu
ruby setup.rb
ln -s /usr/bin/gem1.8 /usr/bin/gem

Install Rails + Rack

gem install rails -v=2.3.11
gem install rack -v=1.1.0
gem install mysql
gem install -v=0.4.2 i18n

Configure redmine

cd /var/www/redmine
chown -R www-data:www-data files log tmp public/plugin_assets
chmod -R 755 files log tmp public/plugin_assets
chmod -R 777 public/plugin_assets
rake generate_session_store
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data

Test redmine

ruby script/server webrick -e production

Now you can check http://my_domain.com:3000 if everything works

  1. Apache Integration Install passenger (Modify version numbers if needed)
gem install passenger
passenger-install-apache2-module
echo "LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.7/ext/apache2/mod_passenger.so" > /etc/apache2/mods-available/passenger.load
ln -s /etc/apache2/mods-available/passenger.load /etc/apache2/mods-enabled/passenger.load
nano /etc/apache2/mods-available/passenger.conf
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.7
PassengerRuby /usr/bin/ruby1.8

Alternative: You can install passenger with ubuntu:

apt-get install libapache2-mod-passenger

Configure Apache

nano /etc/apache2/sites-available/my_domain
<VirtualHost *:80>
    ServerName my_domain.com
 
    DocumentRoot /var/www/redmine/public
 
    PassengerDefaultUser www-data
    RailsEnv production
    RailsBaseURI /redmine
    SetEnv X_DEBIAN_SITEID "default"
    <Directory /var/www/redmine/public>
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>
nano /etc/apache2/apache2.conf

Add this at the end of the file:

Include /etc/apache2/mods-available/passenger.conf

Activate your site

ln -s /etc/apache2/sites-available/my_domain /etc/apache2/sites-enabled/my_domain

Remove default entry

rm /etc/apache2/sites-enabled/000-default

Restart Apache and it should work

/etc/init.d/apache2 restart
  1. Git integration Install needed packages:
gem install inifile
apt-get install libnet-ssh-ruby1.8 python-setuptools
gem install lockfile net-ssh
apt-get install gitosis git-daemon-run acl

Activate acl for your partition:

nano /etc/fstab
...
UUID=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /               ext4    acl,errors=remount-ro 0       1
...

Reboot your machine: reboot Configure gitosis:

sudo -H -u gitosis ssh-keygen -t dsa

No Password, default file.

sudo -u gitosis cat ~gitosis/.ssh/id_dsa.pub | sudo -H -u gitosis gitosis-init
sudo sed -i.orig 's:/var/cache:/srv/gitosis:g' /etc/sv/git-daemon/run
sudo sv restart git-daemon

Install gitosis plugin for redmine:

setfacl -m user:www-data:r-x,mask:r-x ~gitosis/.ssh
setfacl -m user:www-data:r--,mask:r-- ~gitosis/.ssh/id_dsa
cd /var/www/redmine
script/plugin install git://github.com/xdissent/redmine_gitosis.git
sudo -u www-data X_DEBIAN_SITEID=default RAILS_ENV=production rake db:migrate:plugins
/etc/init.d/apache2 restart

Open your Browser, got to my_domain and login. Go to Administration – Plugins – Configure Redmine Gitosis plugin. Change localhost to my_domain. Change xdissent.com to my_domain.

Have fun!

Source: http://brantinteractive.com/2007/02/16/getting-the-mysql-gem-installed-on-ubuntu/ http://www.redmine.org/wiki/1/RedmineInstall http://wiki.ousli.org/index.php/Redmine_in_Ubuntu_Jaunty_9.04 http://www.redmine.org/wiki/1/HowTo_Install_Redmine_in_Ubuntu http://www.redmine.org/wiki/redmine/Repositories_access_control_with_apache_mod_dav_svn_and_mod_perl http://xdissent.com/2010/05/04/github-clone-with-redmine/ http://dev.remarkablewit.com/redmine/projects/dev-server/wiki https://github.com/xdissent/redmine_gitosis http://www.redmine.org/issues/2525 http://wiki.ubuntuusers.de/acl