[HOWTO] Install minidlna into a jail
This install is valid for embeded & full install, and is not affected by Nas4Free upgrades, because jails resides on data disk.
1 : prerequisites: You need a working jail, you can use wiki to create one = : http://wiki.nas4free.org/doku.php?id=do ... owto:jails
links: http://linux-bsd-sharing.blogspot.com.e ... na-on.html
Or use TheBrig and create a new jail named minidlna: viewtopic.php?f=79&t=3894 ( change proto by minidlna in all next examples)
This howto use the default proto jail in the commands and examples, but you need to change "proto" by your jail name ( I rename my jail proto to minidlna later to know what are inside, usefull if you have more that one jail).
OK, first you need to edit fstab.proto to add your Video, Photos and Audio paths:
edit fstab.proto to define what mount
Code: Select all
nano /jail/conf/fstab.protoCode: Select all
/mnt/NAS-A/Video /jail/proto/mnt/Video nullfs ro 0 0
/mnt/NAS-A/Musica /jail/proto/mnt/Musica nullfs ro 0 0
/mnt/NAS-A/Fotos /jail/proto/mnt/Fotos nullfs ro 0 0probably you need first time to create mount folders inside the jail, so you need to execute:
Code: Select all
mkdir /jail/proto/mnt/{Video,Musica,Fotos}or you can use TheBrig the new jail manager for home users: viewtopic.php?f=79&t=3894&p=20142#p20135
At this point you need to reboot your NAS to start jails with desired mounts ( previosly defined mount points).
once done check that your jail is running and what jail number have:
Code: Select all
rnas:~# jls
JID IP Address Hostname Path
1 192.168.1.201 proto /jail/proto
2 192.168.1.202 upnp /jail/upnp
rnas:~#Code: Select all
rnas:~# jexec 1 csh
You have mail.
root@proto:/ #if your Nas4Free is in RC state , you need to define path to packages (latest Nas4Free are 9.1 release and do not need this line):
Code: Select all
setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9-current/Latest/Code: Select all
pkg_add -r minidlnaCode: Select all
ee /usr/local/etc/minidlna.confCode: Select all
# port for HTTP (descriptions, SOAP, media transfer) traffic
port=8200
# network interfaces to serve, comma delimited
#network_interface=eth0
# set this to the directory you want scanned.
# * if have multiple directories, you can have multiple media_dir= lines
# * if you want to restrict a media_dir to a specific content type, you
# can prepend the type, followed by a comma, to the directory:
# + "A" for audio (eg. media_dir=A,/home/jmaggard/Music)
# + "V" for video (eg. media_dir=V,/home/jmaggard/Videos)
# + "P" for images (eg. media_dir=P,/home/jmaggard/Pictures)
media_dir=V,/mnt/Video # this line must be compatible with lines done in fstab.proto whitout /jail/proto part
# set this if you want to customize the name that shows up on your clients
friendly_name=MiniDLNA
# set this if you would like to specify the directory where you want MiniDLNA to store its database and album art cache
db_dir=/var/db/minidlna # perhaps you need to create folder minidlna first time
# set this if you would like to specify the directory where you want MiniDLNA to store its log file
log_dir=/var/db/minidlna
# set this to change the verbosity of the information that is logged
# each section can use a different level: off, fatal, error, warn, info, or debug
#log_level=general,artwork,database,inotify,scanner,metadata,http,ssdp,tivo=warn
# this should be a list of file names to check for when searching for album art
# note: names should be delimited with a forward slash ("/")
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg
# set this to no to disable inotify monitoring to automatically discover new files
# note: the default is yes
inotify=no
# set this to yes to enable support for streaming .jpg and .mp3 files to a TiVo supporting HMO
enable_tivo=no
# set this to strictly adhere to DLNA standards.
# * This will allow server-side downscaling of very large JPEG images,
# which may hurt JPEG serving performance on (at least) Sony DLNA products.
strict_dlna=no
# default presentation url is http address on port 80
#presentation_url=http://www.mylan/index.php
# notify interval in seconds. default is 895 seconds.
#notify_interval=900 # default value
notify_interval=10 # change to 10 second to bypass the multicast problem of jails (or at least minimize problem)
# serial and model number the daemon will report to clients
# in its XML description
serial=12345678
model_number=1
# specify the path to the MiniSSDPd socket
# minissdpdsocket=/var/run/minissdpd.sock
# use different container as root of the tree
# possible values:
# + "." - use standard container (this is the default)
# + "B" - "Browse Directory"
# + "M" - "Music"
# + "V" - "Video"
# + "P" - "Pictures"
# if you specify "B" and client device is audio-only then "Music/Folders" will be used as root
#root_container=B
Code: Select all
mkdir /var/db/minidlnaCode: Select all
pw groupadd dlna -g 933
pw useradd dlna -g dlna -u 933 -s /bin/sh -c "dlna Daemon" -d /var/db/minidlnaCode: Select all
chown dlna:dlna /var/db/minidlnaCode: Select all
ee /etc/rc.confCode: Select all
minidlna_enable=yes Code: Select all
echo minidlna_enable="YES" >> /etc/rc.conf[/b]
edit /usr/local/etc/rc.d/minidlna only if your NF4 is 9.0 or older , if is BSD 9.1 or never, you do not need to edit file
Code: Select all
ee /usr/local/etc/rc.d/minidlnacopy & paste this script:
Code: Select all
#!/bin/sh
# $FreeBSD: ports/net/minidlna/files/minidlna.sh.in,v 1.5 2012/05/08 02:31:27 mi Exp $
#
# PROVIDE: minidlna
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf[.local] to enable minidlna:
#
# minidlna_enable="YES"
. /etc/rc.subr
name=minidlna
rcvar=minidlna_enable
command=/usr/local/sbin/minidlna
load_rc_config $name
minidlna_enable=${minidlna_enable-"NO"}
minidlna_uid=${minidlna_uid-"dlna"}
pidfile="/var/db/minidlna/minidlna.pid"
start_precmd="rm -f $pidfile"
stop_postcmd=$start_precmd
command_args="-P $pidfile -u $minidlna_uid"
extra_commands=rescan
rescan_cmd="$command -R -u $minidlna_uid"
required_dirs="/var/db/minidlna"
run_rc_command $1Code: Select all
/usr/local/etc/rc.d/minidlna startNOTE: I notice that multicast do not work well on jails, this is notice in minidlna adding a long, long time to be detected on upnp renders, but once detected, normally works flawshely and without problems.
To minimize problem try in minidlna.conf :
# notify interval in seconds. default is 895 seconds.
#notify_interval=900 # default value
notify_interval=10 # change to 10 second to bypass the multicast problem of jails (or at least minimize problem)
