How To Create Your Own Music Stream With Icecast [Linux]

Danny Stieben 05-05-2011

create music streamThere are a handful of people who find creating their own streams a useful thing to do, for whatever reason they want or need. Ever since the YouTube era started video streaming has been hot and music/audio streaming is still a pretty common thing to find. The process in Linux, though pretty easy for basic configuration, is somewhat lengthy.



Icecast is actually just the service that will stream the audio that is played by another music daemon. In this article we’ll be using mpd, which is an accepted combination by most people. The instructions will, for the most part, work in any Linux distribution, though I will be specifically covering Ubuntu and Fedora 4 Recommended Linux Distros To Help You Choose The Right One For You When you finally decide to take the plunge and have a stroll through Linux Avenue, you'll need to be able to decide which distro is right for you. Making the right choice is an important... Read More . Unless there are major differences in the commands, Ubuntu users will need to add “sudo” to the front of each command that I cover where root permissions are needed (which is a large portion). All commands will not include the quotation marks.

These instructions are for a simple setup, and is not the securest way to do things. If you wish to create your own music stream and share it publicly and not within your network, please make sure that you follow appropriate security measures.


Installing & Configuring MPD

The first thing is to install mpd, so fire up your terminal. Fedora users need to switch to root by typing “su –” and entering their passwords. Then, in Fedora, issue the command “yum install mpd“, while Ubuntu users use “sudo apt-get install mpd“. Once that completes, use your favorite terminal editor (such as nano) to edit the file at /etc/mpd.conf.

In the first couple of lines, find the following and replace them with your regular username (or create a new user specifically for Icecast and use that instead):

music_directory                 "/home/USER/music"
playlist_directory              "/home/USER/music/playlists"
db_file                         "/home/USER/.mpd/mpd.db"
log_file                        "/home/USER/.mpd/mpd.log"
error_file                      "/home/USER/.mpd/mpd.error"

Soon after that chunk of text will be a small line, where you again need to replace the user with the one you wish to use:

user                            "USER"

Next, find the following text and make sure it matches:

bind_to_address       ""
port                            "6600"

Finally, find a large chunk that looks similar to this (in Fedora, it is the third “audio_output” group in the default configuration file):

audio_output {
type                    "shout"
name                    "Stream short description"
host                    "localhost"
port                    "8000"
mount                   "/mpd.ogg"
password                "hackme"
quality                 "5.0"
#        bitrate                 "128"
format                  "44100:16:2"
#        user                    "source"                # optional
#        description             "My Stream Description" # optional
#        genre                   "jazz"                  # optional
#        public                  "no"                    # optional

Change the information in your own configuration file to match them with the code above. For simple use, you can keep the “hackme” password, but if you wish to share your stream with the Internet, I highly recommend you change it. Once you are done editing the file, save it and close out of your editor.

Next, leave your root permissions (or drop off the sudo if you use Ubuntu) and type the following:

cd $HOME
mkdir -p music/playlists
mkdir .mpd

This creates the necessary folders that the mpd daemon needs as described in the configuration file.

Installing Icecast

create music stream

Next we will install Icecast, so Fedora and Ubuntu users need to type (as root) “yum install icecast” and “sudo apt-get install icecast“, respectively.

If you didn’t change the password in mpd, then there’s no configuration needed for Icecast! However, if you did use a different password or want to change port numbers, you can change all instances of those in the configuration file, which is located at /etc/icecast.xml.


Installing & Configuring Pitchfork

Congratulations! You already have all of the background services installed and configured! However you still need an interface to configure mpd, else it won’t know what to play. I recommend that you use a Web-based configuration tool called Pitchfork. In order to be able to run that, we need to install some more packages.

In Fedora, we’ll type “yum install httpd mysql-server php php-mysql php-gd php-pear“. In Ubuntu, it’ll be “sudo apt-get install apache2 mysql-server libapache2-mod-php5 php5 php5-mysql php5-gd php5-pear“.

Once that finishes installing, download Pitchfork from here and extract the files into Apache’s default folder, which is either /var/www or /var/www/html depending on the system. In order to keep things easy for us, type the following:

chown -R apache:apache /var/www OR chown -R apache:apache /var/www/html
chmod -R 777 /var/www/config OR chmod -R 777 /var/www/html/config

Before we get to the more fun parts, we still need to start our services. We have three services, httpd (or apache2 in Ubuntu), Icecast, and mpd. So in Fedora, we’ll type “service <NAME> start“, replacing <NAME> with the service’s name. In Ubuntu, do the same for the command “sudo /etc/init.d/<NAME> start“.


Now fire up your favorite browser and head to localhost (or if you’ve been doing all these steps on a separate server, head to that server’s address). You should now be greeted by Pitchfork, and we can go ahead and configure it.

create streaming music

Under the configuration page, there’s actually not much you need to do. Just make sure that the address and port are the same as in mpd’s configuration file, and leave the password field blank. In the middle you can enter a login password so that access to Pitchfork can be restricted. Save and you’ll be sent back to the main page. Now you can add songs and have them play over Icecast!

create streaming music

If you want to connect to your stream, there’s an easy way to do so. Provided that you open port 8000, you can go to a different computer, go to a browser and type <IP_ADDRESS>:8000, and click on the M3U link. You’re finally done!

create music stream

Final Considerations

Please note that on Pitchfork the volume slider does not work. However, your media player should have one, so that shouldn’t be a problem. Also, when adding songs, they may not immediately appear. In this case you should simply refresh the page.

Considering the steps needed, I will provide some support in the comment section. If you have problems, ask for help there!


Icecast is a great way to get music on the go. Plus who doesn’t want their personal online radio station? Creating your own music stream can have its purposes and let you have some fun as well.

Do you think you’ll be creating a music stream? What do you like or not like about the idea? Let us know in the comments!

Image Credit: Shutterstock

Related topics: Media Server, MP3.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Deepak Chawla
    April 23, 2017 at 11:57 am

    A error occur while running service mpd start.
    Error : Job for mpd.socket failed. See "systemctl status mpd.socket" and "journalctl -xe" for details.
    Loaded: loaded (/lib/systemd/system/mpd.socket; enabled; vendor preset: enabled)
    Active: failed (Result: resources)
    Listen: /run/mpd/socket (Stream)
    [::]:6600 (Stream)
    How to solve it..??

  2. Akhim
    May 6, 2011 at 7:07 pm

    Thanks Danny for this interesting read, but it looks rather complicated ;-)

    Personally i found Mixxx very nice and it also allows to get your own music stream online the easy way.
    Mixxx is free software and available for Linux, Windows, MacOS.

  3. Akhim
    May 6, 2011 at 5:07 pm

    Thanks Danny for this interesting read, but it looks rather complicated ;-)

    Personally i found Mixxx very nice and it also allows to get your own music stream online the easy way.
    Mixxx is free software and available for Linux, Windows, MacOS.