Skip to main content

This is a new website theme. Help me improve it and give your feedback (opens in a new tab).

Installing MediaGoblin on FreeBSD

Published:

Tags:

Hacking Foss
This blog post is more than two years old. It is preserved here in the hope that it is useful to someone, but please be aware that links may be broken and that opinions expressed here may not reflect my current views. If this is a technical article, it may no longer reflect current best practice.

GNU MediaGoblin is a web application for hosting and sharing media. At 57North Hacklab, we currently have a Flickr group but to post to Flickr it is necessary to have a Yahoo! account and this seems like an unreasonable requirement to impose on members that want to share photos. This led to me setting up MediaGoblin. Hopefully it will also be useful for sharing other forms of media beyond photos too.

The instructions for installing MediaGoblin only cover Linux environments so here is my documentation of an installation on FreeBSD.

Start off by installing some dependencies (as root):

# pkg install git python py27-lxml py27-imaging py27-virtualenv

Then install some postgresql things (as root):

# pkg install postgresql92-server postgresql92-client py27-psycopg2

Do some setup of postgresql to initialise it and make it start on boot (as root):

# echo 'postgresql_enable="YES"' >> /etc/rc.conf
# /usr/local/etc/rc.d/postgresql initdb
# /usr/local/etc/rc.d/postgresql start

Create the new postgresql user and database (as root):

# su pgsql -c "createuser mediagoblin"
# su pgsql -c "createdb -E UNICODE -O mediagoblin mediagoblin"

Create the system user (as root):

# adduser
Username: mediagoblin
Full name: MediaGoblin Unprivileged User
Uid (Leave empty for default): 201
Login group [mediagoblin]:
Login group is mediagoblin. Invite mediagoblin into other groups? []:
Login class [default]:
Shell (sh csh tcsh bash rbash zsh rzsh git-shell nologin) [sh]:
Home directory [/home/mediagoblin]: /usr/local/srv/mediagoblin
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]: no
Lock out the account after creation? [no]:
Username   : mediagoblin
Password   :
Full Name  : MediaGoblin Unprivileged User
Uid        : 201
Class      :
Groups     : mediagoblin
Home       : /usr/local/srv/mediagoblin
Home Mode  :
Shell      : /bin/sh
Locked     : no
OK? (yes/no): yes
pw: mkdir(/srv/mediagoblin): No such file or directory
adduser: INFO: Successfully added (mediagoblin) to the user database.
Add another user? (yes/no): no
Goodbye!

The next step is to actually fetch the MediaGoblin sources (as root):

# su mediagoblin
# cd ~
# git clone git://gitorious.org/mediagoblin/mediagoblin.git
# cd mediagoblin
# git submodule init && git submodule update

Then build the MediaGoblin virtualenv (as mediagoblin):

$ (virtualenv --system-site-packages . || virtualenv .) && ./bin/python setup.py develop

To deploy with FastCGI, flup is apparently useful (as mediagoblin):

$ ./bin/easy_install flup

From here, you can follow the official documentation. Just start at “Deploying MediaGoblin Services”. Do remember though that your configuration files for web servers are going to be in /usr/local/etc not /etc