Setting Up A Streaming Music Server
One thing I love to do is configure my computer to stream music over the Internet and then connect to it from work and listen to my own music on-demand. Combined with a remote connection, I can control the play list virtually in real time. Needless to say, this is something, much like remote connection, that once you have it you can’t go back.
Basically, a streaming audio server works by taking music files on your computer, decoding them and re-encoding them on the fly to a temporary file which is served to the listener. When you listen to a stream on the Internet you download a very small MP3 or Ogg Vorbis file which is the temporary file and is constantly changing. If this seems confusing, rest assured you do not have to know how it works to set it up. In this article I will be using Icecast2 for the streaming music server and Ices2 for the decoder/encoder. Just follow these steps:
- Open Synaptic Package Manager
- Install the packages “aumix-gtk”, “icecast2″, and “ices2″
- Open a terminal
- Open Aumix by entering:
aumix
- Click the box under “Rec” next to “Vol”, this sets Ubuntu to record (hence, stream) “what you hear”
- Close Aumix
- Create a configuration directory for Icecast2:
mkdir ~/.icecast2
- Copy the default Icecast2 configuration:
sudo cp /usr/share/doc/icecast2/icecast_minimal.xml.dist ~/.icecast2/icecast2_config.xml
- Now edit the default configuration:
gedit ~/.icecast2/icecast2_config.xml
- Under the Authentication section, change the password to something other than “hackme”
Note: You do not have to remember this password, so use something obscure. DO NOT use your root password. - Under the Paths section, change the LogDir to “/home/[your_user_name]/.icecast2″
- To secure the Icecast2 server, add this under the Logging section:
<security>
<chroot>0</chroot>
<changeowner>
<user>icecast2</user>
<group>icecast</group>
</changeowner>
</security> - Save the changes and close gEdit
- Create a configuration directory for Ices2:
mkdir ~/.ices2
- Copy the default Ices2 configuration:
sudo cp /usr/share/doc/ices2/examples/ices-alsa.xml ~/.ices2/ices2_config.xml
- Now edit the default configuration:
gedit ~/.ices2/ices2_config.xml
- Change the text under Metadata to reflect your information
- Change the LogPath to “/home/[your_user_name]/.ices2″
- Under the Input section, change the Rate parameter to 48000
- Under the Instance section, change the following:
password= Icecast2 password you set above
mount= /music.ogg
samplerate= 48000
channels= 2
downmix= 0
in-rate= 48000
out-rate= 48000 - Save the changes and close gEdit
- Make the Icecast2 and Ices2 configuration directories readable and writable to everyone:
sudo chmod -R 0777 ~/.icecast2
Note: Don’t worry, after doing this your system is still safe. The security entries we made above prevent a potential attacker from doing any damage.
sudo chmod -R 0777 ~/.ices2 - Close the terminal
Finally done with the setup, don’t worry you will not have to do that again. Now to actually stream music, do this:
- Open a Terminal
- Start the Icecast2 server:
sudo icecast2 -c ~/.icecast2/icecast2_config.xml
- Open a new terminal tab (File > Open Tab > Default)
- Start the Ices2 coder:
sudo ices2 ~/.ices2/ices2_config.xml
- Open your favorite music player and start playing, anything that would normally play from your computer speakers will be streamed to connected clients
- Close the terminal
- Make sure you forward ports 8000 and 8001 on your firewall
Since the stream is broadcast in Ogg Vorbis format, you will need a player capable reading the format. I use Rhythmbox in Ubuntu and Winamp for Windows. Combine this with remote connection and you have access to your entire music library from any computer. To connect, simply open the location: http://[your ip or domain name]:8000/music.ogg.
Happy listening!

Like what you read?
If so, please join over 28,000 people who receive our exclusive weekly newsletter and computer tips, and get FREE COPIES of 5 eBooks we created, as our gift to you for subscribing. Just enter your name and email below:








