Skip to content

Instantly share code, notes, and snippets.

@tatumroaquin
Created September 26, 2022 08:02
Show Gist options
  • Select an option

  • Save tatumroaquin/f70eea49ce1248a6d9001bc872d8de03 to your computer and use it in GitHub Desktop.

Select an option

Save tatumroaquin/f70eea49ce1248a6d9001bc872d8de03 to your computer and use it in GitHub Desktop.

Revisions

  1. tatumroaquin created this gist Sep 26, 2022.
    67 changes: 67 additions & 0 deletions minidlna.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,67 @@
    <h1 align='center'>MiniDLNA Arch Linux</h1>

    DLNA (Digital Living Network Aliance), is collection of interoperability guidelines which set the protocols for multimedia communication

    ## install minidlna
    ```
    sudo pacman -S minidlna
    ```

    ## configure minidlna
    ```
    port=8200
    network_interface=wlp4s0
    user=<user>
    media_dir=/home/<user>/Videos/
    db_dir=/home/<user>/.local/share/minidlna/cache
    log_dir=/home/<user>/.local/share/minidlna/log
    enable_subtitles=yes
    ```

    ## create necessary folders
    ```
    mkdir -p $XDG_DATA_HOME/minidlna/{cache, log}
    sudo mkdir /run/minidlna
    sudo chown <user>:<group> /run/minidlna
    ```
    * cache stores the sqlite db, and `/run/minidlna` contains the pid file
    * permissions are important as we are changing the user as well

    ## configure firewall rules
    ```
    # nft add rule <family> <table> <chain>
    sudo nft add rule inet filter input [position 1] tcp dport 8200 accept comment trivnet1
    sudo nft add rule inet filter input [position 1] udp dport 1900 accept comment ssdp
    ```
    * positions are optional arguments here, depending on the ruleset of the firewall but essentially it has to be before this line:
    ```
    meta pkttype host limit rate 5/second counter reject with icmpx admin-prohibited
    ```
    * if errors persist just temporarily remove the entire ruleset like so `sudo nft flush ruleset`

    ## change runtime user
    ```
    sudo systemctl edit minidlna.service
    ```
    ```
    # write the following in between the instructed lines on override.conf
    [Service]
    ProtectHome=off
    User=<user>
    Group=<group>
    ```

    ## start minidlna
    ```
    sudo systemctl start minidlna
    ```

    ## verify the service
    ```
    http://<ip of media server>:8200
    ```

    #### sources:
    <https://openwrt.org/docs/guide-user/services/media_server/minidlna>
    <https://wiki.archlinux.org/title/Nftables#Add_rule>
    <https://wiki.archlinux.org/title/ReadyMedia>