These are the steps for installing djedna on a Ubuntu 6.06.1 LTS (Dapper Drake) machine. Specifically, a hosted server at SliceHost whose hosting services the djedna team can't recommend enough. Also, keep in mind that a large TODO on our list is to simplify and improve the installation process, so we apologize in advance for the haphazard organic instructions. Check this page for updates (and hopefully improvements) to the installation process.
1. Install python 2.4.
sudo apt-get install python2.4
2. Install Apache2 and mod_python. According to the django documentation, we'll need Apache 2.x (prefork MPM) and mod_python 3.x.
- Install Apache2 (prefork MPM).
sudo apt-get install apache2-mpm-prefork sudo apt-get install apache2-prefork-dev
- Install mod_python 3.3.1. The version of mod_python available through apt-get libapache2-mod-python on Ubuntu 6.06 is not new enough, so we'll have to download and compile it ourselves.
wget http://www.apache.org/dist/httpd/modpython/mod_python-3.3.1.tgz tar xvzf mod_python-3.3.1.tgz cd mod_python-3.3.1 sudo ./configure --with-apxs=/usr/bin/apxs2 sudo make sudo make install
3. Install postgresql and python-psycopg2. The version of psycopg available through apt-get python-psycopg is not new enough, so we'll have to download and build it ourselves.
sudo apt-get install postgresql-8.1 sudo apt-get install libpq-dev wget http://www.initd.org/pub/software/psycopg/psycopg2-2.0.6.tar.gz tar xvzf psycopg2-2.0.6.tar.gz cd psycopg2-2.0.6 sudo python setup.py build sudo python setup.py install
4. Allow local database connections. Edit the file /etc/postgresql/8.1/main/pg_hba.conf:
Comment out the line:
local all all ident sameuserby changing it to:
#local all all ident sameuserand then add the following lines:
local all all trust host all 127.0.0.1/32 trust
5. Create a djedna database user and the djedna database.
sudo -u postgres createuser -D -R -S -P djedna sudo -u postgres createdb -E utf8 -O djedna djedna
6. Install py-tagger.
wget http://media.liquidx.net/static/pytagger/pytagger-0.5.tar.bz2 bunzip2 pytagger-0.5.tar.bz2 tar xvf pytagger-0.5.tar cd pytagger-0.5 sudo python setup.py install
7. Install the Python Imaging Library.
sudo apt-get install python-imaging
8. Install subversion.
sudo apt-get install subversion
9. Install django (w00t!). Djedna uses django pre-0.97 (i.e. the development version) You can see django's more detailed instructions here.
sudo mkdir /var/django cd /var/django svn co http://code.djangoproject.com/svn/django/trunk/ django-trunk sudo ln -s /var/django/django-trunk/django /usr/lib/python2.4/site-packages/django sudo ln -s /var/django/django-trunk/django/bin/django-admin.py /usr/local/bin
10. Install djedna. These are the commands to grab the trunk.
mkdir /var/django/djedna cd /var/django/djedna mkdir djedna-trunk cd djedna-trunk svn co http://djedna.org/svn/djedna/trunk/djedna
11. Create a local djedna installation directories.
sudo touch /var/log/djedna.log sudo chown www-data:www-data /var/log/djedna.log mkdir /var/django/djedna/djedna-local cd /var/django/djedna/djedna-local mkdir my_band cd my_band touch __init__.py mkdir config touch config/__init__.py mkdir templates mkdir file mkdir cover mkdir zip mkdir media
Note: You can replace my_band with a more meaningful name (e.g. my_cool_band) if you wish. Just make sure the new name follows python module naming conventions and that you use it consistently in place of my_band in the rest of the instructions below.)
12. Configure djedna.
- Copy the default djedna/config/sample.py configuration file from the djenda trunk into your my_band directory and rename it (e.g. production.py.
cd /var/django/djedna/djedna-local/my_band cp /var/django/djedna/djedna-trunk/djedna/config/sample.py production.py
- Edit the new production.py configuration file (Note that you should replace all occurrences myband.com with the actual URL you plan on running djedna under.)
- Change the DATABASE_PASSWORD setting to the password you assigned the djedna user in step 4.
- Change the TIME_ZONE setting to the time zone of your server. Possible values can be obtained by looking in the directory /usr/share/postgresql/8.1/timezone/. The default is America/Chicago which maps to the file /usr/share/postgresql/8.1/timezone/America/Chicago.
- Change the MEDIA_ROOT setting to '/var/django/djedna/djedna-trunk/djedna/media/'
- Change the MEDIA_URL setting to 'http://myband.com/media/'
- Change the FILE_ROOT setting to '/var/django/djedna/djedna-local/my_band/file/'
- Change the COVER_ROOT setting to '/var/django/djedna/djedna-local/my_band/cover/'
- Change the ZIP_ROOT setting to '/var/django/djedna/djedna-local/my_band/zip/'
- Change the CATALOG_URL setting to 'http://myband.com/'
- Change the TEMPLATE_DIRS setting to:
TEMPLATE_DIRS = ( "/var/django/djedna/djedna-local/my_band/templates", "/var/django/djedna/djedna-trunk/djedna/templates", ) - Change the SECRET_KEY setting to a random string, the longer the better. Don't use the default one already in the config or else your djedna installation will be insecure. At the very least, change a few of the default string's characters.
- Add the following lines somewhere in the file.
INSTALL_MEDIA_URLS = (('http://myband.com/media-install/', '/var/django/djedna/djedna-local/my_band/media/'),) DISPLAY_NAME_DICTIONARY_FILE = '/var/django/djedna/djedna-local/my_band/display_names.pickle'
13. Initialize the database using the django management utilites. Note that you should replace "production" with whatever you called your config file in step 12 above.
cd /var/django/djedna/djedna-trunk/djedna/ python manage.py syncdb --settings=my_band.config.production
14. Configure apache virtual host.
- Create the virtual host config file.
sudo cd /etc/apache2/sites-available/ sudo touch myband_vhost
- Insert the following text into the myband_vhost file:
<VirtualHost *> ServerName myband.com DocumentRoot /var/django/djedna/djedna-local/my_band/media Alias /media /var/django/djedna/djedna-trunk/djedna/media Alias /media-install /var/django/djedna/djedna-local/my_band/media Alias /catalog/cover /var/django/djedna/djedna-local/my_band/cover Alias /catalog/zip /var/django/djedna/djedna-local/my_band/zip Alias /catalog/file /var/django/djedna/djedna-local/my_band/file Alias /admin-media /var/django/django-trunk/django/contrib/admin/media <Directory /var/django/djedna/djedna-trunk/djedna/media> Options Indexes FollowSymLinks MultiViews Order allow,deny Allow from all </Directory> <Directory /var/django/djedna/djedna-local/my_band/media> Options Indexes FollowSymLinks MultiViews Order allow,deny Allow from all </Directory> <Directory /var/django/djedna/djedna-local/my_band/file> Options Indexes FollowSymLinks MultiViews Order allow,deny Allow from all </Directory> <Location "/"> SetHandler python-program PythonHandler django.core.handlers.modpython PythonPath "['/var/django/djedna/djedna-trunk/','/var/django/djedna-local',] + sys.path" SetEnv DJANGO_SETTINGS_MODULE my_band.config.production PythonDebug On </Location> <Location "/catalog/file"> PythonPath "['/var/django/djedna/djedna-trunk/','/var/django/djedna-local',] + sys.path" PythonOption DJANGO_SETTINGS_MODULE my_band.config.production PythonAccessHandler djedna.catalog.modpython_trackfile SetHandler None Order allow,deny Allow from all </Location> <Location "/catalog/zip"> PythonPath "['/var/django/djedna/djedna-trunk/','/var/django/djedna-local',] + sys.path" PythonOption DJANGO_SETTINGS_MODULE my_band.config.production PythonAccessHandler djedna.catalog.modpython_zipfile SetHandler None Order allow,deny Allow from all </Location> <Location "/static"> SetHandler None </Location> <Location "/media"> SetHandler None </Location> <Location "/media-install"> SetHandler None </Location> <Location "/catalog/cover"> SetHandler None </Location> <Location "/error"> SetHandler None </Location> <Location "/admin-media"> SetHandler None </Location> ErrorLog /var/log/apache2/error.myband.log CustomLog /var/log/apache2/access.myband.log combined </VirtualHost> - Create the symbolic link to activate the new config.
sudo ln -s /etc/apache2/sites-available/myband_vhost /etc/apache2/sites-enabled/myband_vhost
15. Change file permissions.
sudo chown -R www-data:www-data /var/django/djedna/djedna-local/my_band sudo chmod -R 755 /var/django/djedna/djedna-local/my_band
16. Restart apache.
sudo /etc/init.d/apache2 restart
17. Make sure the installation works by pointing your browser to http://myband.com/
18. Populate data
Go to town. See PopulateDb.
