How to Easily Setup Home Media Server in Ubuntu 24.04 | 22.04

Last updated: July 10, 2024 — 1 Comment

This simple tutorial shows how to easily turn your Ubuntu or Debian into home media server, so that you can listen to the music, watch photos and videos that are stored in Linux PC remotely using your mobile phones and/or smart TVs.

GNOME, the default desktop in Ubuntu and Fedora Workstation, has built-in option to enable this feature. It uses Rygel home media solution as backend.

It automatically transcode media to a format compatible with the client device. And, client machines that supports DLNA/UPnP, such as Sony PlayStation, Microsoft Xbox, smart TV, Android, iOS, can access them through the local network.

Rygel does not have any GNOME specific dependencies. It also works in other desktop environment. For this tutorial, I’ve tested the home media server in Ubuntu 24.04, XUbuntu 24.04 and Ubuntu Server 24.04, though it should work in all current Ubuntu releases, and Debian.

Enable Rygel Home Media Server

For default GNOME Desktop

As mentioned, the default GNOME has built-in options to enable this feature.

First, open Settings (aka GNOME Control Center) either by searching from the overview screen or by using the top-right system status menu (Quick Settings).

When Settings opens, navigate to Sharing in left pane, then click “Media Sharing” in right.  In the pop-up dialog, do:

  • Turn on “Media Sharing” to enable the home media server.
  • Use ‘+’ and trash icons to add/remove folders, to share media from them.
  • Under Networks, use on/off switch to select which network interface to listen to.

For other Desktop Environments

For XUbuntu, KUbuntu, Ubuntu MATE, Ubuntu Server and other non-GNOME Desktops, there’s no graphical options to enable this feature. Users can press Ctrl+Alt+T on keyboard to open up a terminal window, then do following steps one by one instead.

1. First, run command to install the rygel media server as well as its dependencies.:

sudo apt install rygel

For Ubuntu Server, you also need to install extra media libraries:

sudo apt install ubuntu-restricted-extras

2. The Rygel service runs in per-user basis. The default config file locates in /etc directory. You may run the command below to move (or copy with cp) it to local folder:

sudo mv /etc/rygel.conf ~/.config/

For Ubuntu Server, run mkdir -p ~/.config if the folder does not exist.

Then, change the ownership of the file to current user:

sudo chown $USER:$USER ~/.config/rygel.conf

3. Next, edit the config file by either opening it from your file manager (.config is hidden folder, press Ctrl+H to view/hide) or running the command below in terminal:

xdg-open ~/.config/rygel.conf

or run nano ~/.config/rygel.conf if you’re following this tutorial on Ubuntu/Debian Server.

When file opens, do:

  • add upnp-enabled=true under [general] section.
  • find out and edit uris=@MUSIC@;@VIDEOS@;@PICTURES@; to add/remove folders (separate with ;) you want to share.

You can leave all other default, or edit it with your need. For example:

  • interface=192.168.x.xxx if you have more than one network connections, and want to specify which one to listen to.
  • port=12345 to listen on port 12345, in case you has firewall enabled and need to configure which port to be allowed.
  • edit transcoders=mp3;lpcm;mp2ts;wmv;aac;avc for list of active transcoders.
  • and more.

4. After saving the changes to the config file, enable the media service by running command:

systemctl enable --user --now rygel.service

Then, verify if it’s in active by running command:

systemctl status --user rygel.service

Next, every time after made changes to the ~/.config/rygel.conf file, you need to restart the service by running the command below to apply.

systemctl restart --user rygel.service

Access the Media Server in Clients

After enabled the Rygel media server, any device in same network with upnp support can access.

In my case, I use VLC media player. Either go to menu View -> Playlist -> Universal Plug'n'Play in VLC player in PC, or navigate to Network tab in the mobile edition. Then, you can browse and enjoy the media in server.

Disable Rygel Home Media Server

For the default GNOME desktop, just open Settings, then just turn off the toggle switch under “Sharing -> Media Sharing”.

For others, just open terminal (Ctrl+Alt+T) and run command to stop the media service:

systemctl stop --user rygel.service

If you don’t need the media server any more, just run command to uninstall:

sudo apt remove --autoremove rygel

Twitter

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via [email protected] Buy me a coffee: https://ko-fi.com/ubuntuhandbook1 |

One response to How to Easily Setup Home Media Server in Ubuntu 24.04 | 22.04

  1. Thanks for these tips! I have followed the instructions, and it seems Rygel is running on the server I’ve set up, but other computers in the same network are not seeing it. I am opening up VLC on another Ubuntu machine on the same network, choosing Universal Plug’n’Play, but the screen is blank.
    What could I check next?

Leave a Reply

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

*