Skip to content

This site uses analytics to understand how it's used. No personal data is sold or shared.

← Back to Blog
Icecast2 - Install for Ubuntu 22

Icecast2 - Install for Ubuntu 22

·5 min read
radioicecastlive-streamingubunturepoppasystemd

Icecast

I had an old version of icecast (v2.4.4), and wanted to update it, but did not want to compile everything from source. It turned out to be a lot of work, but I learned something new, and that is what counts.

About icecast

Website

Icecast is a streaming media (audio/video) server which currently supports Ogg (Vorbis and Theora), Opus, WebM and MP3 streams. It can be used to create an Internet radio station or a privately running jukebox and many things in between. It is very versatile in that new formats can be added relatively easily and supports open standards for communication and interaction.

Icecast is distributed under the GNU GPL, version 2.

Why I use it

I use icecast to enable me to have my very own internet radio station! I play/dj music using mixxx and stream it via icecast to my radio website.

Adding the official repo

The title is actually misleading... there really isn't an official repo, but there is. After digging around, I found the repo source here for Ubuntu 22 (jammy).

So the next step was to add a custom repo inside /etc/apt/sources.list.d. I called it icecast.list. Then, I put in the information:

deb [signed-by=/etc/apt/keyrings/icecast-archive-keyring.gpg] https://download.opensuse.org/repositories/multimedia:/xiph/xUbuntu_22.04/ jammy main

Then, all you need to do is sudo apt update && sudo apt install icecast2. Success! Wait... no. I get an error:

E: The repository 'https://download.opensuse.org/repositories/multimedia:/xiph/xUbuntu_22.04 jammy Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Okay. So the repo isn't a standard one that my other manually added ppa use. After googling a bunch, I land at this in my icecast.list file:

deb [signed-by=/etc/apt/keyrings/icecast-archive-keyring.gpg] https://download.opensuse.org/repositories/multimedia:/xiph/xUbuntu_22.04/ /

After I sudo apt update, alas, a new error/warning appears:

E: The repository 'https://download.opensuse.org/repositories/multimedia:/xiph/xUbuntu_22.04  InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Of course! I didn't get the gpg key. That's easy. Let's use the key as explained on the icecast website.

curl -sS https://icecast.org/multimedia-obs.key | gpg --dearmor | sudo tee /etc/apt/keyrings/icecast-archive-keyring.gpg > /dev/null
echo "deb [signed-by=/etc/apt/keyrings/icecast-archive-keyring.gpg] https://download.opensuse.org/repositories/multimedia:/xiph/xUbuntu_22.04/" | sudo tee /etc/apt/sources.list.d/icecast.list

Now everything should work... right? WRONG. Now, I get this error:

W: GPG error: https://download.opensuse.org/repositories/multimedia:/xiph/xUbuntu_22.04  InRelease: The following signatures were invalid: EXPKEYSIG 77EC2301F23C6AA3 multimedia OBS Project <multimedia@build.opensuse.org>
E: The repository 'https://download.opensuse.org/repositories/multimedia:/xiph/xUbuntu_22.04  InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

So the key that I am supposed to use... is expired. Wonderful. After more googling, it gets me to the gpg key that I am supposed to use.

Substitute that new URL in, and it still does not work!

What else can I try? Well, I also have prosody on my server, and it doesn't use a .list, but a .sources file. Let's try that.

sudo nano /etc/apt/sources.list.d/icecast.sources with these contents from prosody:

Suites: jammy
Types: deb
Architectures: amd64 arm64
Components: main
Uris: https://download.opensuse.org/repositories/multimedia:/xiph/xUbuntu_22.04/
Signed-By: /etc/apt/keyrings/icecast-archive-keyring.gpg

But, alas... moar ERroRs!

E: The repository 'https://download.opensuse.org/repositories/multimedia:/xiph/xUbuntu_22.04 jammy main' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Even more googling later, we arrive at this:

Suites: ./
Types: deb
Architectures: amd64 arm64
Components:
Uris: https://download.opensuse.org/repositories/multimedia:/xiph/xUbuntu_22.04/
Signed-By: /etc/apt/keyrings/icecast-archive-keyring.gpg

SUCCESS!

Installing

After I finally got the repo sorted out, it was as simple as sudo apt update && sudo apt install icecast2. It did give me another error when installing:

Configuring icecast2..
Done Configuring icecast2..
chown: cannot access '/var/log/icecast2': No such file or directory
dpkg: error processing package icecast2 (--configure):
 installed icecast2 package post-installation script subprocess returned error exit status 1
Processing triggers for libc-bin (2.35-0ubuntu3.13) ...
Errors were encountered while processing:
 icecast2
E: Sub-process /usr/bin/dpkg returned an error code (1)

So, I typed sudo mkdir /var/log/icecast2. Installed again, this time it was successful.

Auto-starting

Because I had already had icecast up and running, all I had to do was change a few items in my systemd service file. But here it is if you need it:

#/etc/systemd/system/icecast.service
[Unit]
Description=Icecast - Music
After=network-online.target
Wants=network.target network-online.target

[Service]
Type=idle
ExecStart=icecast2 -c /etc/icecast2/icecast.xml
User=icecast2
Group=icecast
Restart=on-failure
RestartSec=5
StartLimitBurst=3
StartLimitInterval=60s

[Install]
WantedBy=multi-user.target

To activate it, you would do sudo systemctl enable icecast.service. And to start sudo systemctl start icecast.service.

BUT, don't do this first! You need to configure your server (if you didn't when installing).

Configuring

sudo nano /etc/icecast2/icecast.xml. Slowly go through this file and make sure everything looks good.

If you ever change anything in this file, you need to restart the service: sudo service icecast restart

Mixxx configuration

In Mixxx, press Ctrl + P, to open up Preferences, locate Live Broadcasting, and configure it to match your icecast settings. Then Apply, Ok.

Final thoughts

My radio station is called "Polyjamorous" and plays a vast variety of music. I eventually will create a repo for it so you can have your own! More to come on this later though.

  • dan