Howto install Hubzilla on Debian 9 "Stretch" in six easy steps

Open Source Musings | tobias
  last edited: Fri, 21 Apr 2017 19:44:14 +0200  
Installing my favorite web suite aka Hubzilla on the forthcoming Debian 9 "Stretch" is a joy, quick, straightforward and easy. I will show you how to do it in about 10 minutes or less.
As mentioned earlier I am currently preparing for the switch to Debian 9 "Stretch". So far I am quite happy with the update and I am pretty happy to finally welcome back the pacemaker clustering suite back to my favourite distro. But that is another story and shall be told at another time. :)
(This is just a quick cheatsheet, I will write a longer howto for you later. Promised.)
I am starting with a basic Debian installation. The only additional feature chosen during installation is ssh-server.
  • Install the required dependencies:
    apt-get install vim git apache2 mariadb-server php certbot python-certbot-apache php-curl php-gd php-mbstring php-xml php-mysql
  • enable the required apache modules ssl and rewrite
    a2enmod rewrite
    a2enmod ssl

    Create the basic vhost configuration file
    <VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName my-hubzilla.site
        DocumentRoot /var/www/hubzilla
        <Directory />
            Options FollowSymLinks
            AllowOverride All
        </Directory>
        <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/hubzilla_error.log
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/hubzilla_access.log combined
    </VirtualHost>

    Enable the new vhost
    enable /etc/apache2/sites-available/hubzilla.conf
    Restart apache2 in order to activate all these changes
    systemctl restart apache2
  • clone the Hubzilla repository, create the required cache directory and chown everything to writable for the webserver account www-data
    cd /var/www/ ; git clone https://github.com/redmatrix/hubzilla ; chown -R www-data. hubzilla;
  • create the database
    mysql -u root
    create database hubzilla ; CREATE USER 'hubzilla'@'localhost' IDENTIFIED BY 'totally-secret-password'; GRANT ALL PRIVILEGES ON hubzilla.* to 'hubzilla'@'localhost';
  • create the letscencrypt certificates in order to use SSL and have certbot automatically configure your apache vhost to use SSL. Just follow the instructions.
    certbot
  • open your browser and follow the instructions.
    my-hubzilla.site
mp3fs: HowTo automatically convert flac to mp3

Open Source Musings | tobias
  
For anyone with a huge music collection saved in flac, mp3fs can be an awesome tool. To me using flac on my mobile phone is quite an overkill, wasting too much space while I am usually in noisy environments anyway. This does not require the most audiophile setup. But converting flac into mp3 can be tiresome.
There is an awesome tool for that: mp3fs.
Mp3fs mounts your flac collection into a virtual file system and displays your flac files as if they were mp3s. Only if you access them for the first time, they will be converted on the fly. Simple, convenient and faster than doing the same tasks manually.
apt-get install mp3fs
In order to access the mp3 files I need to mount my flac directory into the target mp3 directory.
As of now my flac directory holds the flac files and the mp3 directory is empty.
root@to:/mnt# ls -1 /mnt/flac/Stefan\ Lakatos\ -\ Collectible\ Patterns/
cover.jpg
Stefan Lakatos - Collectible Patterns - 01 Anamande.flac
Stefan Lakatos - Collectible Patterns - 02 Even uneven.flac
Stefan Lakatos - Collectible Patterns - 03 Square Time.flac
Stefan Lakatos - Collectible Patterns - 04 Sun Collector n°2.flac
Stefan Lakatos - Collectible Patterns - 05 Frozen Footsteps.flac
Stefan Lakatos - Collectible Patterns - 06 Collectible Pattern.flac
Stefan Lakatos - Collectible Patterns - 07 Seven Twins.flac
root@to:/mnt# ls /mnt/mp3/
root@to:/mnt#

