~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to doc/man/install.rst

  • Committer: David Coles
  • Date: 2010-08-30 03:26:13 UTC
  • Revision ID: coles.david@gmail.com-20100830032613-d14vng0jkelniu3l
python-console: Fix globals broken with new JSON library.

simplejson always returns unicode strings. cJSON would return ordinary strings 
if possible. cPickle.loads() only accepts strings. At present we use pickle 
version 0 so they should all works as ASCII strings. Higher versions of pickle 
are not plain ASCII and are likely to break this and so this should be fixed 
at some point.

Also replaced unconditional exception with one that catches Pickle errors. Not 
sure the best way to report failures of these functions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
   along with this program; if not, write to the Free Software
16
16
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
17
 
 
18
.. _ref-install:
 
19
 
18
20
************
19
21
Installation
20
22
************
26
28
might work too. Debian/Ubuntu package names are given after the name of the
27
29
software.
28
30
 
29
 
.. If this list changes, you also need to change the list below.
 
31
.. If this list changes, you also need to change the list below, and
 
32
   the list in bin/ivle-dev-setup.
30
33
 
31
 
* Ubuntu 8.04 or later (other distros should work with some tweaking, but are untested)
 
34
* Ubuntu 8.04 LTS or later (other distros should work with some tweaking, but are untested)
32
35
* Apache 2.x (``apache2``) with modules:
33
36
   + mod_python (``libapache2-mod-python``)
34
37
   + mod_dav_svn and mod_authz_svn (``libapache2-svn``)
35
38
* Python 2.5 (``python2.5``) or 2.6 (``python2.6``) with modules:
36
 
   + cjson (``python-cjson``)
37
39
   + ConfigObj (``python-configobj``)
38
40
   + docutils (``python-docutils``)
39
41
   + epydoc (``python-epydoc``)
41
43
   + Genshi (``python-genshi``)
42
44
   + psycopg2 (``python-psycopg2``)
43
45
   + pysvn (``python-svn``)
44
 
   + Routes (``python-routes``)
45
46
   + Storm (``python-storm``)
 
47
   + simplejson (``python-simplejson``, for Python 2.5 only)
46
48
* jQuery (``libjs-jquery``)
 
49
* CodeMirror (``libjs-codemirror``)
47
50
* PostgreSQL 8.3 or later (``postgresql``)
48
51
* Subversion (``subversion``)
49
52
* debootstrap (``debootstrap``)
53
56
Master versus slave servers
54
57
===========================
55
58
 
56
 
Installing from a Debian package
57
 
================================
 
59
IVLE is normally deployed in a cluster of several machines, split into
 
60
two different roles: master and slave.
 
61
 
 
62
There must be exactly one master server per cluster. The master normally
 
63
runs the PostgreSQL database server, the Subversion server, and the IVLE User
 
64
Management Server (``ivle-usrmgt-server``). It might also export shared data
 
65
directories to the slaves over NFS.
 
66
 
 
67
There may be any number of slaves in a cluster. They run the IVLE web
 
68
application, which also starts console host processes. Each slave makes use
 
69
of the shared services on the master.
 
70
 
 
71
For a small instance a slave may be run on the same machine as the master.
 
72
This is the setup described in the source installation section, while the
 
73
Ubuntu package installation section describes a multi-node configuration.
 
74
 
58
75
 
59
76
Installing from source
60
77
======================
61
78
 
62
 
.. If this list changes, you also need to change the list above.
 
79
When setting up a development IVLE environment on Ubuntu 10.04 LTS or later,
 
80
there are scripts to automate most of the process. First get and extract
 
81
`a release tarball <https://launchpad.net/ivle/+download>`_, or check out
 
82
the latest code from the Bazaar branch: ::
 
83
 
 
84
   bzr get lp:ivle
 
85
 
 
86
This will create a new directory, ``ivle``, containing a pristine
 
87
source tree. The remaining steps assume that you are in this new
 
88
directory.
 
89
 
 
90
One of IVLE's dependencies (``libjs-codemirror``) does not yet have an
 
91
official Ubuntu package. To make this dependency package available, add
 
