derivatives) issue the following command::
sudo apt-get install git-core python python-dev python-lxml \
- python-imaging python-virtualenv npm automake
+ python-imaging python-virtualenv npm nodejs-legacy automake \
+ nginx
On a RPM-based system (e.g. Fedora, RedHat, and derivatives) issue the
following command::
sudo yum install python-paste-deploy python-paste-script \
git-core python python-devel python-lxml python-imaging \
- python-virtualenv npm automake
+ python-virtualenv npm automake nginx
Configure PostgreSQL
~~~~~~~~~~~~~~~~~~~~
sudo yum install postgresql postgresql-server python-psycopg2
-An rpm-based system also requires that you initialize the PostgresSQL database
-with this command. The following command is not needed on a Debian-based
-platform, however::
+An rpm-based system also requires that you initialize and start the
+PostgresSQL database with a few commands. The following commands are
+not needed on a Debian-based platform, however::
sudo /usr/bin/postgresql-setup initdb
+ sudo systemctl enable postgresql
+ sudo systemctl start postgresql
The installation process will create a new *system* user named ``postgres``,
which will have privilegies sufficient to manage the database. We will create a
where the first ``mediagoblin`` is the database owner and the second
``mediagoblin`` is the database name.
-Type ``exit`` to exit from the 'postgres' user account.
+Type ``exit`` to exit from the 'postgres' user account.::
-From here we just need to set the Postgres database to start on boot, and also
-start it up for this particular session. If you're on a platform that does not
-use *systemd*, you can enter::
-
- sudo chkconfig postgresql on && service postgresql start
-
-Whereas users of *systemd*-based systems will need to enter::
-
- sudo systemctl enable postgresql && systemctl start postgresql
+ exit
.. caution:: Where is the password?
The following command (entered as root or with sudo) will create a
system account with a username of ``mediagoblin``. You may choose a different
-username if you wish.::
+username if you wish.
+
+If you are using a Debian-based system, enter this command::
+
+ sudo useradd -c "GNU MediaGoblin system account" -d /var/lib/mediagoblin -m -r -g www-data mediagoblin
+
+If you are using an RPM-based system, enter this command::
+
+ sudo useradd -c "GNU MediaGoblin system account" -d /var/lib/mediagoblin -m -r -g nginx mediagoblin
- sudo useradd -c "GNU MediaGoblin system account" -d /home/mediagoblin -U -m -r mediagoblin
+This will create a ``mediagoblin`` user and assign it to a group that is
+associated with the web server. This will ensure that the web server can
+read the media files (images, videos, etc.) that users upload.
+We will also create a ``mediagoblin`` group and associate the mediagoblin
+user with that group, as well::
+
+ sudo groupadd mediagoblin && sudo usermod --append -G mediagoblin mediagoblin
+
No password will be assigned to this account, and you will not be able
to log in as this user. To switch to this account, enter::
sudo su mediagoblin -s /bin/bash
-You may get a warning similar to this when entering these commands::
-
- warning: cannot change directory to /home/mediagoblin: No such file or directory
-
-You can disregard this warning. To return to your regular user account after
-using the system account, just enter ``exit``.
+To return to your regular user account after using the system account, type
+``exit``.
.. _create-mediagoblin-directory:
with elevated priviledges, and then assign ownership of the directory
to the unpriviledged system account.
-To do this, enter either of the following commands, changing the defaults
-to suit your particular requirements::
+To do this, enter the following command, changing the defaults to suit your
+particular requirements. On a Debian-based platform you will enter this::
+
+ sudo mkdir -p /srv/mediagoblin.example.org && sudo chown -hR mediagoblin:www-data /srv/mediagoblin.example.org
- sudo mkdir -p /srv/mediagoblin.example.org && sudo chown -hR mediagoblin: /srv/mediagoblin.example.org
+On an RPM-based distribution, enter this command::
+
+ sudo mkdir -p /srv/mediagoblin.example.org && sudo chown -hR mediagoblin:nginx /srv/mediagoblin.example.org
.. note::
you're familiar with Python packaging you may consider deploying with
your preferred method.
+.. note::
+
+ What if you don't want an in-package ``virtualenv``? Maybe you
+ have your own ``virtualenv``, or you are building a MediaGoblin
+ package for a distribution. There's no need necessarily for the
+ virtualenv produced by ``./configure && make`` by default other
+ than attempting to simplify work for developers and people
+ deploying by hiding all the virtualenv and bower complexity.
+
+ If you want to install all of MediaGoblin's libraries
+ independently, that's totally fine! You can pass the flag
+ ``--without-virtualenv`` which will skip this step.
+ But you will need to install all those libraries manually and make
+ sure they are on your ``PYTHONPATH`` yourself! (You can still use
+ ``python setup.py develop`` to install some of those libraries,
+ but note that no ``./bin/python`` will be set up for you via this
+ method, since no virtualenv is set up for you!)
+
Assuming you are going to deploy with FastCGI, you should also install
flup::
~~~~~~~~~~~~~~~~~~~~~~~
A few basic properties must be set before MediaGoblin will work. First
-make a copy of ``mediagoblin.ini`` for editing so the original config
-file isn't lost::
+make a copy of ``mediagoblin.ini`` and ``paste.ini`` for editing so the original
+config files aren't lost (you likely won't need to edit the paste configuration,
+but we'll make a local copy of it just in case)::
- $ cp mediagoblin.ini mediagoblin_local.ini
+ $ cp -av mediagoblin.ini mediagoblin_local.ini && cp -av paste.ini paste_local.ini
-Then:
+Then edit mediagoblin_local.ini:
- Set ``email_sender_address`` to the address you wish to be used as
the sender for system-generated emails
- Edit ``direct_remote_path``, ``base_dir``, and ``base_url`` if
You should be able to connect to the machine on port 6543 in your
browser to confirm that the service is operable.
+The next series of commands will need to be run as a priviledged user. Type
+exit to return to the root/sudo account.::
+
+ exit
+
.. _webserver-config:
``/srv/mediagoblin.example.org/nginx.conf`` and create a symbolic link
into a directory that will be included in your ``nginx`` configuration
(e.g. "``/etc/nginx/sites-enabled`` or ``/etc/nginx/conf.d``) with
-one of the following commands (as the root user)::
+one of the following commands.
+
+On a DEB-based system (e.g Debian, gNewSense, Trisquel, Ubuntu, and
+derivatives) issue the following commands::
- sudo ln -s /srv/mediagoblin.example.org/nginx.conf /etc/nginx/conf.d/
sudo ln -s /srv/mediagoblin.example.org/nginx.conf /etc/nginx/sites-enabled/
+ sudo systemctl enable nginx
-Modify these commands and locations depending on your preferences and
+On a RPM-based system (e.g. Fedora, RedHat, and derivatives) issue the
+following commands::
+
+ sudo ln -s /srv/mediagoblin.example.org/nginx.conf /etc/nginx/conf.d/
+ sudo systemctl enable nginx
+
+You can modify these commands and locations depending on your preferences and
the existing configuration of your nginx instance. The contents of
this ``nginx.conf`` file should be modeled on the following::
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;
+ gzip_types text/plain application/x-javascript text/javascript text/xml text/css;
#####################################
# Mounting MediaGoblin stuff
.. note::
- The user who owns the Nginx process, normally ``www-data``,
+ The user who owns the Nginx process, normally ``www-data`` or ``nginx``,
requires execute permission on the directories ``static``,
``public``, ``theme_static`` and ``plugin_static`` plus all their
parent directories. This user also requires read permission on all
the files within these directories. This is normally the default.
-Now, nginx instance is configured to serve the MediaGoblin
-application. Perform a quick test to ensure that this configuration
-works. Restart nginx so it picks up your changes, with a command that
-resembles one of the following::
+Nginx is now configured to serve the MediaGoblin application. Perform a quick
+test to ensure that this configuration works::
+
+ nginx -t
+
+If you encounter any errors, review your nginx configuration files, and try to
+resolve them. If you do not encounter any errors, you can start your nginx
+server with one of the following commands (depending on your environment)::
sudo /etc/init.d/nginx restart
sudo /etc/rc.d/nginx restart
example::
cd /srv/mediagoblin.example.org/mediagoblin/
+ su mediagoblin -s /bin/bash
./lazyserver.sh --server-name=fcgi fcgi_host=127.0.0.1 fcgi_port=26543
Visit the site you've set up in your browser by visiting