Installation Guide¶
Contents
This document will walk you through an install of Infandango on a clean install of Ubuntu 11.10. There are also hints for Fedora and MacOS X,
Install Prerequisite Packages¶
- You will need the following packages:
- Mercurial
- Django (1.3)
- python-xlwt (Python libraries for reading/writing excel files for csv output) (which needs matplotlib...)
- Beautiful Soup (python-beautifulsoup)
- Postgresql
- Postgres python bindings (psycopg2)
- Cheetah
- Pygments
- Sphinx
- Latex (pdflatex) [For rendering formula; the base is not enough, because it won’t contain utf8x.def ]
- dvipng [for displaying equations]
- Java JRE & junit4
- MathJax
- reportlab
Todo
Divide list into Python vs the rest? Give links to PyPi? Pull out Ubuntu-specific instructions.
Todo
Check: Do we need dvipng and MathJax??
Debian/Ubuntu¶
If you are running a Debian/Ubuntu variant, most of this can be installed with apt.
$ sudo apt-get install python-django python-beautifulsoup \
python-cheetah python-pygments python-sphinx \
mercurial \
postgresql python-psycopg2 \
texlive-latex-base texlive-latex-extra dvipng
texlive-fonts-recommended \
openjdk-6-jre junit4 openjdk-6-jdk \
python-xlwt \
python-matplotlib \
Fedora¶
An installation was successfully created on Fedora. The following packages were installed; some may be unnecessary.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
texlive, texlive-latex, and many related packages were also installed.
MacOS X¶
If running MacOS, most of the packages can be obtained from from MacPorts. We’ll assume that you are using python27 as your base installation, in which case something like the following should work:
$ sudo port install py27-django py27-beautifulsoup \
py27-cheetah py27-sphinx py27-matplotlib \
mercurial dvipng
It is advisable to use this One Click Installer for PostgreSQL (which includes the handy pgAdmin) rather than installing from MacPorts. After you have installed PostgreSQL, get xlwt and psycopg2 from http://pypi.python.org (otherwise MacPorts will try to re-install PostgreSQL as a dependency):
$ easy_install xlwt psycopg2
The best way to install LaTeX is to download the latest TeXLive release from MacTex.
Before installing MathJax, set up your local repository for Infandango first, as described next.
Clone the Repository¶
Clone the Infandango repository into a suitable directory on your
local machine,
such as /home/myaccount/hg. In what
follows, we’ll use <inf> to refer to this directory.
$ cd /home/myaccount/hg
$ hg clone ssh://hg@bitbucket.org/ewan/infandango
This will create a new directory /home/myaccount/hg/infandango.
Set environmental variables¶
We need to add the command Infandango (which is actually an
alias) to your shell PATH and to the PYTHONPATH. We also
need to point to the infandango directory, so that lots of
things happen automatically. Put the following in your shell
startup file, e.g. ~/.bashrc:
export INFANDANGO_ROOT="<inf>/infandango/"
export INFANDANGO_CONFIGFILE="<inf>/infandango/examples/sample_config/infandango_conf.py"
# Add infandango to your executable path
export PATH="$PATH:$INFANDANGO_ROOT:"
In these instructions, replace <inf> by the full path of the
directory into which you cloned the Infandango repository, e.g.,
/home/myaccount/hg. The files in
infandango/examples/sample_config are a subset of those used
for the University of Edinburgh’s INF1-OP course.
Source the ~/.bashrc to apply the changes:
$ source ~/.bashrc
Now if you run the command Infandango, you should be told that the database is not set up properly.
Install MathJax¶
You can install MathJax anywhere convenient. Let’s assume
you put it in the directory ~/mjx. First off, download the
code from github:
$ cd ~
$ mkdir mjx
$ cd mjx
$ git clone git://github.com/mathjax/MathJax.git MathJax
In order for Infandango to find MathJax, add a symbolic link to Infandango’s Javascript directory, as follows:
$ cd <inf>/infandango/src/labs/frontend/infandango-fe/static/javascript/
$ ln -s ~/mjx/MathJax/ mathjax
Add your machine’s hostname to the configuration:¶
For both development and deployment, Infandango is run on many machines under various software configurations. When developing locally, it is convienient to using the included Django web browser and sqlite, but on the production server we use Apache and PostgreSQL. To allow everything to work, configuration is based on hostname. You can find the hostname of your machine by typing the command hostname at a terminal.
Put this hostname (as a quoted string) into the list which is assigned as value of the variable
development_hosts in $INFANDANGO_ROOT/src/labs/infandango/locations.py.
Install PostgreSQL¶
Infandango stores all of its information in a database called infandango_new, which is accessed through two usernames wango and jester. The passwords are both the same as the usernames. The steps differ according to operating system.
Ubuntu¶
If you are running under Ubuntu, you will need to do the following.
- Edit the
pg_hba.conffile to allow local password logins:
$ sudo gvim /etc.postgresql/9.1/main/pg_hba.conf
- Change the line near the bottom to accept local connections with passwords:
<FROM:> local all all peer
<TO:> local all all md5
- Then reload PostgreSQL:
$ sudo /etc/init.d/postgresql restart
MacOS X¶
The pg_hba.conf is already configured correctly if you use the
MacOS X package for PostgreSQL recommended above.
Fedora¶
The steps above are not required on Fedora; however PostgreSQL will not be configured to start automatically after installation, so must be started manually. For example,
$ su - postgres
$ /usr/bin/postgres -D /var/lib/pgsql/data
Set up the PostgreSQL database¶
You will need to add the users wango and jester to the database. You can do this via the command-line as follows:
$ sudo -u postgres createuser wango
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n
$ sudo -u postgres createuser jester
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n
You can also add these users via the pgAdmin GUI.
Now change the password for the PostgreSQL superuser and the two new users:
$ sudo -u postgres psql
postgres=# \password postgres
<type in password of your choice>
postgres=# \password wango
wango
postgres=# \password jester
jester
Next, create the infandango_new database:
# Exit back to shell & create the database:
$ createdb -U wango -O wango infandango_new
Again, you can also do this via pgAdmin.
Finally, tell Infandango to create the database structure:
# Load up the tables into the database
$ Infandango development rebuilddb
On Ubuntu, to avoid having to type the password for the database, you can make a file ~/.pgpass.
$ gvim ~/.pgpass
$ # add the line *:*:*:wango:wango
$ chmod 600 ~/.pgpass
$ cat ~/.pgpass
*:*:*:wango:wango
This is unnecessary on Fedora.
Start the development server¶
We assume that you will run the development version of infandango using the Django server:
$ Infandango development server &
Once the server has started, you can point your browser towards:
http://locahost:8000.
Only registered users are able to access Infandango through the front
end. The list of users is controlled by the files
<inf>/infandango/examples/sample_config/students.csv and
<inf>/infandango/examples/sample_config/tutors.csv.
$ cat students.csv
"UserName","TutGrpId","Jim","Smith"
"UserName2","TutGrpId2","Bob","Johnson"
"sTest","Tutors","Test","User"
The fields in these files are specific to the University of Edinburgh’s INF1-OP course and for development purposes, the only crucial field is the first one, which determines the user’s username.
Jester¶
Jester is the Java tester plugin for Infandango and runs JUnit 4 tests over Java code that is submitted.
Configure Jester¶
Grant Jester the necessary database permissions
$ Infandango jester grant
$ Password: <sudo password for host>
$ could not identify current directory: Permission denied
$ Password: <postgres password>
Running Jester Locally¶
To run the Jester server use:
$ Infandango jester run
When Jester has no work to be done, its threads sleep while waiting for new submissions. When a new submission is made, Infandango will notify Jester that there is work to be done automatically. However, if you need to do this manually on an already running server, you can give the following command:
$ Infandango jester signal