Share media on your own network

Central Exchange

© Lead Image © maksym-yemelyanov,

© Lead Image © maksym-yemelyanov,

Article from Issue 170/2015

MediaGoblin lets users share movies, audio files, and other documents off the beaten track of popular platforms. In this article, we show admins how to integrate the application into a local network and examine whether it is a good replacement for YouTube, Flickr, and SoundCloud.

Internet users today share movies on YouTube, photos on Flickr, and sound material on SoundCloud. The services are mainly hosted by US corporations. If you upload movies and photos to the platforms, you thus lose control over them. Data protection laws in other countries do not apply here, which is why many local companies prefer not to use the services.

GNU MediaGoblin [1] seeks to provide a remedy. In the style of YouTube and Flickr, the web application hosts movies, images, and other media files; it can be run on its own server and is thus useful as a media platform for the intranet. Additionally, if you want to build a movie and media archive, the web application can also help you do so.

Show Me!

MediaGoblin works like a wiki for media: Users rely on a form to upload movies, audio files, and other media. They can then add metadata, such as descriptions, key words, or licensing information. Other users can view or play the files directly in the browser and add comments. MediaGoblin supports downloading of movies and audio files in multiple file formats; the web application automatically transcodes the media files in the background.

Additionally, MediaGoblin also manages other document formats (e.g., PDF documents or 3D graphics). Visitors can view a preview directly in the browser, assuming the browser supports WebGL. The PDF.js framework displays PDF files. The file formats supported by MediaGoblin are listed in Table  1. If you install LibreOffice and its utility unoconv on the server, MediaGoblin automatically converts many other file formats (e.g., Word and Excel documents) into PDF files after uploading.

Developers can use plugins to extend the functionality of MediaGoblin, and themes let you modify the appearance of the user interface. MediaGoblin is an official GNU project and is licensed under the AGPLv3. The developers have put all media supplied with the program, such as logos and images, under the Creative Commons License 0 (Version 1.0) Universal and thus released them into the public domain.

Slow Start

Work on MediaGoblin started back in the spring of 2011. To accelerate development, the first fundraising campaign was launched in October 2012. This effort finally generated around $45,000 – enough to pay the maintainer, Chris Webber, for one year. However, new versions were released only in homeopathic doses; at the end of 2013, it even seemed as if development had completely stopped.

In March 2014, the project initiated a new fundraising campaign, and its income should be enough to support development of version 1.0 [2]. Although the nearly $65,000 collected exceeded the target amount, version 0.7 did not appear until the end of August. This version still lacks some of the features planned for version 1.0, including podcast support and, above all, a Federation function. The intent was to use this feature to interconnect MediaGoblin installations so that users could log into different servers and still be able to share their videos and photos.

Nonetheless, MediaGoblin is already quite usable, and the X Open Hub platform [3] currently lists 25 active project developers. Among others, it is hosted on LibrePlanet [4] and the Chicago GNU/Linux User Group [5].


MediaGoblin is written entirely in Python. If you want to use the web application, you will need Python 2.6 or 2.7, the Python Library Imagine (PIL for short), and the Python python-lxml module, along with the XML and XSLT parsers from the libxml2 and libxslt libraries. You'll also need the virtualenv tool, which generates the virtual Python environments, Git, and a SQLite or PostgreSQL database.

On Debian and Ubuntu systems, the command

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

installs all the required packages. Next, download MediaGoblin and set up the Git sub-modules (Listing 1).

Listing 1

Checking out MediaGoblin


The three commands shown in the listing check out the current development version. Packages with the individual releases are currently not available for download. Thus, if you want to use version 0.7.1, you first need to tease it painstakingly out of the Git repository  [6].

After downloading, the budding platform operator needs to set up a virtual environment for MediaGoblin:

(virtualenv --python=python2 --system-site-packages . || \
  virtualenv --python=python2 .) && ./bin/python develop

Now you can create the required database tables:

./bin/gmg dbupdate

The gmg tool handles the other maintenance tasks later on, such as helping to manage your users. It also has a Python shell on board, which admins can use to monitor MediaGoblin and modify settings on the fly. Finally, you can launch the built-in web server:


The script calls the Gunicorn WSGI HTTP server [7]. Or at least, this was true of MediaGoblin 0.7.2, which was the latest development version when this issue went to press. The direct predecessor started a web server with Python Paste [8].

Now a full test installation of MediaGoblin awaits you on http://localhost:6543 that stores its data in a SQLite database. For instructions on running MediaGoblin on a production server, see the box "In the Wild." You can cancel the web server ungracefully by pressing Ctrl+C.

In the Wild

In a production environment, the MediaGoblin operator will probably want to use FastCGI to bolt MediaGoblin onto a web server such as Apache or Nginx. For this purpose, you need to set up a new user with restricted privileges on the server. Then, install MediaGoblin (with the commands mentioned in the article) in the docroot directory of the web server and type

./bin/easy_install flup

to fetch the flup Python module, containing a "random assortment of WSGI servers."

Larger installations should also use a PostgreSQL database and register it in the mediagoblin.ini configuration file. Instead of the script, the developers in this case recommend starting the MediaGoblin process with its own init script directly via Paste and Celery.

The latter software provides an asynchronous task/job queue with which users can upload movies and other media at the same time to the MediaGoblin page. Examples of appropriate init scripts can be found in the MediaGoblin wiki [9]. Finally, you need to introduce your web server to MediaGoblin.

Matching sample configurations for servers such as Apache 2, Nginx, and lighttpd are supplied on the MediaGoblin deployment page [10].

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More