DLNA Media Server

Published

Introduction: DLNA Media Server

About: Linux System Administrator

Keep all your media in one place and easily accessible.

4K streaming works just fine ( disk io: ~10MB/s, network: ~3MB/s)

Step 1: What You Need

1. A orange pi one board (but you can use any other)

2. Micro SD card (>=4GB)

3. An external HDD

4. A box - an old hp power source

5. Hobby-color plate that resists to at least 75 C

6. An usb port recovered from an old computer

7. Banana connectors, cables, bolts recovered from old computer's serial or vga port

Step 2: The Fun Part

  • Cut the hobby-color plate for the bottom, make some holes for the pi to fit in.
  • Cut the front to match the power supply face and the pi lan and usb port(s) - there were 2 fans on that side separated by a small iron sheet (which I've cut) and reuse the fan holes to assemble it.
  • For this specific board (orange pi one) there are 2 additional data ports (https://forum.armbian.com/topic/755-orange-pi-one-adding-usb-analog-audio-out-tv-out-mic-and-ir-receiver/).
  • I've been very lucky to soldier two cables on pins 3 and 4 (first easily scratch the pins); to be sure that those cables do not come off, use a glue gun to fix it on the boar - obviously after testing. For the other pi's I would solder the cables on the back of the plate directly on the usb port's pins.
  • Solder 2 cables on each banana plug (I used an old cd-rom audio cable).
  • Connect the power cables to the pi, this model supports it on the gpio pins 4 (+5V) and 6 (ground) - the pins are on the internal row on the opposite side of the lan port.
  • Connect the other power cables to the usb port, and the data cables to pins 3 and 4 of the usb port.
  • Add the hard drive and mount the screws.

Step 3: The Soft Part

  • I use armbian (https://www.armbian.com/download/) as it is much easier to install minidlna afterwards.
  • Setup the network - static ip:
allow-hotplug eth0
no-auto-down eth0
iface eth0 inet static
        address <your desired ip> 
        netmask <your netmask> (usually 255.255.255.0)
        gateway <your gateway>
dns-nameservers <your dns server>
  • Setup the drive - I would format it as EXT4 (beware of the existing data !!!):
fdisk /dev/sda (p - to see partition layout, d - delete all if it's the case, n - create a new one, w - write changes)
you may want to reboot so the kernel sees it (or if partprobe does not work)
mkfs.ext4 -L dlna-disk /dev/sda1
  • Use automount instead of fstab - to avoid un-bootable system in case mount fails
apt-get install autofs
in /etc/auto.master append
/-	/etc/auto.ext-usb
in /etc/auto.ext-usb
/srv	-fstype=ext4	:/dev/disk/by-label/dlna-disk
service autofs start && systemctl enable autofs.service
  • Install and configure minidlna
apt-get install minidlna
/etc/minidlna.conf
media_dir=/srv
service minidlna start && systemctl enable minidlna.service
  • Increase the number of inotify watchers
/etc/sysctl.conf
fs.inotify.max_user_watches=1048576
sysctl -p
  • Punch a hole in your firewall
apt-get install firewalld
service firewalld start && systemctl enable firewalld.service
firewall-cmd --permanent --add-port 8200/tcp
firewall-cmd --permanent --add-port 1900/udp
firewall-cmd --reload
  • Decrease RAM frequency to keep it cool and save power
h3consumption -d 408
reboot

Step 4: Add Some Data

  • Use filezilla to connect to the sftp service and copy your data under /srv
  • Install samba to access it
apt-get install samba
# add this to the end of /etc/samba/smb.conf
[dlna-media]
        comment = My Media
        path = /srv
        browseable = yes
	writable = yes
        valid users = minidlna
# make a samba user
smbpasswd -a minidlna
# activate the service
service smbd start && systemctl enable smbd.service
# let it through the firewall
firewall-cmd --permanent --add-service samba
firewall-cmd --reload
# grant full access for the minidlna user
apt-get install acl
setfacl -R -m u:minidlna:rwx -m d:u:minidlna:rwx /srv

Share

    Recommendations

    • Planter Challenge

      Planter Challenge
    • Woodworking Contest

      Woodworking Contest
    • Casting Contest

      Casting Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    Comments