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 5 (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 3 Chris Dähn
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.
136 1
137 1
    gem install bundler
138 3 Chris Dähn
139 3 Chris Dähn
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.
140 1
141 5 Chris Dähn
p(smallinfo). I needed to @apt-get install ruby1.8-dev@ for bundler being able to install the json 1.6.5 gem
142 5 Chris Dähn
143 5 Chris Dähn
144 1
h2. Install ChiliProject
145 1
146 1
Follow the standard [[Installation#Installation]] guide. In this guide, we are going to 
147 1
148 1
* get the ChiliProject code (goes into @/srv/www/chiliproject@)
149 1
* connect it to the chosen database, and
150 1
* perform a basic [[Configuration_File|configuration]]
151 1
152 1
Once you are finished, return back here. Make sure to follow the already chosen options:
153 1
154 1
* Installation root is @/srv/www/chiliproject@
155 1
* Use the chosen database variant during database configuration
156 1
157 1
h2. Install and setup Apache2 with Passenger (mod_rails)
158 1
159 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.
160 1
161 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.
162 1
163 1
<pre>aptitude install apache2-mpm-prefork</pre>
164 1
165 1
h3. Variant 1: Installed using Debian Packages
166 1
167 1
If you have installed Ruby from packages, install the packaged passenger module.
168 1
169 1
<pre>aptitude install libapache2-mod-passenger</pre>
170 1
171 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:
172 1
173 1
<pre>
174 1
<IfModule mod_passenger.c>
175 1
  PassengerRoot /usr
176 1
  PassengerRuby /usr/bin/ruby
177 1
178 1
  PassengerDefaultUser chiliproject
179 1
</IfModule>
180 1
</pre>
181 1
182 1
h3. Variant 2: Installed via RVM
183 1
184 1
If you installed Ruby via RVM, install the gem instead:
185 1
186 1
<pre>
187 1
aptitude install apache2-prefork-dev libcurl4-openssl-dev
188 1
gem install passenger
189 1
passenger-install-apache2-module
190 1
</pre>
191 1
192 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.
193 1
194 1
The @/etc/apache2/mods-available/passenger.conf@ file should look something like this:
195 1
196 1
<pre>
197 1
<IfModule mod_passenger.c>
198 1
 PassengerRoot /usr/local/rvm/gems/ruby-1.8.7-p334/gems/passenger-3.0.3
199 1
 PassengerRuby /usr/local/rvm/wrappers/ruby-1.8.7-p334/ruby
200 1
201 1
  PassengerDefaultUser chiliproject
202 1
</IfModule>
203 1
</pre>
204 1
205 4 Chris Dähn
p(smallnote). The versions and locations might differ. Please use the actual configuration values from the @passenger-install-apache2-module@ script.
206 4 Chris Dähn
207 1
Finally enable the module and reload Apache.
208 1
209 1
<pre>
210 1
a2enmod passenger
211 1
/etc/init.d/apache reload
212 1
</pre>
213 1
214 1
h2. Setup the Apache virtual host
215 1
216 1
h3. Variant 1: Install ChiliProject at a virtual host's root
217 1
218 1
<pre>cat > /etc/apache2/sites-available/chiliproject <<EOF
219 1
<VirtualHost *:80>
220 1
  # TODO: Adapt the servername
221 1
  ServerName chiliproject.domain.com
222 1
  
223 1
  DocumentRoot /srv/www/chiliproject/public
224 1
  <Directory /srv/www/chiliproject/public>
225 1
    Options None
226 1
    AllowOverride None
227 1
    
228 1
    Order deny,allow
229 1
    Allow from all
230 1
  </Directory>
231 1
</VirtualHost>
232 1
EOF
233 1
</pre>
234 1
235 1
Now activate the new virtual host and reload Apache. ChiliProject will be started at the first request to @http://chiliproject.domain.com/@.
236 1
237 1
<pre>
238 1
a2ensite chiliproject
239 1
/etc/init.d/apache2 reload
240 1
</pre>
241 1
242 1
h3. Variant 2: Install ChiliProject in a sub URL
243 1
244 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@
245 1
246 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).
247 1
248 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.
249 1
250 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.
251 1
252 1
<pre>ln -s /srv/www/chiliproject/public DOCUMENTROOT/chiliproject</pre>
253 1
254 1
Now add the following directives into *your existing* virtual host:
255 1
256 1
<pre>
257 1
# TODO: Remember to replace DOCUMENTROOT with your actual path
258 1
<Directory DOCUMENTROOT>
259 1
  Options +SymLinksIfOwnerMatch
260 1
</Directory>
261 1
262 1
RailsBaseURI /chiliproject
263 1
# TODO: Remember to replace DOCUMENTROOT with your actual path
264 1
<Directory DOCUMENTROOT/chiliproject>
265 1
  Options -MultiViews
266 1
267 1
  Order deny,allow
268 1
  Allow from all
269 1
</Directory>
270 1
</pre>
271 1
272 1
Now reload Apache to enable the new configuration. ChiliProject will be started at the first request to @http://www.domain.com/chiliproject@.
273 1
<pre>/etc/init.d/apache2 reload</pre>