Jump to content

Icecast Server/Getting Started: Difference between revisions

From XiphWiki
m How it works: I clicked where it said "click", and nothing happened
 
(12 intermediate revisions by 3 users not shown)
Line 4: Line 4:


To get started with using Icecast you should first understand how everything works together.
To get started with using Icecast you should first understand how everything works together.
[[File:Flowchart icecast.png|500px|thumb|Graphic showing the flow from source clients through Icecast to listeners. (click image to enlarge)]]


== How it works ==
== How it works ==
[[File:Flowchart icecast.png|500px|thumb|Graphic showing the flow from source clients through Icecast to listeners. (click image to enlarge)]]


The graphic shows how Icecast basically works:
The graphic shows how Icecast basically works:
Line 17: Line 17:
* '''Icecast''' offers the bitstream it gets from the source client on a specified mountpoint to all of the mountpoint's listeners in realtime.
* '''Icecast''' offers the bitstream it gets from the source client on a specified mountpoint to all of the mountpoint's listeners in realtime.


Note: you cannot use Icecast with static files (eg. ogg or mp3 files),<br />
Note: you cannot use Icecast with static files (eg. [[Ogg]] or mp3 files),<br />
it always needs a source client which sends a bitstream!
it always needs a source client which sends a bitstream!


== Getting Icecast ==
== Getting Icecast ==


