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 2 (Chris Dähn, 2013-04-18 11:12 pm)

1 1
h1. Installation on Debian 6.0 (Squeeze)
2 1
3 2 Chris Dähn
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.
4 1
5 1
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]].
6 1
7 1
{{>toc}}
8 1
9 1
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.
10 1
11 1
If you use one of the alternatives mentioned here, you can always return to follow the installation to the end.
12 1
13 1
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@.
14 1
15 1
h2. Global dependencies and basic system setup
16 1
17 1
<pre>
18 1
mkdir -p /srv/www/chiliproject
19 1
adduser --system --home /srv/www/chiliproject --group --shell /bin/sh --disabled-login chiliproject
20 1
</pre>
21 1
22 1
h2. Install Ruby and basic dependencies
23 1
24 1
Squeeze's ruby packages are sufficiently current. Most of the time, we can safely use those.
25 1
26 1
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.
27 1
28 1
h3. Variant 1: Use Debian packages
29 1
30 1
<pre>
31 1
aptitude update
32 1
aptitude install ruby rubygems
33 1
</pre>
34 1
35 1
h3. Variant 2: Use the Ruby Version Manager (RVM)
36 1
37 1
For RVM we basically need a compiler and some library dependencies and development headers.
38 1
39 1
<pre>aptitude install build-essential curl libssl-dev zlib1g-dev libreadline5-dev libxml2-dev git</pre>
40 1
41 1
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.
42 1
43 1
<pre>bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)</pre>
44 1
45 1
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.
46 1
47 1
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.
48 1
49 1
<pre>
50 1
rvm install 1.8.7
51 1
rvm use 1.8.7
52 1
rvm --default 1.8.7
53 1
</pre>
54 1
55 1
p(smallsee-also). For more information and options refer to the official "RVM installation guide":http://beginrescueend.com/rvm/install/.
56 1
57 1
h2. Install database adapter
58 1
59 1
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.
60 1
61 1
h3. Variant 1: PostgreSQL
62 1
63 1
First install the actual database.
64 1
65 1
<pre>aptitude install postgresql</pre>
66 1
67 1
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.
68 1
69 1
h4. Variant 1.1: Install adapter as Debian package
70 1
71 1
If you've installed Ruby from Debian packages follow that route and also install the database adapter via aptitude.
72 1
73 1
<pre>aptitude install libpgsql-ruby</pre>
74 1
75 1
h4. Variant 1.2: Install adapter as gem
76 1
77 1
If you've gone the RVM route install the gem.
78 1
79 1
<pre>
80 1
aptitude install libpq-dev
81 1
</pre>
82 1
83 1
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.
84 1
85 1
h3. Variant 2: MySQL
86 1
87 1
First install the actual database.
88 1
89 1
<pre>aptitude install mysql-server</pre>
90 1
91 1
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
92 1
93 1
A special ChiliProject user and the actual database is created later.
94 1
95 1
h4. Variant 2.1: Install adapter as Debian package
96 1
97 1
If you've installed Ruby from Debian packages follow that route and also install the database adapter via aptitude.
98 1
99 1
<pre>aptitude install libmysql-ruby</pre>
100 1
101 1
h4. Variant 2.2: Install adapter as gem
102 1
103 1
If you've gone the RVM route install the gem.
104 1
105 1
<pre>
106 1
aptitude install libmysqlclient-dev
107 1
</pre>
108 1
109 1
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.
110 1
111 1
h3. Variant 3: SQLite3
112 1
113 1
First install the actual database followed by the ruby adapter.
114 1
115 1
<pre>aptitude install sqlite3</pre>
116 1
117 1
h4. Variant 3.1: Install adapter as Debian package
118 1
119 1
If you've installed Ruby from Debian packages follow that route and also install the database adapter via aptitude.
120 1
121 1
<pre>aptitude install libsqlite3-ruby</pre>
122 1
123 1
h4. Variant 3.2: Install adapter as gem
124 1
125 1
If you've gone the RVM route install the gem.
126 1
127 1
<pre>
128 1
aptitude install libsqlite3-dev
129 1
</pre>
130 1
131 1
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.
132 1
133 1
h2. Install required packages for ChiliProject
134 1
135 1
Now we install the libraries that Chiliproject depends upon. Since version 2.0 we hndle all direct ChiliProject dependencies with bundler. So we need to install it. the rest of the reuired packages are installed in the next step as part of the core ChiliProject setup.
136 1
137 1
    gem install bundler
