DLNA Server on Linux: Install miniDLNA and Share Your Library

DLNA Server on Linux: Install miniDLNA and Share Your Library

With miniDLNA on a Linux server, you can share music, photos, and videos with televisions and other compatible devices connected to your local network. RedesZone documents installation using Debian packages and configuration from a single file; the server does not convert formats, so the receiving device must be able to play the files as they are.

Who can use it and how to check

This configuration works for a Linux-based server, such as a dedicated computer or a NAS running Linux. Televisions, phones, tablets, consoles, and other players will be able to find it, provided they are compatible with DLNA or UPnP and are on the local network. If your router already offers a media server, it can also share files; miniDLNA is an alternative when you want to host the service on another computer.

After configuring it, look for the server in the player's network or UPnP/DLNA section. RedesZone notes that televisions usually detect it automatically; on computers, you can try VLC or Kodi, and on Android, VLC or BubbleUPnP. If it does not appear, first check that the service is active, then check the firewall.

Installation and configuration

  1. Install miniDLNA from the repositories. In the Debian example, installation is performed with apt. The guide also mentions Ubuntu and Linux Mint, but the specific command applies to systems that use that package manager. If your distribution uses another one, look for miniDLNA in its repositories and follow its installation procedure.

    sudo apt install minidlna
  2. Start the service and check its status. The guide uses the service command shown below. Checking the status lets you verify that miniDLNA is running before moving on to folder configuration.

    sudo service minidlna start
    sudo service minidlna status
  3. Edit the configuration file. miniDLNA uses /etc/minidlna.conf. The tutorial opens this file with nano; you can use another text editor if you prefer. The required lines may be commented out: remove the comment marker to enable them, and keep the actual paths on your server.

    sudo nano /etc/minidlna.conf
  4. Specify the content folders. Add one media_dir line for each folder you want to share. In RedesZone's syntax, A identifies audio, P photos, and V video. Replace the example paths with directories that exist on your computer; to include photos and videos from the same folder, the example combines the letters PV.

    media_dir=A,/home/usuario/multimedia/audio
    media_dir=P,/home/usuario/multimedia/fotos
    media_dir=V,/home/usuario/multimedia/videos
    media_dir=PV,/home/usuario/multimedia/camara_fotos
  5. Enable the library and name settings. The tutorial provides these additional directives: the database, logs, the name visible on the network, and change monitoring. You can leave them commented out if you do not need to change those values; if you use them, uncomment them and check that the paths match your installation.

    db_dir=/var/cache/minidlna
    log_dir=/var/log/minidlna
    port 8200
    friendly_name=servidor-DLNA
    inotify=yes
    notify_interval= 30
  6. Restart miniDLNA to apply the changes. After saving the file, restart the service with the command shown. Check its status again if you need to confirm that it has started.

    sudo service minidlna restart
    sudo service minidlna status
  7. Check the firewall if the server does not appear. According to RedesZone, when iptables is in restrictive mode, TCP port 8200 and UDP port 1900 must be allowed. These example rules accept incoming traffic on those ports; the guide presents them for a simple local configuration with one interface and one subnet. Do not copy them without adapting them if your network policy requires limiting access to a specific subnet.

    iptables -A INPUT -p tcp --dport 8200 -j ACCEPT
    iptables -A INPUT -p udp --dport 1900 -j ACCEPT

    The guide provides the following command to save rules on the specified system. Use it only if that path and persistence mechanism match your configuration.

    iptables-save > /etc/iptables/rules.v4
  8. Check the library and clients. Open the status interface on the server itself at http://localhost:8200. RedesZone says it shows the number of files by type and connected clients, along with their IP and MAC addresses and the number of connections. From another computer on the network, use the server's local address with the same port; then look for the server in the player's network or DLNA section.

Mistakes to avoid

Do not assume every television will play everything. miniDLNA does not transcode audio or video. If the client does not support a file's format or codec, sharing it will not convert it into a playable one; RedesZone mentions H.265 as an example that can cause problems on older televisions.

Use the appropriate content paths. The tutorial's paths identify audio, photo, and video folders; change each example so it points to the content folder you want to share. Separate audio, photos, and videos if you want them to appear categorized by type.

Do not open ports without considering the scope. The article describes miniDLNA as a service for the local network and warns that it does not provide built-in authentication. Do not turn the example rules into a general authorization for networks you do not control; keep access limited to the local environment and protect both the Wi-Fi network and the server itself.

Do not confuse installation with detection. If the client cannot see the server, verify miniDLNA's status, that the devices are compatible, and that the firewall allows the necessary traffic. You can also check the status interface on port 8200 to confirm that the service is publishing the library.

When finished, compatible clients on the local network should be able to find the server and browse the shared folders. The final test is to play a file in a format supported by the receiving device.

Sources: RedesZone, Seguridad PY