92
the production PPA, and update your local package cache: ::
 
93
 
 
94
   sudo add-apt-repository ppa:unimelb-ivle/production
 
95
   sudo apt-get update
 
96
 
 
97
Alternatively, manually obtain and install ``libjs-codemirror``.
 
98
 
 
99
 
 
100
Automated setup
 
101
---------------
 
102
 
 
103
The ``ivle-dev-setup`` script will configure PostgreSQL, Apache, IVLE
 
104
and the filesystem to cooperate, getting you most of the way to a
 
105
working system in just one step: ::
 
106
 
 
107
   bin/ivle-dev-setup
 
108
 
 
109
.. warning::
 
110
   This reconfigures parts of your system, and has the potential to
 
111
   break other applications using Apache or PostgreSQL. It may also
 
112
   fail to execute if you have existing incompatible configurations
 
113
   of those services.
 
114
   
 
115
 
 
116
This may take a few minutes, and will ask you to confirm installation
 
117
of the dependency packages.
 
118
 
 
119
Upon completion, you must build a self-contained jail in which to run
 
120
untrusted user code. ``ivle-dev-setup`` will have configured most of
 
121
the necessary settings, but you may wish to use a local Ubuntu mirror
 
122
to improve speed or minimise download costs. If you don't wish to use
 
123
a special mirror, you may omit the first step. ::
 
124
 
 
125
   sudo ivle-config --jail/mirror http://url.to.mirror/ubuntu
 
126
   sudo ivle-buildjail -r
 
127
 
 
128
.. warning::
 
129
   ``ivle-buildjail`` will download a large volume of package data --
 
130
   potentially some hundreds of megabytes.
 
131
 
 
132
``ivle-buildjail`` will download, unpack and install a minimal Ubuntu
 
133
system and configure it for IVLE usage. This could take a while.
 
134
 
 
135
Once the jail has been successfully built, IVLE is up and running,
 
136
but with no user accounts or other data in place. For development
 
137
or demonstration purposes, sample data (including fictitious users,
 
138
subjects, and projects) can be loaded.
 
139
 
 
140
For other environments, it may be more appropriate to start with an
 
141
empty database and just create users as required.
 
142
 
 
143
To load the sample data: ::
 
144
 
 
145
   sudo ivle-loadsampledata examples/db/sample.sql
 
146
 
 
147
.. warning::
 
148
   If you answer 'yes' to the ``ivle-loadsampledata`` prompt, any
 
149
   existing data in your IVLE database will be **permanently
 
150
   destroyed**.
 
151
 
 
152
... or to add a new admin user: ::
 
153
 
 
154
   sudo ivle-adduser --admin -p password username 'Full Name'
 
155
 
 
156
You should then be able to browse to http://ivle.localhost/, and
 
157
log in with username ``admin`` and password ``password``, or the
 
158
username and password that you gave to ``ivle-adduser``.
 
159
 
 
160
 
 
161
Manual steps
 
162
------------
 
163
 
 
164
If the automatic installation scripts do not work, or if you want more
 
165
control over the whole process, these manual steps are probably for
 
166
you. But you need not read this section at all if you were able to log
 
167
in after following the steps above.
 
168
 
 
169
.. If this list changes, you also need to change the list above, and
 
170
   the command in bin/ivle-dev-setup.
63
171
 
64
172
If you want to grab all of the required packages in one command, use::
65
173
 
66
174
    sudo apt-get install apache2 libapache2-mod-python libapache2-svn \
67
 
    python2.6 python-cjson python-configobj python-docutils python-epydoc \
68
 
    python-formencode python-genshi python-psycopg2 python-svn python-routes \
69
 
    python-storm libjs-jquery postgresql subversion debootstrap rsync \
 
175
    python2.6 python-configobj python-docutils python-epydoc \
 
176
    python-formencode python-genshi python-psycopg2 python-svn python-storm \
 
177
    libjs-jquery libjs-codemirror postgresql subversion debootstrap rsync \
70
178
    build-essential
71
179
 
72
 
While installing from a distribution package is often a better idea for
73
 
