Installing Redmine+git on ubuntu 11.04 x64 VPS

Version Control System + wiki/other stuff

Following the tutorial below with some modification
http://www.x2on.de/2011/04/23/tutori...-ubuntu-11-04/

Requirements:
VPS
I used ubuntu 11.04 x64 as it was the latest version of ubuntu and I'm more familiar with this distro than others
RAM: at least 512MB, preferable more as Ruby/Rails takes up a lot

First, upgrade everything in your clean VPS. (mine came with apache2 preinstalled). I suggest making ssh-keys and installing fail2ban to prevent attacks. Everything I'm running through root
Code:
apt-get update
apt-get upgrade
Download the latest version from http://www.redmine.org/. The one I'm using is stable 1.3.0(2011-12-10).
Code:
cd /root #(or whatever directory you want)
wget http://rubyforge.org/frs/download.php/75597/redmine-1.3.0.tar.gz
tar xvf redmine-1.3.0.tar.gz
chown -R root:root redmine-1.3.0 #had to fix permissions for my vps
Take a look at the Redmine Install Requirements

Install the packages (from the tutorial , modifying a little based on the install requirements. Here is a list of the packages for 11.04 natty. I choose Ruby 1.8.7, Rails 2.3.14 and Rack 1.1.1
Code:
apt-get install ruby ruby1.8 ruby1.8-dev libgemplugin-ruby libgemplugin-ruby1.8 apache2-mpm-prefork libruby-extras libruby1.8-extras rake apache2-prefork-dev libapache-dbi-perl libapache2-mod-perl2 libdigest-sha1-perl build-essential libcurl4-openssl-dev 

apt-get install mysql-server libmysqlclient15-dev #make sure you set and remember the mysql root password
Create database
Code:
mysql -u root -p

CREATE DATABASE redmine_default CHARACTER SET utf8;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'thisismyredminesqlpassword';
GRANT ALL privileges ON redmine_default.* TO 'redmine'@'localhost';
I moved my redmine folder to /usr/share/redmine/
Code:
mv /root/redmine-1.3.0 /usr/share/redmine/
Config the redmine installation
Code:
cp /usr/share/redmine/config/database.yml.example /usr/share/redmine/config/database.yml
Edit that database.yml
Code:
production:
  adapter: mysql
  database: redmine_default
  host: localhost
  username: redmine
  password: thisismyredminesqlpassword
  encoding: utf8
NOTE: tutorial says to install rubygems on your own since the 11.04 repo contains an older version. i didnt care, used the older version
Code:
apt-get install rubygems rubygems1.8
Install Rails + Rack. Remember that I chose Ruby 1.8.7, Rails 2.3.14 and Rack 1.1.1 earlier.
Code:
gem install rails -v=2.3.14
gem install rack -v=1.1.1
gem install mysql
gem install -v=0.4.2 i18n
Got some "No definition for ..." errors, but they are from the documentation installation. didnt care too much, google could show ways to solve it

Configure Redmine
Code:
cd /usr/share/redmine
mkdir public/plugin_assets #had to do this
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 at http://ip:3000
Code:
ruby script/server webrick -e production
------------

Set up apache2

Install passenger. Link your redmine public folder to /var/www
Code:
gem install passenger
apt-get install libapache2-mod-passenger
ln -s /usr/share/redmine/public /var/www/redmine
Configure apache. Edit file /etc/apache2/sites-available/redmine.mydomainname.com
Code:
<VirtualHost *:80>
    ServerName redmine.mydomainname.com

    DocumentRoot /var/www/

    PassengerDefaultUser www-data
    RailsEnv production
    RailsBaseURI /redmine
    SetEnv X_DEBIAN_SITEID "default"
    <Directory /var/www/redmine/>
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>
Edit /etc/apache2/apache2.conf. Add to bottom of file
Code:
Include /etc/apache2/mods-available/passenger.conf
Activate your site
Code:
ln -s /etc/apache2/sites-available/redmine.mydomainname.com /etc/apache2/sites-enabled/redmine.mydomainname.com
Remove default entry
Code:
rm /etc/apache2/sites-enabled/000-default
Restart Apache and it should work
Code:
service apache2 restart
--------------------

Installing Git/gitosis
< to be continued >