Categories
Tutorials

How to install icecast-kh on Ubuntu Server

Intro

icecast2 is a great piece of software, but these days it seems somewhat largely unmaintained.

Well, great news – icecast-kh is here! It’s an updated fork of icecast2 with great new features.

In this guide you will learn how to install your own copy an Ubuntu server!

Video

Requirements

  1. An Ubuntu Server (this guide written using 20.04) and access to the root account
  2. About 5 minutes of your time

Installation

Update our servers repository.

apt-get update
apt-get dist-upgrade -y

Install some icecast-kh requirements.

apt-get install build-essential libxslt-dev libvorbis-dev libxml2 libssl-dev curl -y

Get the latest version of icecast-kh. At the time of writing this is 2.4.0-kh20.1. Download page here.

wget https://github.com/karlheyes/icecast-kh/archive/icecast-2.4.0-kh20.1.tar.gz
tar -xvf icecast-*.tar.gz
cd icecast-kh-icecast-2.4.0-kh20.1

Compile and install. If you run into any issues here, make sure you have all the dependencies installed (listed here).

./configure --with-openssl
make
make install

Move the default config to the /etc directory. Opitionally we may use the more advanced icecast.xml.dist file but for simplicity we are using the minimal.

mkdir -p /etc/icecast-kh
cp /usr/local/share/icecast/doc/icecast_minimal.xml.dist /etc/icecast-kh/icecast.xml

We need to make some changes to our config file, so open it with your favourite text editor – I’m using nano.

nano /etc/icecast-kh/icecast.xml

The config file will look something like this. Update the highlighted lines with your own details. Make sure to set the logdir path to the text shown.

<icecast>
    <limits>
        <sources>2</sources>
    </limits>
    <authentication>
        <source-password>hackme1</source-password>
        <relay-password>hackme2</relay-password>
        <admin-user>admin</admin-user>
        <admin-password>hackme3</admin-password>
    </authentication>
    <directory>
        <yp-url-timeout>15</yp-url-timeout>
        <yp-url>http://dir.xiph.org/cgi-bin/yp-cgi</yp-url>
    </directory>
    <hostname>localhost</hostname>
    <listen-socket>
        <port>8000</port>
    </listen-socket>
    <fileserve>1</fileserve>
    <paths>
        <logdir>/var/log/icecast-kh</logdir>
        <webroot>/usr/local/share/icecast/web</webroot>
        <adminroot>/usr/local/share/icecast/admin</adminroot>
        <alias source="/" dest="/index.html"/>
    </paths>
    <logging>
        <accesslog>access.log</accesslog>
        <errorlog>error.log</errorlog>
      	<loglevel>3</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error -->
    </logging>
</icecast>

Add a user for icecast-kh. Leave all the fields blank.

adduser icecast --disabled-login

Create a log directory and change permissions.

mkdir -p /var/log/icecast-kh
chown -R icecast:icecast /var/log/icecast-kh/

Install the init.d script. View the code here.

wget https://gist.githubusercontent.com/ssamjh/500aa158cb77a8eff79c8d1763eef339/raw/fb0a4a2d39a87affb46fc598e07da668670188fd/icecast-kh -O /etc/init.d/icecast-kh
chmod 777 /etc/init.d/icecast-kh
update-rc.d icecast-kh defaults

And finally start the server.

systemctl start icecast-kh
systemctl enable icecast-kh

Final Notes

And that’s it! Your new icecast-kh server is up and running on port 8000.