1
# External dependencies
10
* [Python DNS 2.3.4](http://pydns.sourceforge.net/)
12
* [Python Imaging Library](http://www.pythonware.com/library/)
13
* [YUI Compressor](http://developer.yahoo.com/yui/compressor/), for minifying CSS/JS files
14
* [Gearman](http://www.gearman.org)
15
* [Python bindings for libgearman](http://www.launchpad.net/gearman-interface)
16
* [Python OpenID](https://github.com/openid/python-openid)
17
* [OpenID Integration for django.contrib.auth](https://launchpad.net/django-openid-auth)
18
* [HttpLib2](https://code.google.com/p/httplib2/)
19
* Python LDAP library (if using optional LDAP authenticaion)
21
On Debian unstable or squeeze:
23
apt-get install python-django python-dns libjs-jquery python2.6 python-imaging libapache2-mod-wsgi python-psycopg2 yui-compressor gearman-job-server gearman-tools python-gearman.libgearman jpegoptim optipng python-openid python-django-auth-openid python-httplib2 ca-certificates
25
apt-get install python-ldap
28
# Create your database
30
Create a database user:
32
sudo -u postgres createuser djangouser
36
sudo -u postgres createdb -O djangouser libravatar
38
Create the required tables:
40
cd /usr/share/libravatar/libravatar
41
python manage.py syncdb
43
Create an index for the sessions table (not needed for Django 1.3 or later):
45
sudo -u postrgres psql libravatar
46
CREATE INDEX "django_session_expire_date" ON "django_session" ("expire_date");
49
# Apache Configuration
51
Start by adding this to your /etc/hosts:
53
127.0.0.1 www.libravatar.org cdn.libravatar.org seccdn.libravatar.org
55
Enable mod_alias, mod\_expires, mod\_headers, mod\_rewrite and mod\_wsgi:
63
Create an uploaded/ directory that is writable by the www-data user:
65
mkdir /var/lib/libravatar/uploaded
66
sudo chgrp www-data /var/lib/libravatar/uploaded
67
sudo chmod g+w /var/lib/libravatar/uploaded
69
as well as ready/ and user/ directories which are not writable by www-data:
71
mkdir /var/lib/libravatar/ready
72
mkdir /var/lib/libravatar/user
74
Similarly, avatar/ and export directories that are only writable by root:
76
mkdir /var/lib/libravatar/avatar
77
mkdir /var/lib/libravatar/export
79
Then copy config/*.conf to /etc/apache2/sites-enabled/, adjust the
80
path to the cdn-common include file and restart Apache using:
88
A few Gearman jobs must be running to fully take care of photo management:
90
* cropresize: must run under a user that has read access to /uploaded and
91
write access to /ready
92
* ready2user: must run under a user with read access to /ready and write
93
access to /uploaded and /user
94
* changephoto: must run as root
95
* deletephoto: must run as root
96
* resizeavatar: must run as root
97
* exportaccount: must run as root
99
There are python scripts under libravatar/ for all of these functions and
100
workers can be setup like this:
102
gearman -w -f FUNCTION_NAME libravatar/FUNCTION_NAME.py
107
You should have a daily cron job which does the following:
109
* delete old sessions and exports
110
* delete old uploaded (i.e. non-cropped) files
112
Have a look in debian/libravatar-www.cron.daily for an example.
115
# Authenticating with an external LDAP server:
117
Download and install the [Django LDAP authentication backend](http://packages.python.org/django-auth-ldap/):
119
apt-get install python-django-auth-ldap
121
Then uncomment the LDAP backend line in AUTHENTICATION\_BACKENDS in your
122
settings.py and set your AUTH\_LDAP\_SERVER\_URI and AUTH\_LDAP\_USER\_DN\_TEMPLATE
123
settings to something appropriate. More complex setups are also well documented
124
in the [package documentation](http://packages.python.org/django-auth-ldap/).