3 HOWTO: setup your own Icecast server
Luka Prinčič edited this page 2020-05-22 18:26:26 +02:00

HOWTO: setup your own Icecast server

You need:

  • paypal with $5 or a credit/debit card

Steps in sumary:

  • create a virtual private server
  • login to the server
  • install icecast
  • start streaming with an app
  • embed the stream on another page (on a domain)
  • delete the server when you're done and save

Couple of notes:

  • I'm not affiliated with Digital Ocean, it's just something I use and seems easy and fast.
  • If you know your way around a command line terminal, it's great, but not necessary.
  • I'm not responsible for any loss of data

Create a virtual private server

At https://digitalocean.com create a new account (name, email, password), check and confirm link in email. After this you need to add billing information: credit card or paypal with 5$. In case of PayPal, you must top-up your Digital Ocean account with 5$. No toping-up necessary with cards.

Next write the name of your project ('radio' for example?), and choose 'just trying out digital ocean' and click start at the bottom.

Now, create a droplet - scalable virtual server. You can use the big plus-sign button in the middle of the page or green "Create" on top-right.

Choose an image (operating system): Ubuntu, with the latest LTS (currently 20.04).

Choose the cheapest, basic plan for 5$ and choose a datacenter region closest to you. Keep authentication setting default - password - and type in your chosen root password or passphrase (they are picky about special chars and so on). Click create droplet

It will take a little time to create the droplet (about 30sec max). In place of blue bar there will be an IP number (4 numbers separated with a dot). That IP is important. Copy it somewhere. Congratulate yourself.

Login to your droplet/vps

There are now two options to login to your new server - either with ssh or a web-based console. The latter is a bit slow, but totally works too. If you are comfortable with ssh and terminal and you have it installed on your computer, login with this: $ ssh root@IP.OF.THE.SERVER.

If not, you can use three dots at the right end side of that field that contains name of the droplet and it's IP. In the menu, choose 'access console'. After few seconds, a new black window will wait with a login: prompt. Type root, enter/return and then your root password (password will not be visible when you will type it). If you end up with something like root@ubuntu-s-1vcpu-1g-ams3-01:~# _ you are in the right place! Congratulations! You now have your own server in the cybrespace with root access. Got root?

Update packages and install icecast

Now here comes some typing. You first need to update knowledge about available packages (this is not system update or upgrade). Just write: apt update and press enter/return. It wil do some work and end up with the same prompt as before. Now let's install icecast server software: apt install icecast2 It will print out some information and ask if you want to continue. Press enter/return to confirm default ([Y]es).

apt package manager will now download and install icecast and all dependencies, but it will have questions. First, do you want to configure Icecast2? Use tab or cursor keys on keyboard to highlight < Yes > and press enter. Next question leave the default localhost (just press enter key). Next setup three passwords - source password will be needed by anyone who will want to stream to this server, relay password is irelevant for now, and admin password will enable you to monitor and control Icecast server via web interface. Use backspace and type any chosen password here (don't leave the default!).

After pressing the last enter key, apt will finish installations - wait till green progress bar gets to 100% and returns a prompt. Congratulations, your Icecast server is now ready to receive and server streams! In your browser go to: http://IP.OF.THE.SERVER:8000 and you will see webpage showing status of your Icecast server.

Get client software

Now you need to get some audio to the server. You need software that will encode audio to the right format and stream to the server with a password, port and mountpoint location. Just remember this is information that the server needs from the client app (and it from you):

  • IP or domain of the server (we don't have domain, but it's not necessary)
  • password for 'source' (that first one we entered when installing)
  • mountpoint - you can choose anything - it should end in .ogg (or .webm for video - topic for another HOWTO).
  • port is 8000 (default)
  • it's an Icecast not shoutCAST
  • user is always 'source'
  • supported format is ogg (not MP3) and supported audio codecs vorbis, opus, or flac.

What software should you use? It depends on the operating system, but many people recommend the Broadcast Using This Tool (B.U.T.T.) http://danielnoethen.de/butt/ for Mac & Win. You can also search for Ladiocast in Apple Store or Mixxx DJ software to stream to an Icecast. On linux I use DarkIce that also has a GUI called DarkSnow. It's also possible to use something like ffmpeg on the commandline:

ffmpeg -f jack -i ffmpeg_in -c:a flac -f ogg -content_type 'application/ogg' icecast://source:hackme12@134.209.249.117:8000/mystream.ogg

More apps are on icecast.org page.

Embed the stream in another page

After you configured the client and 'seemingly' started streaming you can check if that is really true by visiting the status page of the server at http://IP.OF.THE.SERVER:8000 . It should have a mountpoint there with a little player already embeded.

Now, the direct stream url is http://IP.OF.THE.SERVER:8000/mountpoint.ogg - whatever you have chosen for mountpoint. You can embed this address in another page (like on a blog) with some simple html tags for audio to have a player ready:

<audio controls="controls" preload="none">
  <source src="http://IP.OF.THE.SERVER:8000/mountpoint.ogg" type="audio/ogg">
  Your browser does not support the audio tag.
</audio> 

Delete. Until next time

It's most possible you will need to stream just temporarily. This is a beauty with DigitalOcean droplets - you can just delete (destroy) them and you will not be charged anything - just few cents probably - it's half cent for one hour. Just use the DO web interface and delete the droplet.

Of course, when you need the server again, you will need to create a droplet from scratch again, and it will have a different IP. But if you need the server only once in a while, 5$ is for many years of respawning like this. Or if you used credit card you don't have to use it at any point anymore.

An alternative to this is creating a snapshot before destroying it. You will be charged a little per month for it (5cents/GB/mo) but you can create a new droplet from that and won't need to reinstall Icecast2 again. It will however have a different root password and IP.