Skip to content

Instantly share code, notes, and snippets.

@rec
Last active July 15, 2017 15:18
Show Gist options
  • Save rec/5549605 to your computer and use it in GitHub Desktop.
Save rec/5549605 to your computer and use it in GitHub Desktop.
Installing SourceFabric's Airtime on a clean Ubuntu server running Virtualmin.

Installing SourceFabric's Airtime on a clean Ubuntu server running Virtualmin.

I'm documenting my experience installing SourceFabric's open source radio station manager Airtime on a clean server Ubuntu 12.04 LTS (Precise Pangolin) server running the popular Virtualmin open-source domain manager.

Virtualmin is sufficiently generic that I imagine the results will be useful to anyone trying to install Airtime on Ubuntu 12.04.

Before you start.

It took me quite a few tries before I completely the installation, and one of the things that I realized was that a partial installation will prevent the installation procedure from working.

If something goes wrong, you should consider completely uninstalling airtime and liquidsoap using apt-get remove, cleaning up the document files that it notifies you of, and then reinstalling.

Preparing your database - the dreaded UTF-8 error.

Many people seem to have gotten this error at some point in the proceedings:

Unfortunately your postgresql database has not been created using a UTF-8 encoding.

After experimenting on this clean system, I can say for sure that if you just install a brand-new, clean, release version postgresql with default settings and turn it on, you will get this error, and none of the fixes I've seen on the net work (and in many cases, like reinstalling postgresql from scratch, seemd unlikely to work before I tried them...)

But this this one is very close and you can adapt it to any Ubuntu as follows.

Go to a command line and enter the command pg_lsclusters.

You will see output like the following:

Version Cluster   Port Status Owner    Data directory                     Log file
9.1     main      5432 online postgres /var/lib/postgresql/9.1/main       /var/log/postgresql/postgresql-9.1-main.log

That version number might not be 9.1 on your system, depending on which version of Ubuntu you have - and there might be multiple entries if you already have postgresql databases, but in this case I don't.

Now enter the following commands, using your version number instead of 9.1:

pg_dropcluster --stop 9.1 main
pg_createcluster --start -e UTF-8 9.1 main

(Note that most commands I'm giving here need to be execcuted as root, or using sudo.)

Installating the program.

If you're on a server it's likely you have no GUI front-end. From here, the following commands install Airtime and Liquidsoap:

apt-get install -y gdebi
wget http://apt.sourcefabric.org/misc/airtime-easy-setup.deb
gdebi airtime-easy-setup.deb
apt-get update
apt-get install airtime

Multiple domain issues.

If you are on a multi-domain server, which is quite likely if you are running Virtualmin, you are going to get an error at the end of that last step - indeed, it might give you problems with your webserver because it creates another site on the same URL as the main site for your host!

Start by typing

rm /etc/apache2/sites-enabled/airtime-vhost
/etc/init.d/apache2 restart

to disable that new entry and then restart the webserver.

Now, decide on the domain name you're going to use to host the Airtime server, and create a domain entry on your Virtualmin control panel if you haven't already. In my case, I chose radio2.swirly.com.

You can't accomplish this next step through the Virtualmin control panel - you need to edit the Apache config files directly. Fire up your favorite editor and edit the config file for your domain - in my example, the file is called /etc/apache2/sites-available/radio2.swirly.com.conf.

You only need to make a few changes to this document.

1 - There is a line that starts DocumentRoot probably quite early in the file.

Replace that line with this one:

DocumentRoot /usr/share/airtime/public

2 - Right after that line, you should insert:

SetEnv APPLICATION_ENV "production"

<Directory /usr/share/airtime/public>
    Options -Indexes FollowSymLinks MultiViews +ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
    AddHandler fcgid-script .php
    FCGIWrapper /home/radio2/fcgi-bin/php5.fcgi .php
</Directory>

3 - Go to the line you just pasted in starting FCGIWrapper and change that address to point to your own domain.

4 - Save the configuration file, go to the command line and type /etc/init.d/restart apache2 to restart apache again.

If you tried to run the program right now, you'd see an error like this:

[Mon May 13 00:31:40 2013] [warn] [client 208.120.250.217] mod_fcgid: stderr: PHP Fatal error: Uncaught exception 'ErrorException' with message 'parse_ini_file(/etc/airtime/airtime.conf): failed to open stream: Permission denied' in /usr/share/airtime/application/configs/conf.php:23

You still need to...

Change Permissions

Go back to your terminal and type the following:

chown radio2 /etc/airtime/airtime.conf /var/log/airtime/zendphp.log
chgrp radio2 /etc/airtime/airtime.conf /var/log/airtime/zendphp.log

replacing "radio2" with whatever the username of your server is.

Now go back to your server again. Voila! You should see the startup page!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment