Jump to content

Linux Shoutcast Server


Recommended Posts

I decided I would like to listen to my vast mp3 collection from anywhere. I went with shoutcast as I have several friends that use it and it looked like it would serve my needs perfectly. First you need to get the shoutcast source and to send the stream to the shoutcast server you will need to get sc_trans. I read that you can use winamp to stream to shoutcast but I don't use windows or winamp so I used sc_trans. It takes a playlist of mp3s and sends it to the server. The playlist is just a list of mp3s using full paths. I will include examples at the end of this little explanation.

First you should create a user to run the server and sc_trans { useradd shoutcast } You really don't want this to be ran as the root user for safety sake. Now that you have your user created you need to become that user with su { su - shoutcast } this will give you a login shell as the shoutcast user. Now let's grab the files you will need { wget http://www.shoutcast.com/downloads/sc1-9-5...x-glibc6.tar.gz && wget http://grep420.net/linux/sc_trans_040.tar.gz } Now that you have the files you need lets get them untar'd and gunzip'd. { tar -xvzf shoutcast-1-9-5-linux-glibc6.tar.gz && tar -xvzf sc_trans_040.tar.gz } First lets make this easier to work with { mv shoutcast-1-9-5-linux-glibc6 shoutcast } { mv sc_trans_040 sc_trans }

Now let's get started with the configuration. { cd shoutcast } Now you need to open the server configuration file in your text editor of choice. I use vi, so I would type vi sc_serv.conf you can usually find nano on your system if you are unable to figure out vi, or type vimtutor for a quick lesson on the basics of vi. Now that you have sc_serv.conf open you need to set a few values for this to work the way you want.

 

# sc_serv.conf

MaxUser=20 # set this to the maximun number of people you want to connect to the stream

Password=YourPassword # this is the password you use in the sc_trans.conf file

PortBase=8000 # this is the port it will listen on

AdminPassword=MyPassword # this is your admin login for the web based admin tool

 

That's all you really need to edit in the server conf. Save that file and go configure sc_trans. { cd ~/sc_trans } You will need to edit sc_trans.conf the same way we did sc_serv.conf

 

#sc_trans.conf

PlaylistFile=/home/shoutcast/playlist.lst # this is your list of mp3s you want to stream

ServerIP=localhost # most likely this is what you want

ServerPort=8000 # this is the port that you set in sc_serv.conf

Password=YourPassword # this is the password you set from above in sc_serv.conf, not the admin

StreamTitle=blah # set this to what you want displayed in the players

StreamURL=http://grep420.net # set this to your domain or the site you want

Shuffle=1 # set this to 0 if you don't want it to shuffle, it will play each sonf from your list in order

 

The playlist is very simple. It is just a list of each mp3 you want to stream. It needs full paths and the user shoutcast will need read access to the files. { chmod 755 /nfs/mp3 }

 

#example playlist.lst

/nfs/mp3/tool/pushit.mp3

/home/shoutcast/music/sublime/santeria.mp3

/home/flukex/mp3/Madonna/likeavirgin.mp3

 

Now you have them configured, here is the last tricky part. If you are using NAT ip's behind a linux router/gateway you will need to forward some ports to the internal ip of the shoutcast server. I will give you an example.

 

# iptables example is assuming eth0 is your external interface on the router/firewall box.

/sbin/iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 8000 -j DNAT --to 192.168.1.10:8000

/sbin/iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 8001 -j DNAT --to 192.168.1.10:8001

 

Now lets start the server. { cd ~/shoutcast && ./sc_serv sc_serv.conf & } and sc_trans { cd ~/sc_trans && ./sc_trans sc_trans.conf & } You will start to see the output of what is happening in your terminal. Now login to the web tool and check the status. Open your browser to the servers ip on port 8000 { http://192.168.1.10:8000 } You should be able to click on admin login and use the password you set in sc_serv.conf above.

 

I hope this works for you as easily as it did for me, and if I left anything out please feel free to post your questions here.

Edited by grep420
Link to post
Share on other sites
  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...