ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

Installation on Debian Squeeze v2

Version 4 (Holger Just, 2013-04-18 11:12 pm) → Version 5/7 (Enno Gröper, 2013-04-18 11:12 pm)

h1. Installation on Debian 6.0 (Squeeze)

p(smallcaution). This guide is written for ChiliProject 2.x. There also exists a guide for [[Installation on Debian Squeeze v1|ChiliProject 1.x]]. Other versions might need different dependencies and installation steps.

p(smallsee-also). This guide is specific to installing ChiliProject on Debian 6.0 (Squeeze). There are also guides for [[Installation on Debian Lenny|Debian 5.0 (Lenny)]] and other [[Installation on Linux|Linux distributions]].

{{>toc}}

This guide is going to lead you through a standard installation of ChiliProject on Debian 6.0 (Squeeze). For many of the installation steps exist various alternatives. These are mentioned at the respective places. Sometimes it makes sense to follow the the alternative routes depending on your environment and special needs.

If you use one of the alternatives mentioned here, you can always return to follow the installation to the end.

p(smallinfo). All commands mentioned here are assumed to be run as root. Many of them will not work when run as a normal user. You can get a root shell by running @sudo -i@.

h2. Global dependencies and basic system setup

<pre>
mkdir -p /srv/www/chiliproject
adduser --system --home /srv/www/chiliproject --group --shell /bin/sh --disabled-login chiliproject
</pre>

h2. Install Ruby and basic dependencies

Squeeze's ruby packages are sufficiently current. Most of the time, we can safely use those.

Another alternative would we to use the "Ruby Version Manager (RVM)":http://rvm.beginrescueend.com/ and install Ruby and all dependent components from source. It brings you much more more flexibility while being equally simple to manage than the Debian package based setup.

h3. Variant 1: Use Debian packages

<pre>
aptitude update
aptitude install ruby rubygems
</pre>

h3. Variant 2: Use the Ruby Version Manager (RVM)

For RVM we basically need a compiler and some library dependencies and development headers.

<pre>aptitude install build-essential curl libssl-dev zlib1g-dev libreadline5-dev libxml2-dev git</pre>

Now install RVM. This script will install RVM into @/usr/local/rvm@. All users which are members of the newly created @rvm@ group can subsequently modify the installed rubies and gems. By default only @root@ is going to be in this group.

<pre>bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)</pre>

To load RVM into the shell session you can either logout and login again or simply run @source /etc/profile.d/rvm.sh@ your current shell session.

Now as we have installed RVM, we can download and compile a Ruby 1.8.7. You can also use Ruby Enterprise Edition here. Just replace @1.8.7@ with @ree@ in the following 3 commands.

<pre>
rvm install 1.8.7
rvm use 1.8.7
rvm --default 1.8.7
</pre>

p(smallsee-also). For more information and options refer to the official "RVM installation guide":http://beginrescueend.com/rvm/install/.

h2. Install database adapter

Setup and configure a database. ChiliProject supports MySQL, PostgreSQL and SQLite3. For a production environment, you should go with either MySQL or PostgreSQL to prevent scaling and issues and problems from parallel access to the SQLite database. Please chose one of the databases and install it.

h3. Variant 1: PostgreSQL

First install the actual database.

<pre>aptitude install postgresql</pre>

Now setup and perform the basic configuration of your database server. For a single-system setup, the basic Debian configuration is sufficient. A special ChiliProject user and the actual database is created later.

h4. Variant 1.1: Install adapter as Debian package

If you've installed Ruby from Debian packages follow that route and also install the database adapter via aptitude.

<pre>aptitude install libpgsql-ruby</pre>

h4. Variant 1.2: Install adapter as gem

If you've gone the RVM route install the gem.

<pre>
aptitude install libpq-dev
</pre>

p(smallnote). Later in this guide we are going to configure ChiliProject to find and connect to the database. Make sure to use the PostgreSQL configuration variants throughout the rest of the guide.

h3. Variant 2: MySQL

First install the actual database.

<pre>aptitude install mysql-server</pre>

Now setup and perform the basic configuration of your database server. For a single-system setup, the basic Debian configuration is sufficient. For a real production setup you might want to tune your MySQL server a bit. The default configuration is targeted at very small systems. Query handling times can be improved by properly tuning your MySQL depending on your hardware

A special ChiliProject user and the actual database is created later.

h4. Variant 2.1: Install adapter as Debian package

If you've installed Ruby from Debian packages follow that route and also install the database adapter via aptitude.

<pre>aptitude install libmysql-ruby</pre>

h4. Variant 2.2: Install adapter as gem

If you've gone the RVM route install the gem.

<pre>
aptitude install libmysqlclient-dev
</pre>

p(smallnote). Later in this guide we are going to configure ChiliProject to find and connect to the database. Make sure to use the MySQL configuration variants throughout the rest of the guide.

h3. Variant 3: SQLite3

First install the actual database followed by the ruby adapter.

<pre>aptitude install sqlite3</pre>

h4. Variant 3.1: Install adapter as Debian package

If you've installed Ruby from Debian packages follow that route and also install the database adapter via aptitude.

<pre>aptitude install libsqlite3-ruby</pre>

h4. Variant 3.2: Install adapter as gem

If you've gone the RVM route install the gem.

<pre>
aptitude install libsqlite3-dev
</pre>

p(smallnote). Later in this guide we are going to configured ChiliProject to use a configure SQLite database file. Make sure to use the SQLite3 configuration variants throughout the rest of the guide.

h2. Install required packages for ChiliProject

Now we install the libraries that Chiliproject depends upon. Since version 2.0 we handle all direct ChiliProject dependencies with [[bundler]]. So we need to install it. The rest of the required packages are installed in the next step as part of the core ChiliProject setup.

gem install bundler

p(smallnote). Please have a look at the [[Bundler]] page for more options. By default @bundle install@ (later in the guide) it installs all possible dependencies, many of which you will not need.

p(smallinfo). I needed to @apt-get install ruby1.8-dev@ for bundler being able to install the json 1.6.5 gem

h2. Install ChiliProject

Follow the standard [[Installation#Installation]] guide. In this guide, we are going to

* get the ChiliProject code (goes into @/srv/www/chiliproject@)
* connect it to the chosen database, and
* perform a basic [[Configuration_File|configuration]]

Once you are finished, return back here. Make sure to follow the already chosen options:

* Installation root is @/srv/www/chiliproject@
* Use the chosen database variant during database configuration

h2. Install and setup Apache2 with Passenger (mod_rails)

p(see-also). In this guide we are going to install Apache with Passenger as an application server. There are various other application servers available which might better suit your use-case. Examples are Passenger with nginx or one of "Thin":http://code.macournoyer.com/thin/, "Unicorn":http://unicorn.bogomips.org/, or "Mongrel":http://rubyforge.org/projects/mongrel/ which all need a loadbalancer / webserver like Apache or nginx in front. Most people are served very well by Apache+Passenger and it is generally very simple to install and maintain, so it is the preferred deployment option for ChiliProject.

At first, we need Apache and the "passenger":http://modrails.com module. This module is going to connect Apache with your Rails processes. The complete passenger documentation is available from "modrails.com":http://modrails.com/documentation/Users%20guide%20Apache.html. For more configuration options and examples, please refer to this guide.

<pre>aptitude install apache2-mpm-prefork</pre>

h3. Variant 1: Installed using Debian Packages

If you have installed Ruby from packages, install the packaged passenger module.

<pre>aptitude install libapache2-mod-passenger</pre>

Now edit @/etc/apache2/mods-enabled/passenger.conf@ to force it to use our chiliproject user. We add the @PassengerDefaultUser chiliproject@ directive. In the end, the file should look like this:

<pre>
<IfModule mod_passenger.c>
PassengerRoot /usr
PassengerRuby /usr/bin/ruby

PassengerDefaultUser chiliproject
</IfModule>
</pre>

h3. Variant 2: Installed via RVM

If you installed Ruby via RVM, install the gem instead:

<pre>
aptitude install apache2-prefork-dev libcurl4-openssl-dev
gem install passenger
passenger-install-apache2-module
</pre>

At the end the script outputs some configuration values. Put the single line with the @LoadModule@ directive into the file @/etc/apache2/mods-available/passenger.load@. The rest of the configuration values have to go into @/etc/apache2/mods-available/passenger.conf@. At the end of the file add @PassengerDefaultUser chiliproject@ to force it to use our newly created chiliproject user.

The @/etc/apache2/mods-available/passenger.conf@ file should look something like this:

<pre>
<IfModule mod_passenger.c>
PassengerRoot /usr/local/rvm/gems/ruby-1.8.7-p334/gems/passenger-3.0.3
PassengerRuby /usr/local/rvm/wrappers/ruby-1.8.7-p334/ruby

PassengerDefaultUser chiliproject
</IfModule>
</pre>

p(smallnote). The versions and locations might differ. Please use the actual configuration values from the @passenger-install-apache2-module@ script.

Finally enable the module and reload Apache.

<pre>
a2enmod passenger
/etc/init.d/apache reload
</pre>

h2. Setup the Apache virtual host

h3. Variant 1: Install ChiliProject at a virtual host's root

<pre>cat > /etc/apache2/sites-available/chiliproject <<EOF
<VirtualHost *:80>
# TODO: Adapt the servername
ServerName chiliproject.domain.com

DocumentRoot /srv/www/chiliproject/public
<Directory /srv/www/chiliproject/public>
Options None
AllowOverride None

Order deny,allow
Allow from all
</Directory>
</VirtualHost>
EOF
</pre>

Now activate the new virtual host and reload Apache. ChiliProject will be started at the first request to @http://chiliproject.domain.com/@.

<pre>
a2ensite chiliproject
/etc/init.d/apache2 reload
</pre>

h3. Variant 2: Install ChiliProject in a sub URL

You can also install ChiliProject into a sub URL of an existing virtual host. In the following steps, we are going to setup Apache so that it serves ChiliProject from @/chiliproject@ of an existing virtual host, so the root URL will look something like @http://www.domain.com/chiliproject@

At first you need to identify the existing virtual host where you want to host ChiliProject under. Normally, you find those in @/etc/apache2/sites-enabled/@. Choose the desired virtual host and find where its @DocumentRoot@ is pointing to. Remember the path directly after the @DocumentRoot@ directive (normally rather at the top of the virtual host).

p(smallinfo). In the following steps, the document root of the existing virtual host is going to be named @DOCUMENTROOT@. Always remember to replace this place holder with the actual path.

You need to hint Passenger a bit here so that it correctly finds your ChiliProject. So we create a symlink from the existing DocumentRoot directory to out ChiliProject installation.

<pre>ln -s /srv/www/chiliproject/public DOCUMENTROOT/chiliproject</pre>

Now add the following directives into *your existing* virtual host:

<pre>
# TODO: Remember to replace DOCUMENTROOT with your actual path
<Directory DOCUMENTROOT>
Options +SymLinksIfOwnerMatch
</Directory>

RailsBaseURI /chiliproject
# TODO: Remember to replace DOCUMENTROOT with your actual path
<Directory DOCUMENTROOT/chiliproject>
Options -MultiViews

Order deny,allow
Allow from all
</Directory>
</pre>

Now reload Apache to enable the new configuration. ChiliProject will be started at the first request to @http://www.domain.com/chiliproject@.
<pre>/etc/init.d/apache2 reload</pre>