Gentoo Wiki


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc
This article shows how to set up a UPnP MediaServer that serves Images, Videos and Audio files to all UPnP enabled clients in the network. There are several programs for the Linux platform. For this HOWTO I'm using uShare.


Obtaining uShare

Just go to the uShare page and download the source archive. The current version is 0.9.8. When the download is finished, just untar it as usual.

server ~#
server ~#
tar xvjf ushare-0.9.8.tar.bz2Image:CursorOFF.gif

Now you should have a new folder called ushare-0.9.8.

Configuring and Compiling

Change into the folder an execute the configure script. When running configure without the --prefix parameter, version 0.9.8 will use the strange value of NONE/etc/ushare.conf as the config file. So we have to force it to use an empty value. Of course, if you like to have it installed in another place, you can adjust the prefix setting accordingly.

server ~#
cd ushare-0.9.8Image:CursorOFF.gif
server ~#
./configure --prefix=Image:CursorOFF.gif

If everything is ok, we can compile and install it.

server ~#
make && make install-stripImage:CursorOFF.gif

Now we have the binary at /bin/ushare and the config file at /etc/ushare.conf however the real work starts now.

Creating a init script

If you try to start uShare by simply typing ushare you will get the following error:

server ~#

Error: no content directory to be shared.

Why? I don't know, what uShare is looking for, but for sure it's not looking into the config file. So I came up with the idea to write my own init-script. However I still wanted to have the option to change the settings in a config file rather than in the init script itself. So I moved /etc/ushare.conf to /etc/conf.d/ushare. Since this file already has the right syntax, it doesn't need any changes. The only thing left is the init script which looks like this:

File: /etc/init.d/ushare

depend() {
  need net
  use syslog

start() {
  ebegin "Starting uShare UPnP A/V Media Server"
  if [ -n "$USHARE_NAME" ]; then
  if [ -n "$USHARE_IFACE" ]; then
    PARAMS="$PARAMS --interface=\"$USHARE_IFACE\""
  if [ -n "$USHARE_PORT" ]; then
    PARAMS="$PARAMS --port=\"$USHARE_PORT\""
  if [ -n "$USHARE_DIR" ]; then
    PARAMS="$PARAMS --content=\"$USHARE_DIR\""
  start-stop-daemon --start --quiet --background --make-pidfile \
  --pidfile /var/run/ --exec /bin/ushare \
  -- $PARAMS
  eend $?

stop() {
  ebegin "Stopping uShare UPnP A/V Media Server"
  start-stop-daemon --stop -quiet --pidfile /var/run/
  eend $?

That's it.

Start the MediaServer at system startup

Just type

server ~#
rc-update add ushare defaultImage:CursorOFF.gif

and you're done. As soon as you start your computer, the UPnP MediaServer will start to serve the media files.

Retrieved from ""

Last modified: Thu, 04 Sep 2008 01:37:00 +0000 Hits: 1,642