Setting up a MediaGoblin instance

This post was initially a page on my wiki site, but was changed into a blog post during the last re-shuffling of my web site. Furthermore, the development of MediaGoblin is very fast so many of these things are probably outdated by now.

I’m running GNU MediaGoblin with Apache and sqlite database on my Debian squeeze VPS at media.saz.im. This page is occasionally specific to the Debian/Apache/sqlite scenario.

I followed the standard deployment documentation, skipping the parts about PostgreSQL, plus a lot of help from @paroneayea (aka @cwebber) in the #mediagoblin channel on freenode. The deployment page on the wiki also has some things about using Apache in particular.

So first I installed the dependencies:

apt-get install git-core python python-dev python-lxml \
        python-imaging python-virtualenv

Then cd to your web directory, e.g. /var/www and clone the git repository and setup the virtualenv environment like so:

git clone git://gitorious.org/mediagoblin/mediagoblin.git
cd mediagoblin

virtualenv . 
./bin/python setup.py develop

./bin/easy_install flup

Some minor compatibility problems

It turns out there are some problems with kombu 2.1.8 so we need to get the older version, as per @paroneayea’s instructions:

./bin/easy_install -UaZ celery==2.5.3
./bin/easy_install -UaZ kombu==2.1.7

Also PIL had some problems, we need to install that with JPEG support (again, thanks @paroneayea):

rm -rf lib/python2.6/site-packages/PIL*
apt-get install libjpeg-dev
./bin/easy_install PIL

FastCGI and Apache

I created the mg.fcgi file in the top level MediaGoblin directory exactly as given in http://wiki.mediagoblin.org/Deployment#FCGI_script. (Just change the /path/to/mediagoblin paths!). I also used the Apache 2 config from the same page, except I added this to the VirtualHost section to increase the upload limit for images:

FcgidMaxRequestLen 104857600

Create the database and configure

Create the database:

./bin/gmg dbupdate

Make your own config file and if you have a mail system setup disable the email_debug_mode in the mediagoblin_local.ini file.

cp mediagoblin.ini mediagoblin_local.ini

You can also change allow_registration if you want a private site. A new admin user can be added via the web interface or via the command line:

./bin/gmg adduser
./bin/gmg makeadmin your_username_here

Now if you’ve got Apache setup and restarted, everything should work fine :-)

Finally for uploading you need to have the celery thing running:

su www-data -c ./lazycelery.sh

Permissions

The easiest way is to give Apache read and write rights to everything, I prefer to give it as little as possible, and I’m still trying to figure out which files really need to be owned by www-data … :)

Posted by Mats Sjöberg.