users, developers will need to install from a plain source tree.
74
 
 
75
 
To get the tree, either grab and extract a release tarball, or get the
76
 
very latest code using bzr: ::
77
 
 
78
 
   bzr get lp:ivle
79
 
 
80
 
You should then change into the new source directory.
81
 
 
82
180
As IVLE needs to compile some binaries, you must first build, then
83
 
install it: ::
 
181
install it. From the source directory created earlier: ::
84
182
 
85
183
   ./setup.py build
86
184
   sudo ./setup.py install
87
185
 
88
 
Unlike the package, you will have to manually set up the database and
89
 
configuration.
 
186
.. _database-setup:
 
187
 
 
188
Setting up the database
 
189
~~~~~~~~~~~~~~~~~~~~~~~
90
190
 
91
191
First, it is recommended that you create a separate database user for IVLE.
92
192
You may use any name for the user. ::
111
211
   sudo ivle-config
112
212
 
113
213
 
114
 
Basic configuration
115
 
===================
116
 
 
117
 
.. Note: Place here only the configuration required to get the system
118
 
   installed and running. Any further configuration should go in config.rst.
 
214
Creating the data tree
 
215
~~~~~~~~~~~~~~~~~~~~~~
119
216
 
120
217
IVLE needs a directory hierarchy in which to store filesystem data, which
121
218
by default lives in ``/var/lib/ivle``. Create it now. ::
124
221
 
125
222
 
126
223
Configuring the jail environment
127
 
--------------------------------
 
224
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
128
225
 
129
226
You will require a self-contained jail environment in which to safely
130
227
execute student code. 
136
233
   devmode = True
137
234
   suite = jaunty # Replace this with the codename of your Ubuntu release.
138
235
   mirror = http://url.to.archive/mirror # Replace with a fast Ubuntu mirror.
139
 
   extra_packages = python-configobj, python-svn, python-cjson
140
236
 
141
237
.. TODO: Move this around a bit, as the config options required differ for
142
238
   the packaged version.
147
243
 
148
244
   sudo ivle-buildjail -r
149
245
 
 
246
 
150
247
Configuring Apache
151
 
------------------
 
248
~~~~~~~~~~~~~~~~~~
152
249
 
153
250
IVLE makes use of two Apache virtual hosts: one for the application itself,
154
251
and one for the Subversion services. There are example configuration files
155
252
in ``examples/config/apache.conf`` and ``examples/config/apache-svn.conf``,
156
 
which will run IVLE at ``http://ivle.localhost/``.
 
253
which will run IVLE at http://ivle.localhost/.
157
254
 