Before you can set up the server, you must download the source code from on [http://icecast.org/download/ icecast.org] (or a binary package for Windows).<br />
You can download Icecast from [http://icecast.org/download/ icecast.org].
This "Getting Started" is written for server version '''2.4.1''', but should work with at least every 2.4.x version.


Windows users should download the binary package, while others can download the source.
This guide is written for Icecast version '''2.4.1''', but should work with at least every 2.4.x version.


There may be compiled versions on Homebrew (Mac OS) or apt-get (Debian, Ubuntu, etc), but these could be outdated, so compiling from source will be explained in the next step.
There may be compiled versions on '''Homebrew''' (Mac OS) or '''apt-get''' (Debian, Ubuntu, etc).<br />
Additionally have a look at [[Icecast Server/Installing latest version (official Xiph repositories)|Installing latest version from the official Xiph repositories]], these are the recommended ways to install Icecast.


Windows users who download and extract the binary package can skip the '''Compiling''' step and continue with '''Configuration'''.
Windows users who download and extract the binary package can skip the '''Compiling''' step and continue with '''Configuration'''.
Line 33: Line 33:
== Compiling ==
== Compiling ==


After downloading the source package you like, you have to extract it. After that you will have to use your console and change directory (cd) to your extracted files.
Only do these steps below, if there is definitely no packages Icecast available for
your system. With a source install you have to manually keep checking for new versions
from time to time and it is not recommended for beginners. Only proceed if you know what
you are doing!
 
Once you have downloaded the source package you want, you have to extract it.
 
After that you have to use your console and change directory (cd) to your extracted files.


<pre>
<pre>
Line 39: Line 46:
</pre>
</pre>


You then have to run the configuration tool, then compile and install it. (you may have to install additional dependencies first)
You then have to run the configuration tool, compile and install it.<br />
(you may have to install additional dependencies first)


When done, run the following commands.
When done, run the following commands to finish the installation:


<pre>
<pre>
Line 53: Line 61:
After installing Icecast, you are just one step away from using it! You have to configure it.
After installing Icecast, you are just one step away from using it! You have to configure it.


Icecast is shipped with a default configuration. The default configuration can be found
Icecast is shipped with a default XML configuration file.


* on Linux here: <pre>/etc/icecast.xml</pre> or <pre>/etc/icecast2/icecast.xml</pre>
The file can be found on:
* on Mac OS here: <pre>/etc/icecast.xml</pre> or <pre>/usr/local/etc/icecast.xml</pre>
* on Windows here: <pre>/path/to/extracted/icecast/etc/icecast.xml</pre>


You can now edit this file and save it to a location where you like it, or just leave it there. You will need the full path to start the server, so you should remember it.
* '''Linux''' at: '''/etc/icecast.xml''' or '''/etc/icecast2/icecast.xml'''
* '''MacOS''' at: '''/etc/icecast.xml''' or '''/usr/local/etc/icecast.xml'''
* '''Windows''' at: '''/path-to-extracted-icecast/etc/icecast.xml'''


To set up the server you should edit some fields in this xml file, like setting the right passwords, and hostname.
You can edit this file and even save it to a different location.<br />
(you will need its full path to start the server, so remember where you put it)


It is never wrong to set up these values, especially if you plan running a public server.
It is '''strongly''' recommended you edit some fields in this XML file,<br />
'''especially''' if you plan to run a '''public''' server.


<pre>
<syntaxhighlight lang="xml">
<location>The server's location</location>
<location>The server's location</location>
<admin>admin@yourdomain.tld</admin>
<admin>admin@yourdomain.com</admin>
</pre>
</syntaxhighlight>


You always should change the passwords from ''hackme'' to something more secure.
You should '''always''' change the passwords from ''hackme'' to something more secure.


<pre>
<syntaxhighlight lang="xml">
<authentication>
<authentication>
     <!-- Sources log in with username 'source' -->
     <!-- Sources log in with username 'source' -->
Line 83: Line 93:
     <admin-password>anotherfancypassword</admin-password>
     <admin-password>anotherfancypassword</admin-password>
</authentication>
</authentication>
</pre>
</syntaxhighlight>


If you plan to run a public server and/or a server with [[Yellow Pages]] listing, you should change the hostname to one where your server can be accessed from.
If you plan to run a public server and/or a server with [[Yellow Pages]] listing,<br />
you should change the hostname to one where your server can be accessed from.


<pre>
<syntaxhighlight lang="xml">
<!-- This is the hostname other people will use to connect to your server.
<!-- 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
It affects mainly the URLs generated by Icecast for playlists and YP listings. -->
listings. -->
<hostname>streams.yourdomain.tld</hostname>
<hostname>streams.yourdomain.tld</hostname>
</pre>
</syntaxhighlight>


Setting up more advanced things like relays, Yellow Pages listing and various other things will be explained in following in-depth parts of this Getting started.
More advanced topics like relays, Yellow Pages listings, etc. are explained in the following in-depth parts of this guide.


== Starting the server ==
== Starting the server ==


To start your first server, type
To start your Icecast server, run the following command in your console:


<pre>
<pre>
Line 104: Line 114:
</pre>
</pre>


into your console. If you did everything correctly Icecast should start and listen for connections on the default port. You can access it by typing http://127.0.0.1:8000/ into your web browser. If you see a page which says '''Icecast2 Status''' on top, you have done everything right and finished the basic part of this Getting started!
If you did everything correctly Icecast should start and listen for connections on the default port.
 
You can test access to your server by typing [http://127.0.0.1:8000 http://127.0.0.1:8000] into your web browser.
 
If you see a page which says '''Icecast2 Status''' on top,<br />
you have done everything right and finished the basic part of this guide!


== What next? ==
== What next? ==

Latest revision as of 17:10, 28 June 2017

This article describes how to get an Icecast server up and running.

On this resulting server you can connect with a Source Client, like IceS, and stream music or video to listener clients.

To get started with using Icecast you should first understand how everything works together.

Graphic showing the flow from source clients through Icecast to listeners. (click image to enlarge)

How it works

The graphic shows how Icecast basically works:

  • A source client connects to the Icecast server on a specified mountpoint.
    (a mountpoint can be described as a file on a normal file system)
  • Listeners access the mountpoints ("files") and can listen to the bitstreams ("file contents").
    (they can connect to these like they would to normal files on a remote server)
  • Icecast offers the bitstream it gets from the source client on a specified mountpoint to all of the mountpoint's listeners in realtime.

Note: you cannot use Icecast with static files (eg. Ogg or mp3 files),
it always needs a source client which sends a bitstream!

Getting Icecast

You can download Icecast from icecast.org.

This guide is written for Icecast version 2.4.1, but should work with at least every 2.4.x version.

There may be compiled versions on Homebrew (Mac OS) or apt-get (Debian, Ubuntu, etc).
Additionally have a look at Installing latest version from the official Xiph repositories, these are the recommended ways to install Icecast.

Windows users who download and extract the binary package can skip the Compiling step and continue with Configuration.

Compiling

Only do these steps below, if there is definitely no packages Icecast available for your system. With a source install you have to manually keep checking for new versions from time to time and it is not recommended for beginners. Only proceed if you know what you are doing!

Once you have downloaded the source package you want, you have to extract it.

After that you have to use your console and change directory (cd) to your extracted files.

$ cd /path/to/icecast-source

You then have to run the configuration tool, compile and install it.
(you may have to install additional dependencies first)

When done, run the following commands to finish the installation:

$ ./configure
$ make
$ make install

Configuration

After installing Icecast, you are just one step away from using it! You have to configure it.

Icecast is shipped with a default XML configuration file.

The file can be found on:

  • Linux at: /etc/icecast.xml or /etc/icecast2/icecast.xml
  • MacOS at: /etc/icecast.xml or /usr/local/etc/icecast.xml
  • Windows at: /path-to-extracted-icecast/etc/icecast.xml

You can edit this file and even save it to a different location.
(you will need its full path to start the server, so remember where you put it)

It is strongly recommended you edit some fields in this XML file,
especially if you plan to run a public server.

<location>The server's location</location>
<admin>admin@yourdomain.com</admin>

You should always change the passwords from hackme to something more secure.

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

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

If you plan to run a public server and/or a server with Yellow Pages listing,
you should change the hostname to one where your server can be accessed from.

<!-- 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>streams.yourdomain.tld</hostname>

More advanced topics like relays, Yellow Pages listings, etc. are explained in the following in-depth parts of this guide.

Starting the server

To start your Icecast server, run the following command in your console:

$ icecast -c /path/to/icecast.xml

If you did everything correctly Icecast should start and listen for connections on the default port.

You can test access to your server by typing http://127.0.0.1:8000 into your web browser.

If you see a page which says Icecast2 Status on top,
you have done everything right and finished the basic part of this guide!

What next?

If you want in-depth infos, you should look at the following articles.