Difference between revisions of "MediaGoblin"

From Libopedia
Jump to navigation Jump to search
Line 113: Line 113:
  
 
===Last Step===
 
===Last Step===
Reboot the server and then connect to it via client web browser.
+
Reboot the server.
 
  reboot
 
  reboot
 
+
And then connect to it via client web browser
 
  http://media.lib.sun.ac.za
 
  http://media.lib.sun.ac.za

Revision as of 21:09, 8 August 2014

This wiki page details the installation of MediaGoblin on an Ubuntu 12.04 server. The installation is suited to small deployments.

First Step - Install Ubuntu 12.04 Server

Install a normal 12.04 LTS 63 bit server. Make sure that you prepare enough disk space for all the media you will be hosting. The only additional software to install is the OpenSSH server. Also prepare for a hostname/domainnam/URL to use, for example at Stellenbosch University Library we chose http://media.lib.sun.ac.za. 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, login and become the root user, using the "sudo" method.

Step 1 - Install pre-requisite software

  • Build dependencies
apt-get install git-core python python-dev python-lxml python-imaging python-virtualenv
  • Web server dependencies
apt-get install apache2-mpm-worker libapache2-mod-fastcgi apache2-suexec
a2enmod suexec fastcgi rewrite
  • Mail server dependencies
apt-get install postfix mailutils

Setup postfix as a smarthost relay and use your campus mail gateway.

  • Create the media user:
adduser media

Follow the console instructions

chmod 0777 -R /home/media

Step 2 - Install MediaGoblin

Type the following:

 cd /opt
 git clone git://gitorious.org/mediagoblin/mediagoblin.git
 cd mediagoblin
 git submodule init && git submodule update

And set up the in-package virtualenv:

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

Assuming you are going to deploy with FastCGI, you should also install flup:

./bin/easy_install flup

Step 3 - Deploy MediaGoblin

Type the following:

cp mediagoblin.ini mediagoblin_local.ini
nano mediagoblin_local.ini
  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
  3. Save the file and exit

Populate the DB:

./bin/gmg dbupdate

Setup web server default host:

cd /etc/apache2/sites-available
rm default
nano default

Copy and paste the following into the editor:

<VirtualHost *:80>
ServerName media.lib.sun.ac.za
ServerAdmin scholar@sun.ac.za
DocumentRoot /var/www/
# Custom log files
CustomLog /var/log/apache2/media_access.log combined
ErrorLog /var/log/apache2/media_error.log

# Serve static and media files via alias
Alias /mgoblin_static/ /opt/mediagoblin/static/
Alias /mgoblin_media/ /home/media/

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

# Allow access to static and media directories
<Directory /opt/mediagoblin/static>
  Order allow,deny
  Allow from all
</Directory>
<Directory /home/media>
  Order allow,deny
  Allow from all
</Directory>

# Connect to fcgi server
FastCGIExternalServer /var/www/mg.fcgi -host 127.0.0.1:26543
</VirtualHost>

Save and exit the file.

Restart the web server.

sudo service apache2 restart

Step 4 - Launch the media service

Type the following to test:

./lazystarter.sh --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543

If it works then add the following to the /etc/rc.local file:

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

See example below.


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

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

exit 0

Last Step

Reboot the server.

reboot

And then connect to it via client web browser

http://media.lib.sun.ac.za