138 1
139 1
h2. Install ChiliProject
140 1
141 1
Follow the standard [[Installation#Installation]] guide. In this guide, we are going to 
142 1
143 1
* get the ChiliProject code (goes into @/srv/www/chiliproject@)
144 1
* connect it to the chosen database, and
145 1
* perform a basic [[Configuration_File|configuration]]
146 1
147 1
Once you are finished, return back here. Make sure to follow the already chosen options:
148 1
149 1
* Installation root is @/srv/www/chiliproject@
150 1
* Use the chosen database variant during database configuration
151 1
152 1
h2. Install and setup Apache2 with Passenger (mod_rails)
153 1
154 1
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.
155 1
156 1
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.
157 1
158 1
<pre>aptitude install apache2-mpm-prefork</pre>
159 1
160 1
h3. Variant 1: Installed using Debian Packages
161 1
162 1
If you have installed Ruby from packages, install the packaged passenger module.
163 1
164 1
<pre>aptitude install libapache2-mod-passenger</pre>
165 1
166 1
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:
167 1
168 1
<pre>
169 1
<IfModule mod_passenger.c>
170 1
  PassengerRoot /usr
171 1
  PassengerRuby /usr/bin/ruby
172 1
173 1
  PassengerDefaultUser chiliproject
174 1
</IfModule>
175 1
</pre>
176 1
177 1
h3. Variant 2: Installed via RVM
178 1
179 1
If you installed Ruby via RVM, install the gem instead:
180 1
181 1
<pre>
182 1
aptitude install apache2-prefork-dev libcurl4-openssl-dev
183 1
gem install passenger
184 1
passenger-install-apache2-module
185 1
</pre>
186 1
187 1
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.
188 1
189 1
The @/etc/apache2/mods-available/passenger.conf@ file should look something like this:
190 1
191 1
<pre>
192 1
<IfModule mod_passenger.c>
193 1
 PassengerRoot /usr/local/rvm/gems/ruby-1.8.7-p334/gems/passenger-3.0.3
194 1
 PassengerRuby /usr/local/rvm/wrappers/ruby-1.8.7-p334/ruby
195 1
196 1
  PassengerDefaultUser chiliproject
197 1
</IfModule>
198 1
</pre>
199 1
200 1
Finally enable the module and reload Apache.
201 1
202 1
<pre>
203 1
a2enmod passenger
204 1
/etc/init.d/apache reload
205 1
</pre>
206 1
207 1
h2. Setup the Apache virtual host
208 1
209 1
h3. Variant 1: Install ChiliProject at a virtual host's root
210 1
211 1
<pre>cat > /etc/apache2/sites-available/chiliproject <<EOF
212 1
<VirtualHost *:80>
213 1
  # TODO: Adapt the servername
214 1
  ServerName chiliproject.domain.com
215 1
  
216 1
  DocumentRoot /srv/www/chiliproject/public
217 1
  <Directory /srv/www/chiliproject/public>
218 1
    Options None
219 1
    AllowOverride None
220 1
    
221 1
    Order deny,allow
222 1
    Allow from all
223 1
  </Directory>
224 1
</VirtualHost>
225 1
EOF
226 1
</pre>
227 1
228 1
Now activate the new virtual host and reload Apache. ChiliProject will be started at the first request to @http://chiliproject.domain.com/@.
229 1
230 1
<pre>
231 1
a2ensite chiliproject
232 1
/etc/init.d/apache2 reload
233 1
</pre>
234 1
235 1
h3. Variant 2: Install ChiliProject in a sub URL
236 1
237 1
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@
238 1
239 1
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).
240 1
241 1
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.
242 1
243 1
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.
244 1
245 1
<pre>ln -s /srv/www/chiliproject/public DOCUMENTROOT/chiliproject</pre>
246 1
247 1
Now add the following directives into *your existing* virtual host:
248 1
249 1
<pre>
250 1
# TODO: Remember to replace DOCUMENTROOT with your actual path
251 1
<Directory DOCUMENTROOT>
252 1
  Options +SymLinksIfOwnerMatch
253 1
</Directory>
254 1
255 1
RailsBaseURI /chiliproject
256 1
# TODO: Remember to replace DOCUMENTROOT with your actual path
257 1
<Directory DOCUMENTROOT/chiliproject>
258 1
  Options -MultiViews
259 1
260 1
  Order deny,allow
261 1
  Allow from all
262 1
</Directory>
263 1
</pre>
264 1
265 1
Now reload Apache to enable the new configuration. ChiliProject will be started at the first request to @http://www.domain.com/chiliproject@.
266 1
<pre>/etc/init.d/apache2 reload</pre>