Install icecast with the package manager of your choice or build it from source. Once it's installed the configuration file will need to be edited. It's typically located in /etc/icecast2/icecast.xml
<listen-socket>
<port>8000</port>
<!-- <bind-address>127.0.0.1</bind-address> -->
</listen-socket>Next you need to make these mounts, I like to call them channels. The mount-name should be unique for each mount. You can define extra properties as well such as a username/password to access the channel and max listeners. I have for obvious reasons edited my password but it is important to note how it will affect your URL.
<mount>
<mount-name>/jim.ogg</mount-name>
<username>jim</username>
<password>clip</password>
<max-listeners>10</max-listeners>
<!-- <dump-file>/tmp/dump-example1.ogg</dump-file> use dump-file to record what you stream -->
<burst-size>65536</burst-size>
<hidden>1</hidden>
<no-yp>1</no-yp>
<on-connect>/home/icecast/bin/stream-start</on-connect>
<on-disconnect>/home/icecast/bin/stream-stop</on-disconnect>
</mount>I don't think the on-connect or on-disconnect properties are actually necessary but in some configurations could be useful.
With this example the url would be http://jim:clip@jlporter.com:8000/jim.ogg
It breaks down like this http://username:password@hostnameOrDomainName:port#/mount-name.ogg
Depending on your system you might may or may not have init scripts, but I start icecast with /etc/init.d/icecast start
I think that you have to restart when you change the configuration. So this has icecast setup, but you are probably asking yourself how do I get it to play my music. Next install mpd if you don't already have it. I will demonstrate how to setup mpd running as a user. Normally you run mpd locally system wide so any user can control the music that plays to your system speakers, however here we want each user to have their own instance of mpd and it will stream to icecast.
On to setup mpd as a user. First you will need to create a .mpd/ directory that will contain the resources that are usually hidden in the system.
jim@jlporter ~ $ ls -l .mpd/
total 1792
-rw-r--r-- 1 jim cron 1285211 2009-07-16 23:39 database
-rw-r--r-- 1 jim cron 624 2009-07-13 15:24 mpd.conf
-rw-r--r-- 1 jim cron 0 2009-07-13 15:10 mpd.error.log
-rw-r--r-- 1 jim cron 523198 2009-07-16 23:39 mpd.log
-rw-r--r-- 1 jim cron 6 2009-07-15 14:24 mpd.pid
drwxr-xr-x 2 jim cron 4096 2009-07-13 15:09 playlists
-rw-r--r-- 1 jim cron 2448 2009-07-24 17:44 stateNow the most relevant thing to configure is the ~/.mpd/mpd.conf similar to this:
music_directory "/space/music"
playlist_directory "~/.mpd/playlists"
db_file "~/.mpd/database"
log_file "~/.mpd/mpd.log"
error_file "~/.mpd/mpd.error.log"
pid_file "~/.mpd/mpd.pid"
state_file "~/.mpd/state"
user "jim"
port "6601"
audio_output {
type "shout"
name "music"
host "jlporter.com"
port "8000"
encoding "ogg" # optional
mount "/jim.ogg"
password "clip"
#quality "5.0"
bitrate "128"
format "44100:16:1"
user "jim"
}I'm using my system wide music directory and then the other files(playlist/db/error/pid/state) in the ~/.mpd/ directory. This makes is so that if I change my playlist or add music to my db it won't affect the other users stream. The user needs to be your unix username that mpd will run as and port needs to be unique to your user(eg: user2 will run mpd on 6602). The audio_output section is what tells mpd to not output to your system speakers(via alsa or oss), but instead uses the shoutcast protocol to send audio to my icecast channel.
At this point you should be able to start mpd as your user and it will be ready to stream out to icecast. To control mpd(and therefore your stream) you can use something like ncmpc. Since mpd will be running on a port that is not the default we need to let ncmpc know how to connect.
jim@jlporter ~ $ ncmpc --port 6601Since it's annoying to remember your port number every time I added this line to my ~/.bashrc
export MPD_PORT="6601"
Next time you login or if you "source ~/.bashrc" then you can simply type ncmpc and it will connect. At this point the mpd database has probably not been updated so hit ctrl + u in ncmpc and it will tell mpd to update. If it doesn't add your music, make sure you have the right privileges and that your music_directory is set correctly. In ncmpc you hit tab to switch between the playlist and the browse screen. Arrow up and down works as expected and you can hit enter in browse to go into a directory. Hit space when browsing to add a song(or directory) to the current playlist. To play a certain song immediately hit enter on the song in browse or in playlist. There are guides out there that cover ncmpc better than I just did, but that's the basics.
So assuming that you see ncmpc "playing" music, you are ready to listen to your stream. I like to use mplayer and it would look something like this:
jim@jim-desktop:~$ mplayer http://jim:clip@jlporter.com:8000/jim.ogg
If you don't like mplayer or are stuck on a friends windows/mac machine you can use something like vlc to listen to your stream(and putty or terminal on mac to change what's playing)