[PukiWiki:wiki] BSD/FreeBSD/icecast2

最終更新日: 2008/12/10 09:33:20



  • SHOUTcast 互換のソフトウェアらしい。
  • オープンソースらしい。
  • 設定ファイルが xml でちょっと読みづらい。


# portinstall audio/icecast2

To start icecast at system boot, copy
/usr/local/etc/icecast.xml.sample to /usr/local/etc/icecast.xml, customize
to your environment as desired and add:


to /etc/rc.conf. See the icecast -h command for optional additional
flags. To specify an alternative config file for example add:

icecast_flags="-c /path/to/your/configuration.xml"

**  Make sure the <changeowner> section in your configuration file  **
**     is NOT commented out. Icecast will refuse to run as root.    **
**                                                                  **
** Also make sure that the user you choose is able to write to your **
**  configured log directory, otherwise icecast will refuse to run. **

icecast 用にユーザとグループを作成する。

# pw groupadd -n icecast
# pw useradd -n icecast -c "icecast" -d /nonexistent -g icecast -h - -s /sbin/nologin

icecast を立ち上げられるように。

# vi /etc/rc.conf




# cp /usr/local/etc/icecast.xml.sample /usr/local/etc/icecast.xml
# chmod 644 /usr/local/etc/icecast.xml


# mkdir /var/log/icecast
# chown icecast:icecast /var/log/icecast
# chmod 700 /var/log/icecast



# vi /usr/local/etc/icecast.xml

        ※ 回線の太さに応じて設定する。個人なら10くらいで十分?
        <!-- If enabled, this will provide a burst of data when a client
             first connects, thereby significantly reducing the startup
             time for listeners that do substantial buffering. However,
             it also significantly increases latency between the source
             client and listening client.  For low-latency setups, you
             might want to disable this. -->
        <!-- same as burst-on-connect, but this allows for being more
             specific on how much to burst. Most people won't need to
             change from the default 64k. Applies to all mountpoints  -->
        ※ 遅延と関係あるらしいけどよくわかんね

        <!-- Sources log in with username 'source' -->
        ※ ices から接続する PASS
        <!-- Relays log in username 'relay' -->
        ※ なんだろ?

        <!-- Admin logs in with the username given below -->
        ※ Web 上の管理ユーザの ID と PASS

    <!-- 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. -->
    ※ LAN 内からアクセス出来るように変更する。

    <!-- You may have multiple <listener> elements -->
        ※ 待ちうけポート。出来れば変えた方が良い。
        <!-- <bind-address></bind-address> -->

        <!-- basedir is only used if chroot is enabled -->

        <!-- Note that if <chroot> is turned on below, these paths must both
             be relative to the new root, not the original root -->
        ※ 先程作成したログディレクトリを記述する
        ※ pid ファイル

        <!-- Aliases: treat requests for 'source' path as being for 'dest' path
             May be made specific to a port or bound address using the "port"
             and "bind-address" attributes.
        <alias source="/foo" dest="/bar"/>
        <!-- Aliases: can also be used for simple redirections as well,
             this example will redirect all requests for http://server:port/ to
             the status page
        <alias source="/" dest="/status.xsl"/>

        <loglevel>4</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error -->
        ※ ログレベルはテストが済んだら3に落とした方がいいかも。
        <logsize>100000</logsize> <!-- Max size of a logfile -->
        ※ ログファイルの Max ファイルサイズ
        <!-- If logarchive is enabled (1), then when logsize is reached
             the logfile will be moved to [error|access|playlist].log.DATESTAMP,
             otherwise it will be moved to [error|access|playlist].log.old.
             Default is non-archive mode (i.e. overwrite)
        ※ logarchive を有効にしておけばerror.log.DATESTAMPのようになる。
        ※ セキュリティの事を考えると取っておくべき

# vi /usr/local/etc/icecast.xml

            ※ 先程追加したユーザとグループを記述する



# /usr/local/etc/rc.d/icecast2 start


# ps -auxww | grep icecast

ブラウザから hostname と port に設定した値を入れて表示されたらひとまず成功。