The mp3 directory will be populated once the flac dir is mounted into the mp3 dir.
mp3fs /mnt/flac /mnt/mp3
root@to:/mnt# ls -1 /mnt/mp3/Stefan\ Lakatos\ -\ Collectible\ Patterns/
cover.jpg
Stefan Lakatos - Collectible Patterns - 01 Anamande.mp3
Stefan Lakatos - Collectible Patterns - 02 Even uneven.mp3
Stefan Lakatos - Collectible Patterns - 03 Square Time.mp3
Stefan Lakatos - Collectible Patterns - 04 Sun Collector n°2.mp3
Stefan Lakatos - Collectible Patterns - 05 Frozen Footsteps.mp3
Stefan Lakatos - Collectible Patterns - 06 Collectible Pattern.mp3
Stefan Lakatos - Collectible Patterns - 07 Seven Twins.mp3

Remember: As of now all these mp3 files not not really exist, this is a virtual file system. Now if I file one of these files, it will take a tiny little while until I get a result back, it is now that the flac file is automatically converted to mp3. Readily tagged and everyting. No need to maintain separate music collections. Just awesome. Saves a lot of work. And a you can see, the cover file is also accessible just the way it should be.
root@to:/mnt# file mp3/Stefan\ Lakatos\ -\ Collectible\ Patterns/Stefan\ Lakatos\ -\ Collectible\ Patterns\ -\ 01\ Anamande.mp3
mp3/Stefan Lakatos - Collectible Patterns/Stefan Lakatos - Collectible Patterns - 01 Anamande.mp3: Audio file with ID3 version 2.4.0, extended header, contains: MPEG ADTS, layer III, v1, 128 kbps, 44.1 kHz, JntStereo

As you can see, the default value is 128 kbps. I usually mount for 192 kbps.
mp3fs -c 192 /mnt/flac/ /mnt/mp3/

This results in 192 kbps files, just as expected.
root@to:/mnt# file /mnt/mp3/Stefan\ Lakatos\ -\ Collectible\ Patterns/Stefan\ Lakatos\ -\ Collectible\ Patterns\ -\ 01\ Anamande.mp3
/mnt/mp3/Stefan Lakatos - Collectible Patterns/Stefan Lakatos - Collectible Patterns - 01 Anamande.mp3: Audio file with ID3 version 2.4.0, extended header, contains: MPEG ADTS, layer III, v1, 192 kbps, 44.1 kHz, JntStereo

As I am lazy I want to add this to /etc/fstab, which is also fairly simple. At the same time I want to have it mounted automatically, be able to access the mp3 files with my normal working account and as this is my every day PC I will allow myself to mount without root rights.
This is the fstab:
mp3fs#/mnt/flac /mnt/mp3 fuse noauto,ro,allow_other,default_permissions,uid=1000,gid=1000,users,bitrate=192 0 0
In order to grant myself the right to mount my mp3fs I need to edit /etc/fuse.conf as follows:
#user_allow_other
must be uncommented into
user_allow_other

Now that's it. I love mp3fs. It's one of those great tools you configure and forget but miss dearly once you do not have them at hand.
#dailyuse

Oh, and Stefan Lakatos used to be a Moondog companion. Highly recommended.
https://dronesweetdrone.bandcamp.com/album/collectible-patterns
HowTo convert legacy shorten shn files to flac

Open Source Musings | tobias
  
This is a note to self.
Shorten is a non-free legacy lossless audio file format which has been vastly superseded by flac by now. There will be no further development with SHN as the codec is no longer maintained. As with so many non-free software there is the looming danger of becoming totally obsolete and the files unreadable. Losing so much precious music, features and other audio recordings I saved in *.shn would hurt. Hurt like in heartbleed. So let's do something!

At the time of writing I am on Debian 9 Stretch (still aka Debian Testing). With enabled Debian Multimedia installing the required software was simple.
apt-get install shn-tool shorten
This is enough to do the job.
shntool conv *.shn
flac -8 *.wav

This can quite easily be combined. But before I did that I found a much more elegant solution, additionally requiring ffmpeg.
apt-get install ffmpeg
This is the for loop I found, which will become my oneliner of choice.
for f in *.shn; do ffmpeg -i "$f" "${f/%.shn/.flac}"; done