Create your own online radio stream in Ubuntu
Installation
sudo apt-get install icecast2 |
sudo apt-get install ices2 |
Ices2 installation ask you to join DecNet choose the third choise to skip configuration.
Icecast Configuration
Open a terminal window and issue the following command:
sudo gedit /etc/icecast2/icecast.xml |
We are going to change the source and the admin password. Locate authentication section (‹authentication›) in xml file. The source password is used to connect to the Icecast2 and the admin password is used to access the Icecast2 web interface. You can change username “admin” to something else by changing section ‹admin-user›. Choose your new passwords wisely.
To enable Icecast, open icecast2 file for editing by issuing the command:
sudo gedit /etc/default/icecast2 |
Locate line: Enable=false and change it to Enable=true to enable the init.d script.
Start the server-daemon
sudo /etc/init.d/icecast2 start |
Open Icecast web interface
Open your favorite web browser and open the url:
http://localhost:8000
Ices Configuration
First we have to create the necessary directories for ices2.
sudo mkdir /var/log/ices |
sudo mkdir /etc/ices2 |
sudo mkdir /etc/ices2/music |
Create Ices2 default configuration by executing the command below:
sudo cp /usr/share/doc/ices2/examples/ices-playlist.xml /etc/ices2 |
Open ices-playlist.xml file for editing:
sudo gedit /etc/ices2/ices-playlist.xml |
1. Locate ‹background› section and change value 0 to 1.
2. Locate ‹metadata› section and change name, genre and description according to your desires.
3. Locate ‹param name=”file”› and change it to something like this /etc/ices2/playlist.txt. This is the path to your playlist!
4. Locate ‹password› and change default value hackme to the same value as the source password from Icecast2.
Add music
Convert all your mp3 music to ogg.
Supposing you have all your mp3 music in a directory for ex /home/username/Music.
To convert all .mp3 files to .ogg files, open a terminal and issue the following commands:
cd /home/username/Music |
for x in *.mp3; do ffmpeg -i "$x" "`basename "$x"`.ogg"; done |
1. Copy ogg files to the Ices2 music directory, /etc/ices2/music.
2. Create playlist file /etc/ices2/playlist.txt by executing this command:
sudo touch /etc/ices2/playlist.txt |
3. Open playlist.txt file for edit:
sudo gedit /etc/ices2/playlist.txt |
and add each song to the playlist. One song per line.
Try this: Open a terminal and list files.
tree -if /etc/ices2/music/ > /etc/ices2/playlist.txt |
Open playlist.txt file for edit and remove /etc/ices2/music path in the first line and also remove the last line, which will look like this 0 directories, xx files. Remove empty lines. Your playlist.txt file will look like this at the end:
/etc/ices2/music/xxx.mp3.ogg /etc/ices2/music/yyyy.mp3.ogg /etc/ices2/music/aaaa.mp3.ogg
Start the stream
sudo ices2 /etc/ices2/ices-playlist.xml |
Test it
Open icecast web interface (refresh the page in case it was already opened):
http://localhost:8000 and test your stream.