Revision as of 18:11, 7 October 2018 by B01 (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Container repository : Piwigo for images, sounds and video

vhost config on the host server


<VirtualHost *:80>
       ServerAdmin webmaster@localhost

       ErrorLog ${APACHE_LOG_DIR}/repository-error.log
       CustomLog ${APACHE_LOG_DIR}/repository-access.log combined

       ProxyPreserveHost       On
       ProxyRequests           Off
       ProxyPass /
       ProxyPassReverse /

       <Proxy *>
               Order deny,allow
               Allow from all

RewriteEngine on
RewriteCond %{SERVER_NAME}
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]


<IfModule mod_ssl.c>
<VirtualHost *:443>
       ServerAdmin webmaster@localhost

       ErrorLog ${APACHE_LOG_DIR}/repository-error.log
       CustomLog ${APACHE_LOG_DIR}/repository-access.log combined
       ProxyPreserveHost       On
       ProxyRequests           Off
       ProxyPass /
       ProxyPassReverse /
       <Proxy *>
               Order deny,allow
               Allow from all
       SSLEngine on
       SSLProxyEngine On
       SSLProxyVerify none
       SSLProxyCheckPeerCN off
       SSLProxyCheckPeerName off
       SSLProxyCheckPeerExpire off

#RewriteEngine on
SSLCertificateFile /etc/letsencrypt/live/
SSLCertificateKeyFile /etc/letsencrypt/live/
Include /etc/letsencrypt/options-ssl-apache.conf

Installation of Piwigo

sudo apt install iputils-ping nano apache2 php-xml php-mbstring mysql-server php7.0 php7.0-gd imagemagick exiftool wget unzip php7.0-mysql apt-utils locate
  • Get Piwigo
cd /tmp
unzip dlcounter.php\?code\=latest 
unzip /tmp/dlcounter.php\?code\=latest  .
mv piwigo/* /var/www/html/
  • Create a mysql user
mysql -u root
  • Activate ssl on the container
a2enmod ssl
ln -s /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-enable/default-ssl.conf
systemctl restart apache2
  • Finish the configuration : go to :


Installation of Videojs Plug in to allow upload of sound and video

To install, activate the File Editor plug-in and follow the instructions here

Also mediainfo version does'nt work, you have to replace it by this one

  • Download the 3 packages and :
sudo dpkg -i *deb"

If you get an error message, use:

sudo apt-get -f install

On Debian Stretch, there is a few problem with PHP7 : have to comment a break function in a php file line 185

Batch upload and synchronisation

There is the possibility to transfer files to a new folder in the galleries folder of piwigo on the server and the synchronise the database so as to include those files.

It can be useful if you want to archive a whole vimeo channel on piwigo, with a ssh shell on the server, you can download the channel with

You have to synchronise the folder and the database with this panel :


Deprecated > Piwigo instead of Mediagoblin

Installation of Mediagoblin

Connect to the container :

sudo lxc-attach -n repository

Installation of the dependencies

On debian Strech, nmp doesn't seem to be in the repository, so to install ( :

apt install curl
curl -sL | bash -
apt install nodejs
node --version
apt install build-essential libssl-dev
npm version

Puis on installe les dépendances :

 apt-get install git-core python python-dev python-lxml python-imaging python-virtualenv automake nginx

Installation of Postgresql

apt-get install postgresql postgresql-client python-psycopg2

Configure Postgresql

loggin as postgresql

su - postgres

the as postgresql user :

createuser -A -D mediagoblin
createdb -E UNICODE -O mediagoblin mediagoblin

Now, as root, create a mediagoblin user

useradd -c "GNU MediaGoblin system account" -d /var/lib/mediagoblin -m -r -g www-data mediagoblin
groupadd mediagoblin && sudo usermod --append -G mediagoblin mediagoblin

Create a mediagobling directory and install it in a virtual env

mkdir -p /srv/ && chown -hR mediagoblin:www-data /srv/&& chown -hR mediagoblin:www-data /srv/
su mediagoblin -s /bin/bash
cd /srv/
git clone git:// -b stable
cd mediagoblin/
git submodule init && git submodule update

Set up the hacking env

./ && ./configure && make
mkdir user_dev && chmod 750 user_dev

This concludes the initial configuration of the MediaGoblin environment. In the future, when you update your codebase, you should also run:

$ git submodule update && ./bin/python develop --upgrade && ./bin/gmg dbupdate

Note: If you are running an active site, depending on your server configuration, you may need to stop it first or the dbupdate command may hang (and it’s certainly a good idea to restart it after the update)

Deploy MediaGoblin Services

cp -av mediagoblin.ini mediagoblin_local.ini && cp -av paste.ini paste_local.ini

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 your mediagoblin directory is not the root directory of your vhost.
  • Uncomment sql_engine = postgresql:///mediagoblin

it gives :

#direct_remote_path = /mediagoblin/
direct_remote_path = /mgoblin_static/
email_sender_address = ""
## Uncomment and change to your DB's appropiate setting.
## Default is a local sqlite db "mediagoblin.db".
## Don't forget to run `./bin/gmg dbupdate` after having changed it.
sql_engine = postgresql:///mediagoblin
# Place plugins here, each in their own subsection of [plugins].
# See for details.

Before you start using the database, you need to run:

./bin/gmg dbupdate

Add Audio and video support in mediagoblin


apt-get install python-gi python3-gi gstreamer1.0-tools gir1.2-gstreamer-1.0 gir1.2-gst-plugins-base-1.0 gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad gstreamer1.0-libav python-gst-1.0

And add the in mediagoblin_local.ini as below


apt-get install python-gst-1.0 gstreamer1.0-plugins-{base,bad,good,ugly} gstreamer1.0-libav python-numpy python-scipy libsndfile1-dev libasound2-dev

And add the in mediagoblin_local.ini as below

Update the database to include video and audio

in /srv/ as mediagoblin user :

./bin/gmg dbupdate

=== Configure N GINX and FastCGI ===

nano /srv/

see the example file :

Create a symlink :

ln -s /srv/ /etc/nginx/sites-enabled/

Restart NGINX

systemctl restart nginx

Start the server

cd /srv/
su mediagoblin -s /bin/bash
./ --server-name=fcgi fcgi_host= fcgi_port=26543