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 curl -y

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

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

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

./configure
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.

<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>/usr/local/var/log/icecast</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

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

wget https://gist.githubusercontent.com/ssamjh/500aa158cb77a8eff79c8d1763eef339/raw/cc90940a5c69c0f41750e7042838fff502c57c72/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.