158
255
On a Debian or Ubuntu system, just copy those two files into
159
256
``/etc/apache2/sites-available`` under appropriate names (eg. ``ivle`` and
165
262
 
166
263
 
167
264
Configuring hostname resolution
168
 
--------------------------------
 
265
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
169
266
 
170
267
All of IVLE's hostnames need to be resolvable from the local system. For a
171
268
production environment, this would be done in DNS. For a development system,
184
281
 
185
282
 
186
283
Configuring the user management server
187
 
--------------------------------------
 
284
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
188
285
 
189
286
You need to have the IVLE user management server (``usrmgt-server``) running
190
287
for many parts of IVLE to operate properly, so it should be configured to
198
295
 
199
296
 
200
297
Creating the initial user
201
 
-------------------------
 
298
~~~~~~~~~~~~~~~~~~~~~~~~~
202
299
 
203
300
The final step in getting a usable IVLE set up is creating a user. You'll
204
301
probably want admin privileges - if not, drop the ``--admin``. ::
205
302
 
206
 
   sudo ivle-adduser --admin -p password username 'Full Name'
 
303
   sudo ivle-adduser --admin -p PASSWORD USERNAME 'FULL NAME'
207
304
 
208
 
You should then be able to browse to ``http://ivle.localhost/``, and
 
305
You should then be able to browse to http://ivle.localhost/, and
209
306
log in with that username and password.
210
307
 
 
308
*Alternatively*, you may wish to import the IVLE sample data, for a complete
 
309
working IVLE environment (not for production use). See :ref:`sample-data`.
 
310
 
211
311
.. note::
212
312
   For more advanced configuration, see :ref:`Configuring IVLE
213
313
   <ref-configuring-ivle>`.
 
314
 
 
315
 
 
316
 
 
317
Installing from an Ubuntu package
 
318
=================================
 
319
 
 
320
IVLE is packaged in `a Launchpad PPA <https://launchpad.net/~unimelb-ivle/+archive/production>`_,
 
321
providing a more managed installation and upgrade mechanism than a source
 
322
installation.
 
323
 
 
324
These instructions document the process to install a production-ready
 
325
multi-node IVLE cluster. They expect that you have three domain names:
 
326
one for the main IVLE web UI, one for the Subversion service, and one
 
327
for serving user files publicly.
 
328
 
 
329
.. warning::
 
330
   By design the public domain may have arbitrary user-generated content
 
331
   served. Because of this, it should not have any domain with sensitive
 
332
   cookies as a suffix, including the main IVLE web UI. Be very careful
 
333
   with your choice here.
 
334
 
 
335
 
 
336
Shared setup
 
337
------------
 
338
 
 
339
All master and slave nodes need to have access to the IVLE PPA.
 
340
`Visit it <https://launchpad.net/~unimelb-ivle/+archive/production>`_ and
 
341
follow the installation instructions on all involved systems.
 
342
 
 
343
 
 
344
Master setup
 
345
------------
 
346
 
 
347
Setting up the database server
 
348
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
349
 
 
350
The master server runs the central IVLE PostgreSQL database. ::
 
351
 
 
352
   sudo apt-get install postgresql
 
353
 
 
354
Ubuntu's default PostgreSQL configuration doesn't permit remote access,
 
355
so we need to tweak it to allow password access from our slave. In
 
356
``/etc/postgresql/8.3/main/postgresql.conf``, find the ``listen_addresses``
 
357
option, and ensure it is set to ``*``. In
 
358
``/etc/postgresql/8.3/main/pg_hba.conf`` add a line like the following to the
 
359
end. This example will allow any host in the ``1.2.3.4/24`` subnet to
 
360
authenticate with a password as the ``ivle`` user to the ``ivle`` database. ::
 
361
 
 
362
   host    ivle        ivle        1.2.3.4/24      md5
 
363
 
 
364
Then restart PostgreSQL, and the slaves should be able to see the database. ::
 
365
 
 
366
   sudo /etc/init.d/postgresql-8.3 restart
 
367
 
 
368
 
 
369
Installing and configuring IVLE
 
370
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
371
 
 
372
We can now install IVLE. The installation process will ask you a few questons.
 
373
Answer that this host is a **master**, let it generate a random usrmgt-server
 
374
secret, elect to manage the database with ``dbconfig-common``, and use a
 
375
random password. ::
 
376
 
 
377
   sudo apt-get install ivle
 
378
 
 
379
Once that's done, we have a couple of additional configuration items to set:
 
380
the URLs discussed earlier. Open up ``/etc/ivle/ivle.conf``, 
 
381
and replace ``public.ivle.localhost`` and ``svn.ivle.localhost`` with the
 
382
correct domain names.
 
383
 
 
384
Make sure you restart the ``usrmgt-server`` afterwards, or newly created users
 
385
may inherit the old domain names. ::
 
386
 
 
387
   sudo /etc/init.d/usrmgt-server restart
 
388
 
 
389
 
 
390
Sharing data between the servers
 
391
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
392
 
 
393
As well as its relational database, IVLE has a data hierarchy on the
 
394
fileystem. Two part of this (``/var/lib/ivle/jails`` and
 
395
``/var/lib/ivle/sessions``) must be shared between the master and all of the
 
396
slaves. It doesn't matter how you achieve this, but a reasonable method is
 
397
described here: exporting over NFS from the master.
 
398
 
 
399
We'll first create a tree (``/export/ivle`` in this example, but it can be
 
400
whatever you want) to be exported to the slaves, move the existing data
 
401
directories into it, and symlink them back into place. ::
 
402
 
 
403
   sudo mkdir /export/ivle
 
404
   sudo mv /var/lib/ivle/{sessions,jails} /export/ivle
 
405
   sudo ln -s /export/ivle/{sessions,jails} /var/lib/ivle
 
406
 
 
407
Next install an NFS server. ::
 
408
 
 
409
   sudo apt-get install nfs-kernel-server
 
410
 
 
411
Now we can export the directory we created earlier across the network.
 
412
Add something like the following line to ``/etc/exports``. ``someslave``
 
413
should be replaced with the hostname, IP address, or subnet of your
 
414
slave(s). ::
 
415
 
 
416
   /export/ivle         someslave(rw,sync)
 
417
 
 
418
Make sure you inform the kernel of the new export. ::
 
419
 
 
420
   sudo exportfs -a
 
421
 
 
422
 
 
423
Configuring Apache
 
424
~~~~~~~~~~~~~~~~~~
 
425
 
 
426
The master serves Subversion repositories through Apache on the Subversion
 
427
domain name that was discussed above. ::
 
428
 
 
429
   sudo cp /usr/share/doc/ivle/apache-svn.conf /etc/apache2/sites-available/ivle-svn
 
430
   sudo a2ensite ivle-svn
 
431
 
 
432
Edit ``/etc/apache2/sites-available/ivle-svn``, ensuring that the
 
433
``ServerName`` matches your chosen domain name. Then reload Apache's
 
434
configuration. ::
 
435
 
 
436
   sudo /etc/init.d/apache2 reload
 
437
 
 
438
 
 
439
Setting up a jail environment
 
440
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
441
 
 
442
IVLE requires that a base jail be provided, on top of which all of the
 
443
individual user jails are constructed in order to safely execute user code.
 
444
 
 
445
We need to change some configuration options before we can build a working
 
446
jail. First set the mirror and Ubuntu release -- make sure you replace the
 
447
URL and release code name with an Ubuntu mirror and your Ubuntu release. ::
 
448
 
 
449
   sudo ivle-config --jail/mirror http://url.to.mirror/ubuntu --jail/suite hardy
 
450
 
 
451
Now comes the ugly bit: we need to tell the jail builder where to get the
 
452
IVLE code that must be present in the jail. If you're using the production
 
453
PPA, the following ``/etc/ivle/ivle.conf`` snippet will work. If you're not,
 
454
you'll have to replace the ``extra_keys`` and ``extra_sources`` values ::
 
455
 
 
456
   [jail]
 
457
   extra_keys = '''
 
458
   -----BEGIN PGP PUBLIC KEY BLOCK-----
 
459
   Version: SKS 1.0.10
 
460
   
 
461
   mI0ES2pQKAEEANiscebT7+SFnvpN8nABcwT5nEV6psUOF8CcIIrz3iv6b6wA3lYd0DzbD7RD
 
462
   fs1MNriEHHgqPF6EUhGrkk1165Oqi+lULdjgL0Fzi3GFvLV9F8+BtL3wt3+MM7YC+aTS1nhF
 
463
   dQcPpnhNAJagW5gR4dIc4w87sNquxgCdJeJn/N3XABEBAAG0KkxhdW5jaHBhZCBVbml2ZXJz
 
464
   aXR5IG9mIE1lbGJvdXJuZSBJVkxFIFBQQYi2BBMBAgAgBQJLalAoAhsDBgsJCAcDAgQVAggD
 
465
   BBYCAwECHgECF4AACgkQVwp7ATtnautCMgP8C6PbLNyx9akgbiwhakFfGaEbxGFCo1EAUE7v
 
466
   FgdelJSEkeQLAn4WoANpixuojNi++PEDis22S4tz+ZC6G0dRU9Pcc1bb4xUgphR83QTcufH7
 
467
   5EagfTf5lLIWaLdg5f/NeuHHrKvwKvPVkNJ3ShQejFB/xWGpqe2Rr7Rscm9lT0Q=
 
468
   =TJYw
 
469
   -----END PGP PUBLIC KEY BLOCK-----
 
470
   '''
 
471
   extra_packages = ivle-services,
 
