MediaGoblin

This wiki page details the installation of MediaGoblin on an Ubuntu 12.04 server.

This basic installation method is suitable for small deployments.

Install an Ubuntu 12.04 Server
Install a normal Ubuntu 12.04 LTS 64 bit server. During the installation when prompted select to install the OpenSSH server

Make sure that you prepare enough disk space for all the media you will be hosting.

Also prepare for a hostname/domainname/URL to use.

Also ensure the server has access to the internet in order to be able download software during the installation.

After the Ubuntu server is installed, remotely login using SSH and become the root user, using the "sudo" method by typing sudo -i after logging in..

Step 1 - Pre-requisites
apt-get install mc git-core python python-dev python-lxml python-imaging python-virtualenv apt-get install apache2-mpm-worker libapache2-mod-fastcgi apache2-suexec a2enmod fastcgi rewrite suexec apt-get install postfix mailutils Setup postfix as a smarthost relay and use your institutional outgoing email server (mail.sun.ac.za) as the smarthost relay.
 * Build dependencies
 * Web server dependencies
 * Enable web server modules
 * Mail server dependencies

Step 2 - Install MediaGoblin
cd /opt git clone git://gitorious.org/mediagoblin/mediagoblin.git cd mediagoblin git submodule init && git submodule update cd /opt/mediagoblin (virtualenv --python=python2 --system-site-packages . || virtualenv --python=python22 .) && ./bin/python setup.py develop cd /opt/mediagoblin ./bin/easy_install flup
 * Type the following:
 * And set up the in-package virtualenv:
 * Assuming you are going to deploy with FastCGI, you should also install flup:

Step 3 - Deploy MediaGoblin
cd /opt/mediagoblin cp mediagoblin.ini mediagoblin_local.ini nano mediagoblin_local.ini Under [mediagoblin]
 * Create local config file:
 * Set mediagoblin operating parameters.
 * 1) Set email_sender_address to the address you wish to be used as the sender for system-generated emails
 * 2) ''Set email_debug_mode = false

Save the file and exit.

cd /etc/apache2/sites-available rm default nano default Copy and paste the following into the editor:  ServerName xxxx.com ServerAdmin xxxx@yyyy DocumentRoot /var/www/
 * Setup web server default host:

Alias /mgoblin_static/ /opt/mediagoblin/mediagoblin/static/ Alias /mgoblin_media/ /opt/mediagoblin/mediagoblin/user_dev/media/public/
 * 1) Serve static and media files via alias

RewriteEngine On RewriteRule ^(mgoblin_static|mgoblin_media)($|/) - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ /mg.fcgi/$1 [QSA,L]
 * 1) Rewrite all URLs to fcgi, except for static and media urls

 Order allow,deny Allow from all   Order allow,deny Allow from all 
 * 1) Allow access to static and media directories

FastCGIExternalServer /var/www/mg.fcgi -host 127.0.0.1:26543  Save and exit the file.
 * 1) Connect to fcgi server

cd /opt/mediagoblin ./bin/gmg dbupdate
 * Populate the DB:

service apache2 restart
 * Restart the web server.

Step 4 - Launch the media service
Type the following to test: cd /opt/mediagoblin/ ./lazyserver.sh --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543 Press CTL+c to end the process.

If it works then add the following to the /etc/rc.local file using the "nano" editor: cd /opt/mediagoblin/ ./lazyserver.sh --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543 See example below.


 * 1) !/bin/sh -e
 * 2) rc.local
 * 3) This script is executed at the end of each multiuser runlevel.
 * 4) Make sure that the script will "exit 0" on success or any other
 * 5) value on error.
 * 6) In order to enable or disable this script just change the execution
 * 7) bits.
 * 8) By default this script does nothing.
 * 1) In order to enable or disable this script just change the execution
 * 2) bits.
 * 3) By default this script does nothing.
 * 1) By default this script does nothing.

cd /opt/mediagoblin ./lazyserver.sh --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543

exit 0

Last Step
Setup for production by putting Celery into asynchronous mode. http://mediagoblin.readthedocs.org/en/latest/siteadmin/production-deployments.html Reboot the server. reboot

Enable Media Types
The default installation above only allows viewing of image files.

To enable an additional media type, add the the media type under the [plugins] section of your /opt/mediagoblin/mediagoblin_local.ini file.

Type the following as the root user. nano /opt/mediagoblin/mediagoblin_local.ini Copy and paste the following into the file underneath the [plugins]</tt> section.

mediagoblin.media_types.video mediagoblin.media_types.audio mediagoblin.media_types.pdf mediagoblin.media_types.raw_image mediagoblin.media_types.ascii mediagoblin.media_types.stl Save the file.

Install dependant open source software. apt-get install poppler-utils unoconv python-pyexiv2 libsndfile1-dev libasound2-dev python-gst0.10 python-numpy python-scipy apt-get install gstreamer0.10-plugins-{base,bad,good,ugly} gstreamer0.10-ffmpeg blender ubuntu-restricted-extras Install dependant python software. cd /opt/mediagoblin ./bin/pip install scikits.audiolab ./bin/easy_install chardet Install pdf.js dependencies cd /opt/mediagoblin git submodule init git submodule update Update the database. cd /opt/mediagoblin ./bin/gmg dbupdate Run tests. cd /opt/mediagoblin ./runtests.sh

If there are no errors then reboot.