Should you run the server yourself?
Run it yourself if you want to control every setting, run several stations on one machine, or add Shoutcast's own tools such as sc_trans. You then look after the licence, the firewall, updates and the Directory key. If you just want a SHOUTcast station on the air, Primcast's SHOUTcast hosting gives you a real DNAS 2.6 server with none of that, and the last section explains how.
Either way the server itself is light work. It never re-encodes your audio; it passes on what your encoder sends. What it really uses is upload bandwidth: roughly your bitrate multiplied by your listeners, so 300 people on a 128 kbps stream is about 38 Mbps before network overhead. That sum is ours, not a Shoutcast number.
Getting sc_serv onto Ubuntu
Shoutcast offers the software free under its Basic plan, with Linux and Windows builds in 32 and 64 bits. Its licence agreement asks you to sign up as a Shoutcast member before you use it. Download the 64-bit Linux archive, then follow these steps in order. They are our own recommendation, not something Shoutcast's documentation prescribes:
- Create a user that can't log in and owns nothing else, so the radio server never runs as root.
- Unpack the archive into that user's folder and make
sc_servexecutable; skip this and Linux refuses to start it. - Make the log and list folders yourself. According to Shoutcast's documentation, sc_serv won't create them.
- Turn on the firewall before the first start, letting in SSH and the radio port.
- Write the settings file described below, and only then start the service.
sudo useradd --system --create-home --home-dir /srv/shoutcast --shell /usr/sbin/nologin dnas
sudo -u dnas tar -xzf /tmp/<the-archive-you-downloaded>.tar.gz -C /srv/shoutcast
sudo chmod a+x /srv/shoutcast/sc_serv
sudo -u dnas mkdir -p /srv/shoutcast/log /srv/shoutcast/lists
sudo ufw allow OpenSSH
sudo ufw allow 8000/tcp # listeners and SHOUTcast 2 encoders
# sudo ufw allow 8001/tcp # only if an old SHOUTcast 1 encoder must connect
sudo ufw enable
Put the archive in /tmp first: the dnas user may not be allowed to read your own home folder. If tar creates a subfolder, move what is inside it up one level so sc_serv ends up directly in /srv/shoutcast. Also check that /etc/default/ufw contains IPV6=yes; that line makes ufw guard IPv6 too, which matters because the server answers on every address it has.
The settings that trip people up
Save this as /srv/shoutcast/sc_serv.conf, swap in your own passwords, then run sudo chown dnas: /srv/shoutcast/sc_serv.conf and sudo chmod 600 /srv/shoutcast/sc_serv.conf. The server writes your Directory key into this file later, so it must stay owned by the dnas user.
portbase=8000
maxuser=400
password=PICK_A_LONG_ENCODER_PASSWORD
adminpassword=PICK_A_SEPARATE_ADMIN_PASSWORD
publicserver=never
logfile=/srv/shoutcast/log/sc_serv.log
w3clog=/srv/shoutcast/log/sc_w3c.log
banfile=/srv/shoutcast/lists/sc_serv.ban
ripfile=/srv/shoutcast/lists/sc_serv.rip
streamid_1=1
streampath_1=/radio
streamauthhash_1=
- maxuser is the most common surprise. Leave it out and the server stops at 32 listeners.
- portbase is the single port your audience and SHOUTcast 2 encoders use. A SHOUTcast 1 encoder can only connect one port higher.
- password is for whoever goes live. adminpassword opens the control pages. Keep them different, so a guest DJ can broadcast without being able to throw other sources off.
- streampath_1 gives the stream a friendly address: here
http://your-server:8000/radio. - publicserver=never keeps you out of the Directory until you are ready, whatever your encoder's "public" box says.
Shoutcast's notes on connection limits add one more: on Linux the count can stall at around a thousand listeners because of the system's open-file limit. The service file below raises it.
Keeping it running after you log out
The program can turn itself into a background process (./sc_serv daemon plus the settings file), but on a modern Linux it is simpler to let systemd start it in the foreground, restart it if it falls over and bring it back after a reboot. This unit is our suggestion; Shoutcast does not ship one.
# save as /etc/systemd/system/sc_serv.service
[Unit]
Description=SHOUTcast radio server
After=network-online.target
Wants=network-online.target
[Service]
User=dnas
WorkingDirectory=/srv/shoutcast
ExecStart=/srv/shoutcast/sc_serv /srv/shoutcast/sc_serv.conf
Restart=on-failure
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
Turn it on with sudo systemctl daemon-reload followed by sudo systemctl enable --now sc_serv. In your encoder, choose SHOUTcast 2 (or the v2 mode), enter your server's address, port 8000, stream ID 1 and the encoder password.
Your admin page shares a door with your listeners
The control page lives at /admin.cgi on the very port your audience uses, over plain http, with the username admin and your admin password. You cannot close it in the firewall without closing the station too. Our tip: open it through an SSH tunnel from your own computer, with ssh -L 18000:localhost:8000 you@your-server, and visit http://localhost:18000/admin.cgi while that window stays open.
From DNAS 2.6.1 the server can serve https itself, though only on Linux, never on Windows. You give it two lines in sc_serv.conf: sslCertificateFile=/path/to/cert.crt and sslCertificateKeyFile=/path/to/key.pem. Shoutcast points out that the certificate has to be issued for a DNS name such as stream.example.com, not a bare IP address. Treat the key like the settings file: owned by dnas, chmod 600.
Avoid the shortcut of adding the password to the admin link. The documentation allows it, but a password in a link ends up in your browser history and in log files.
How do you get into the SHOUTcast Directory?
You need an authhash, the key the Directory uses to validate your server; private stations can skip it. An archived Shoutcast wiki page describes the original route, but it dates from early DNAS 2.0 builds (it mentions v2.0.0 Build 29; last edited April 2015), well before 2.6.1. There, with your encoder connected, you log in to the admin page, pick Create Authhash under your stream, and fill in any details the server could not read from your encoder; the key is then written into the empty streamauthhash_1 line for you. No Create Authhash link on your admin page? Get the key from your free SHOUTcast RadioManager account, the same place Primcast's panel takes it from, and copy it into the streamauthhash_1 line by hand. Then change publicserver to always, or to default if you want your encoder's public setting to decide, and restart.
- Give it time: according to that wiki page, a new or changed key can take up to 10 minutes to register.
- Moving servers? According to that wiki page, changing or removing the key has to happen from the same outside IP address that created it.
- Error 480 in the log means the Directory could not reach you: check the firewall and any router in between. Error 470 means the key itself is wrong.
- Same show at two bitrates? Each can have its own key, so both appear in the listings.
Free or paid licence: what changes
Shoutcast's server software licence (last updated 30 August 2018) has a free tier it calls Freemium and a paid one called Premium. Read in its own words, the free tier gives you streaming in MP3 at 128 kbps only, unlimited radio stations, a place in the Shoutcast Directory, limited statistics in Radio Manager and ad replacement as the only way to earn from ads.
Premium, paid monthly or yearly for one running copy of the software, adds MP3 and AAC up to 320 kbps, a ceiling of 12,000 unique listeners per server, a backup URL for your stream, your own SSL certificate, full statistics, ad injection and email support. Miss a monthly Premium payment and Shoutcast tries the charge twice more; if that still fails, the agreement moves you down to Freemium no later than 28 days after the renewal date, and Shoutcast keeps the right to shut down any station streaming in a format the free tier does not cover (anything other than MP3 128). On a yearly subscription, the agreement keeps the right to restrict you to Freemium. The licence also bans fake audiences such as muted players or bots.
Or let Primcast run the DNAS for you
Every Primcast station starts on Icecast 2.5. Flip one setting in your control panel whenever you like and the station switches over to SHOUTcast DNAS 2.6, on any plan including Free, with its admin and status pages yours to use. Add your authhash in the panel (it comes from your free SHOUTcast RadioManager account) and your server reports the station to the Directory. Your listener stats, station page, airplay log and licence records all stay, and Auto DJ comes with Premium and Platinum.
Your plan sets how good you can sound and how many can listen: Free carries 32 Kbps for 1,000 people at once, Premium 128 Kbps for 2,500, and Platinum 320 Kbps for 5,000. An encoder set above your plan's limit is disconnected. Primcast owns the servers, in New York and Bucharest. Compare the plans on our radio hosting page.
Prefer the do-it-yourself route on hardware of your own? A dedicated streaming server is a whole machine on an unmetered port, and every step on this page works on it. When one station outgrows one box, our guide to Icecast relays shows how to spread listeners out.
Questions people ask
- How many people can listen to a home-built SHOUTcast server?
- Out of the box, 32, because that is the default
maxuser. Raise that number, lift the open-file limit, and after that your upload bandwidth is what stops you. Shoutcast's paid Premium licence names 12,000 unique listeners per server as its ceiling. - My old encoder will not connect. What is wrong?
- SHOUTcast 1 encoders, the classic kind that ask only for a password, connect one port above
portbase, so 8001 on a default setup. Open that port in the firewall as well as 8000. Newer SHOUTcast 2 encoders need only 8000, plus a stream ID. - Can I stream AAC or 320 kbps on the free licence?
- Not according to Shoutcast's licence agreement, which allows only MP3 at 128 kbps on the free Freemium tier. AAC and bitrates up to 320 kbps are listed under the paid Premium licence.
- Do I need an authhash for a private station?
- No. The key is only for appearing in the SHOUTcast Directory. Set
publicserver=neverand your station simply stays off the listings while still playing for anyone who has the link. - Is SHOUTcast available on Primcast's free radio plan?
- Yes. Free, Premium and Platinum all have the DNAS 2.6 switch in the control panel, so you do not need to upgrade to run SHOUTcast.