YourTube

The same way that "ease of use" usually equates to less flexibility, "convenience" is nearly always synonymous with less privacy, and YouTube nowadays is very, very convenient. If you just want to share a video, and not your personal data, or you want to avoid rude users from commenting on your kids' videos, MediaGoblin is what you need.

MediaGoblin [1] has several things going for it, not least of which is that, in this post-PRISM world, you can set up and control you own personal media-sharing site without having to go through Google or Vimeo. MediaGoblin is also very versatile, because it can also act as a stand-in for Flickr, SoundCloud, and soon Blogger. Additionally, it can render 3D files in real time.

Install

As usual, I used a stock Debian Wheezy on VirtualBox with all updates applied on 28/09/2013 as my test machine. When installing Debian, I chose the server option (databases, web servers, etc.). MediaGoblin itself is still under heavy development and is not yet packaged into most distros.

Your best option is to grab the latest version from its Git repository, so first you'll need to get and install Git, then clone MediaGoblin and download all the necessary files:

Unless you plan to have a dedicated server running your site, the recommended approach is to run MediaGoblin in its own Python environment.

The next step is to set up the database back end. MediaGoblin supports both PostgreSQL and SQLite (the default), but the latter is not very scalable and only works for very small deployments. I'll go with the PostgreSQL deployment. To begin, install the PostgreSQL packages:

In Debian, PostgreSQL comes with a passwordless user called postgres, from which you can run PostgreSQL commands. You cannot access this user directly (e.g., with su postgres), because no password will work, so you have to access root and then move down into postgres:

$ su
# su postgres

Once you're logged in as postgres, you can start building the framework for MediaGoblin. First, create a MediaGoblin user for the database

$ createuser MediaGoblin

and answer no to the three questions PostgreSQL asks you about the user's privileges.

Next, you can create the database proper:

$ createdb -E UNICODE -O MediaGoblin MediaGoblin

This step creates the database MediaGoblin and assigns ownership to the user MediaGoblin.

The MediaGoblin documentation recommends creating an unprivileged, passwordless Linux user account to run the server, so I'll show how to do that, too. To start, exit from the postgres user to root:

$ exit

Next, create the Linux user using the --shell, --no-create-home, --system, and --group flags as follows:

By the way, gmg is a MediaGoblin tool that comes with several utilities for updating databases and managing users; it even provides a Python shell to monitor and change MediaGoblin's behavior on the fly. In this case, I'll update the databases in MediaGoblin.

With that, installation is complete. You can test your site by running

$ ./lazyserver.sh --server-name=broadcast

and visiting http://localhost:6543 (Figure 1).

Figure 1: MediaGoblin running on your local server.

By using the --server-name=broadcast option, you should also be able to access the server on your intranet at http://serverip:6453.

Setup

Although MediaGoblin comes with its own server embedded for testing purposes, this server is not adequate for production. To help serve all the static material, you should deploy MediaGoblin with a full-fledged web server, such as Apache or Nginx [2].

The MediaGoblin documentation project provides plenty of examples of scripts to optimize the execution of Celery (an asynchronous task queue that allows users to load media while visiting other parts of your site) and FastCGI (a framework that provides a way to improve the performance of server-side scripts) for various web servers. It also provides startup scripts for Linux so that the server runs every time the machine is powered up.

Apart from that, most administration of the site itself is done by editing the MediaGoblin_local.ini and the paste_local.ini files created earlier. One of the first things you must do is change the line

email_debug_mode = true

to

email_debug_mode = false

so that the system sends email to users (e.g., verification email). If you don't, the text of the email will show up on the lazyserver output, but won't be sent over the Internet. As mentioned previously, you will also have to write in the correct configuration for your email service in MediaGoblin/config_spec.ini.

Another thing you can do is turn off registration if you just want to set up a private website. You can do that by changing the line

allow_registration = true

to

allow_registration = false

With allow_registration set to false, only the server administrator can create user accounts, which can be done with gmg:

$ bin/gmg adduser

The script will prompt you for a username and password and register the user with your instance of MediaGoblin.

To make a user a site administrator, you also use gmg:

$ bin/gmg makeadmin <username>

Currently, the site admin's powers are limited to being able to monitor contents being processed.

Finally, there's the matter of getting types of media working on your server.

Media

By default, your MediaGoblin site will allow you to upload images. Try anything else, and you'll get the message, Sorry, I don't support that file type :( (Figure 2).

Figure 2: MediaGoblin only supports images out of the box.

If you look under MediaGoblin/media_types/, however, you will also see the ascii/, audio/, image/, pdf/, stl/, and video/ directories. These contain the plugins for the different types of media. The MediaGoblin/media_types/audio directory, for example, contains the configuration files and all the code necessary to allow MediaGoblin to understand OGG, MP3, and WAV files.

To add audio to your setup, open your MediaGoblin_local.ini file in a text editor and add

[[MediaGoblin.media_types.audio]]

in the [plugins] section.

Note, however, that you're not done yet. If you run gmg updatedb (which is what you have to do every time you update MediaGoblin_local.ini), it will choke on half a dozen failed dependencies. You have to install a bunch of XML and sound-related packages on your system,

The great thing is that, if you get audio files working on your site, you won't have to do much else if you want to upload videos (Figure 4). Just add the line

Figure 4: Uploading and viewing videos is easy and straightforward.

[[MediaGoblin.media_types.video]]

to the [plugins] section of MediaGoblin_local.ini, run gmg updatedb and lazyserver.sh again, and video support will be implemented into your setup.

MediaGoblin transforms all videos to the WebM format, the open video format developed by Google, and, in theory, supports a wide variety of upload formats. I tried MP4 and WebM, which worked fine, as well as OGV (Ogg Theora), which didn't. There's a bug in the thumbnail-creating code of the version I was using (nightly 0.6.0). I hope by the time you read this, that bug will have been squashed.

Buy Linux Magazine

Related content

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.

Sharing videos or images doesn't always require a full-fledged YouTube or Flickr clone. Sometimes all you want is a quick place to upload, so you can link to your media or share it online. MediaCrush gives you just that, as well as other interesting perks.