Mediagoblin on Archlinux

Tags:

(updated on 2013-03-12)

An overview of the commands needed to get Mediagoblin up and working on Archlinux.
It assumes you're starting with a clean install of nginx and that you want the SQLite backend (instead of PostgreSQL).

A proper guide is available here.

Commands

Note: of course, change "mediagoblin.example.org" to your actual domain wherever necessary.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# pacman -S --needed nginx python2 python2-lxml git sqlite python2-imaging python2-virtualenv php-fpm
# cat << EOF > /etc/nginx/conf/nginx.conf
worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
 
    sendfile        on;
 
    keepalive_timeout  65;
 
    server {
        listen       80;
        server_name  localhost;
        location / {
            root   html;
            index  index.html index.htm index.php;
        }
 
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
 
        location ~ \.php$ {
            try_files $uri =404
            root           html;
            fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
    }
    include /etc/nginx/conf.d/*.conf;
}
EOF
# mkdir /etc/nginx/conf.d
# mkdir -p /srv/http/mediagoblin.example.org
# useradd mediagoblin
# chown mediagoblin /srv/http/mediagoblin.example.org
# cd /srv/http/mediagoblin.example.org
# su - mediagoblin
$ git clone git://gitorious.org/mediagoblin/mediagoblin.git
$ cd mediagoblin
$ virtualenv --python=python2.7 . && ./bin/python2.7 setup.py develop
$ ./bin/easy_install flup
$ ./bin/pip-2.7 install lxml
$ ./bin/pip install https://pypi.python.org/packages/source/P/PasteScript/PasteScript-1.7.5.tar.gz # [1]
$ ./bin/easy_install PIL # [1]
$ cat << EOF > ../nginx.conf
server {
 #################################################
 # Stock useful config options, but ignore them :)
 #################################################
 include /etc/nginx/conf/mime.types;
 
 autoindex off;
 default_type  application/octet-stream;
 sendfile on;
 
 # Gzip
 gzip on;
 gzip_min_length 1024;
 gzip_buffers 4 32k;
 gzip_types text/plain text/html application/x-javascript text/javascript text/xml text/css;
 
 #####################################
 # Mounting MediaGoblin stuff
 # This is the section you should read
 #####################################
 
 # Change this to update the upload size limit for your users
 client_max_body_size 8m;
 
 server_name mediagoblin.example.org www.mediagoblin.example.org;
 access_log /var/log/nginx/mediagolbin.example.access.log;
 error_log /var/log/nginx/mediagolbin.example.error.log;
 
 # MediaGoblin's stock static files: CSS, JS, etc.
 location /mgoblin_static/ {
    alias /srv/http/mediagoblin.example.org/mediagoblin/mediagoblin/static/;
 }
 
 # Instance specific media:
 location /mgoblin_media/ {
    alias /srv/http/mediagoblin.example.org/mediagoblin/user_dev/media/public/;
 }
 
 # Mounting MediaGoblin itself via FastCGI.
 location / {
    fastcgi_pass 127.0.0.1:26543;
    include /etc/nginx/conf/fastcgi_params;
 
    # our understanding vs nginx's handling of script_name vs
    # path_info don't match :)
    fastcgi_param PATH_INFO $fastcgi_script_name;
    fastcgi_param SCRIPT_NAME "";
 }
}
EOF
$ exit
# ln -s /srv/http/mediagoblin.example.org/nginx.conf /etc/nginx/conf.d/
$ ./lazyserver.sh --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543

Details

  1. Line 1: Install the dependencies.
  2. Line 2-39: nginx configuration: "/etc/nginx/conf/nginx.conf". You can get the file here.
  3. Line 40: Create a config directory for virtual hosts
  4. Line 41: Create directory that will contain Mediagoblin
  5. Line 42: Create mediagoblin user
  6. Line 43: Make it the owner of the Mediagoblin files
  7. Line 44: Switch to the directory
  8. Line 45: Become the mediagoblin user
  9. Line 46: Download Mediagoblin
  10. Line 47: Switch to the directory containing the files
  11. Line 48: Create the virtual environment
  12. Line 49: Install flup
  13. Line 50: Install lxml
  14. Line 51-101: Virtual host configs: "/srv/http/mediagoblin.example.org/nginx.conf". You can get the file here.
  15. Line 102: Logout of the 'mediagoblin' user
  16. Line 103: Create symlink in the nginx config. directory to the file we just created
  17. Line 104: Start Mediagoblin

If everything went according to plan, you can visit the site you've set up by visiting <http://mediagoblin.example.org>. You should see MediaGoblin!


[1]: Thanks to @nybill for these additions