Thursday, December 12, 2013

Cara install icecast2 di ubuntu atau vps

Untuk Langkah-langkahnya kurang lebihnya begini :

#  apt-get install gcc make zip  build-essential pkg-config libxml2-dev icecast2 ezstream

Rubah Configuring Icecast2 seperti contoh di bawah, atau sesuai selera anda passwd dan admin nya :
Cari baris-pentingnya saja.

#  nano /etc/icecast2/icecast.xml

<authentication>
<!-- Sources log in with username 'source' -->
<source-password>12345</source-password>
<!-- Relays log in username 'relay' -->
<relay-password>12345</relay-password>

<!-- Admin logs in with the username given below -->
<admin-user>admin</admin-user>
<admin-password>12345</admin-password>
</authentication>

<!-- This is the hostname other people will use to connect to your server.
    It affects mainly the urls generated by Icecast for playlists and yp
    listings. -->
    <hostname>Musik online</hostname>

    <!-- You may have multiple <listener> elements -->
    <listen-socket>
        <port>30001</port>
        <!-- <bind-address>127.0.0.1</bind-address> -->
        <!-- <shoutcast-mount>/stream</shoutcast-mount> -->
    </listen-socket>
    <!--

===Starting Icecast2 after reboot :--Auto Dj... supaya saat reboot icecast2 selalu online.

# nano /etc/default/icecast2

Di file ini Anda cukup mencari baris terakhir yang berisi
ENABLE=false
 ganti Menjadi...
# Edit /etc/icecast2/icecast.xml and change at least the passwords.
# Change this to true when done to enable the init.d script
ENABLE=true


Test run the Icecast2 :--
# service icecast2 restart
====Test masuk ke. http://ip.address:30001/   <-- kalo berhasil masuk, berarti sukses intall.
cek apakah bener icecast2 sudah LISTEN di port 30001 :
#  netstat -ano | grep 30001
alhasil :
root@serverku:~# netstat -ano | grep 30001
tcp        0      0 0.0.0.0:30001           0.0.0.0:*               LISTEN

oke lanjut kelangkah berikut ya
Creating Playlist and configuring ezstream

Menyimpan file mp3. kita dapat menggunakan folder apapun,
tapi untuk tutorial ini saya menggunakan / home/mp3

# cd /home
# mkdir mp3
# cd /home/mp3

# nano /home/mp3/playlist.txt
/home/mp3/judul lagu.mp3
/home/mp3/judul lagu.mp3
/home/mp3/judul lagu.mp3
/home/mp3/judul lagu.mp3

Ket. isi playlist.txt, harus sama judul yang ada di file mp3.
di dalam folder mp3.


Configuring ezstream :--

Secara default, kita sudah memiliki contoh konfigurasi ezstream
terletak di :  /usr/share/doc/ezstream/examples,
sehingga kita dapat menyalin dan mengkonfigurasi, ke root.

#  cp /usr/share/doc/ezstream/examples/ezstream_mp3.xml /root/ezstream_mp3.xml
Selesai kopas edit file nya. yang terletak di : /root/ezstream_mp3.xml

#  nano /root/ezstream_mp3.xml

<!--
EXAMPLE: MP3 playlist stream WITHOUT reencoding