472
   extra_sources = deb http://ppa.launchpad.net/unimelb-ivle/production/ubuntu hardy main,
 
473
 
 
474
Now we can build the jail. This will download lots of packages, and install
 
475
a minimal Ubuntu system in ``/var/lib/ivle/jails/__base__``. ::
 
476
 
 
477
   sudo ivle-buildjail -r
 
478
 
 
479
You should now have a functional master.
 
480
 
 
481
 
 
482
Creating the initial user
 
483
~~~~~~~~~~~~~~~~~~~~~~~~~
 
484
 
 
485
The last master step for getting a usable IVLE set up is creating a user.
 
486
You'll probably want admin privileges - if not, drop the ``--admin``. ::
 
487
 
 
488
   sudo ivle-adduser --admin -p PASSWORD USERNAME 'FULL NAME'
 
489
 
 
490
You can then visit your IVLE web UI domain and login in with the username
 
491
and password.
 
492
 
 
493
 
 
494
Slave setup
 
495
-----------
 
496
 
 
497
Installing and configuring IVLE
 
498
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
499
 
 
500
We need to tell the database configuration assistant that we want to connect
 
501
to a remote database. The second command will also ask you whether you want to
 
502
store administrative passwords: say no here. ::
 
503
 
 
504
   sudo apt-get install dbconfig-common
 
505
   sudo dpkg-reconfigure dbconfig-common
 
506
 
 
507
We are going to need some details from the master for authentication purposes.
 
508
Grab the ``password`` value from the ``database`` section, and the ``magic``
 
509
value from the ``usrmgt`` section of the master's ``/etc/ivle/ivle.conf``.
 
510
 
 
511
Now we can install IVLE. Advise the installer that this machine is not a
 
512
master, and use the details retrieved from the master to answer the rest of
 
513
the questions. ::
 
514
 
 
515
   sudo apt-get install ivle
 
516
 
 
517
Once the installation has completed, make the same configuration changes as on
 
518
the master: set the domain names in ``ivle.conf`` to real values.
 
519
 
 
520
For maximum performance, you should also set the ``version`` value in the
 
521
``media`` section. The exact string is not important, as long as the value is
 
522
identical on every slave, and changed on each upgrade. It is used to make
 
523
static file URLs unique, so clients can cache them indefinitely. The IVLE
 
524
version is conventionally used as this string.
 
525
 
 
526
 
 
527
Getting access to the shared data
 
528
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
529
 
 
530
We need to mount the shared components of the IVLE data hierarchy from the
 
531
master. If you've used the suggested method, follow these instructions.
 
532
Otherwise you'll have to work it out for yourself.
 
533
 
 
534
First install the NFS common utilities, required for NFS mounts. ::
 
535
 
 
536
   sudo apt-get install nfs-common
 
537
 
 
538
Now we can add the mount to ``/etc/fstab``. Something like this should do: ::
 
539
 
 
540
  themaster:/export/ivle /export/ivle nfs defaults 0 0
 
541
 
 
542
Then mount the filesystem, and link the shared directories into the
 
543
hierarchy. ::
 
544
 
 
545
   mount -a
 
546
   ivle-createdatadirs
 
547
   rmdir /var/lib/ivle/{sessions,jails}
 
548
   ln -s /export/ivle/{sessions,jails} /var/lib/ivle
 
549
 
 
550
 
 
551
Configuring Apache
 
552
~~~~~~~~~~~~~~~~~~
 
553
 
 
554
The slaves use Apache to serve the main IVLE web UI and public user files.
 
555
Let's activate the configuration now. ::
 
556
 
 
557
   sudo cp /usr/share/doc/ivle/apache.conf /etc/apache2/sites-available/ivle
 
558
   sudo a2ensite ivle
 
559
 
 
560
Now edit ``/etc/apache2/sites-available/ivle``, and ensure that the
 
561
``ServerName`` matches your chosen IVLE web UI domain name, and
 
562
``ServerAlias`` your public name. Then reload Apache's configuration. ::
 
563
 
 
564
   sudo /etc/init.d/apache2 reload