This example streams a playlist that contains only MP3 files. No other file
formats may be listed. Since ezstream will not be doing any reencoding, the
resulting stream format (bitrate, samplerate, channels) will be of the
respective input files.
-->
<ezstream>
<url>http://ip.addressesrver:30001/stream</url>
<!--
If a different user name than "source" should be used, set it in
<sourceuser/>:
-->
<!-- <sourceuser>mr_stream</sourceuser> -->
<sourcepassword>12345</sourcepassword>
<format>MP3</format>
<filename>/home/mp3/playlist.txt</filename>
<!-- Once done streaming playlist.m3u, exit: -->
<stream_once>0</stream_once>
<!--
The following settings are used to describe your stream to the server.
It's up to you to make sure that the bitrate/samplerate/channels
information matches up with your input stream files. Note that
<svrinfoquality /> only applies to Ogg Vorbis streams.
-->
<svrinfoname>Suara PujieDotNet</svrinfoname>
<svrinfourl>http://ip.addresserver:30001/stream</svrinfourl>
<svrinfogenre>All Musik</svrinfogenre>
<svrinfodescription>Musik Semua Umur</svrinfodescription>
<svrinfobitrate>64</svrinfobitrate>
<svrinfochannels>2</svrinfochannels>
<svrinfosamplerate>22050</svrinfosamplerate>
<!--
Prohibit the server to advertise the stream on a public YP directory:  budiono6628@yahoo.co.id
-->
<svrinfopublic>0</svrinfopublic>
</ezstream>


Kemudian beri hak akses :
# chmod 0755 ezstream_mp3.xml

Sudah selesai, tinggal ada beberapa langkah lagi.....yaitu.
Masuk kan file/lagu-lagu mp3. ke folder /home/mp3 <--- gunakan aplikasi    ( WinCp )

Di dalam folder /home/mp3 sdh ada playlist.txt, yaitu daftar judul lagu, edit sesuai judul lagu nya.
di dalam playlist.txt, contoh nya gini lo  : /home/mp3/Koes Plus - Andaikan Kau Datang.mp3
( Judul lagu dan file mp3 di perhatikan, salah tulis judul bahkan sepasi , player tidak akan dapat memerintah ).
Demikian seterusnya..........

Untuk cek daftar lagu...
# cd /home/mp3
# cat playlist.txt  | head -10    <---- (-10 Untuk cek isi lagu kurang dari 10)

Apabila sudah selesai semua..
Tinggal kita Starting ezstream : Dengan perintah...

# ezstream -c /root/ezstream_mp3.xml
Kalo sukses akan tampil demikian :

root@vps:~# ezstream -c /root/ezstream_mp3.xml
ezstream: Connected to http://199.175.50.34:30001/stream
ezstream: Streaming ``Koes Plus - Andaikan Kau Datang''

Jangan di exit atau Ctrl+c ...., Closes saja. Yang ada di pojok kanan atas X warna merah.
Biar icast nya tidak offline.
Oke Dah selesai ###


Sekarang kita memiliki Icecast dan siap untuk mendapatkan playlist,
cobalah untuk mengunjungi" http://ip.address:30001/stream


Atau buat script icast2 nya.  seperti contoh di bawah ini :
Buat file.txt dulu. copaskan ke txt , Kemudian rename menjadi file.html


<center><p>Suara PujieDotnet</p>
     <div align='center' id="container">
    <a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a></div>
    <script type="text/javascript" src="http://www.shoutcheap.com/flashplayer/swfobject.js"></script>
    <script type="text/javascript">
    var s1 = new SWFObject("http://www.shoutcheap.com/flashplayer/player.swf",
    "ply","300","20","9","#00FFFF");
    s1.addParam("allowfullscreen","true");
    s1.addParam("allowscriptaccess","always");
    s1.addParam("flashvars",
    "file=http://ipserver:30001/stream&type=mp3&volume=80&autostart=true");
    s1.write("container");
    </script></center>


Atau begini....

     <center><p>Suara PujieDotnet</p>
     <div align='center' id="container">
    <a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a></div>
    <script type="text/javascript" src="http://www.shoutcheap.com/flashplayer/swfobject.js"></script>
    <script type="text/javascript">
    var s1 = new SWFObject("http://www.shoutcheap.com/flashplayer/player.swf",
    "ply","300","20","9","#00FFFF");
    s1.addParam("allowfullscreen","true");
    s1.addParam("allowscriptaccess","always");
    s1.addParam("flashvars",
    "file=http://ipserver:30001/stream&type=mp3&volume=80&autostart=true");
    s1.write("container");
    </script></center>


Yang lain nya kembangkan sendiri ya......

Ojo lali Tankyu

No comments:

Post a Comment