SZ_dlnaNAS small simple NAS storage to downloading and streaming video in local network
Today i will create small and simple home NAS storage for home multimedia.
I used old one IDE HDD with enclosure and Orange Pi zero, someday cheapest SBC on Aliexpress.
I choose Armbian as OS on Orange Pi, its lightest OS for Orange Pi.
Just download from armbian.com website OS image for Orage Pi zero board.
To write downloaded OS image file into SD card i use balenaEtche software, available on balena.io website.
Run balenaEtcer and click Flash from file button
Choose downloaded image file
Then click on Select target and choose your SD card
Press Flash! and wait while balenaEtcher writes file to SD card.
After image flashed to SD card, remove card from reader and insert into Orange Pi zero.
Connect all wires to Orange Pi zero, HDD enclosure, Ethernet cable, power.
I checked IP address of Orange Pi zero on my router DHCP registration table, another way is using UART interface on Orange Pi zero, but you need additional USB to UART adapter.
When i know IP address, i connect to Orange Pi zero with Putty SSH client.
Login username is root and password 1234.
After successful login Armbian asks to change default password.
When password changed, i install system on External HDD that connected via USB
Run command: nand-sata-install
Choose Boot from SD
Then select your connected HDD
Choose filesystem, i use ext4
After system files copied to External HDD, and system restarted, i make new directory in root directory and named in Storage.
Commands are:
cd /
mkdir Storage
chmod 777 Storage
and for checking
ls -la
We can see that folder Storage have for permissions for all users read and write in this directory.
Next installing Transmission torrent client:
sudo apt install transmission-daemon
When installed, need to stop service to change configuration:
systemctl stop transmission-daemon
Then edit transmission-daemon config file:
nano /etc/transmission-daemon/settings.json
Next i install samba for file sharing with home windows based pc:
sudo apt install samba
After installation edit samba config file:
nano /etc/samba/smb.comf
In section "# This option controls how unsuccessful authentication attempts are mapped to anonymous connection"
edit and insert lines:
security = user
map to guest = bad password
In section "Share Definitions"
remove all default lines and add:
[DLNA-NAS]
path =/Storage
guest ok = yes
read only = no
create mask = 0777
directory mask = 0777
Save, exit and restart Samba service by command:
systemctl restart smbd
Checking samba, find our nas in network, and trying to create and delete files. If all works Samba installed correctly.
Next going to install MiniDLNA multimedia streaming software
sudo apt install minidlna
After installed editing configuration file
nano /etc/minidlna.conf
Change media_dir parameter
media_dir=/Storage
Save, exit and restart minidlna service
systemctl restart minidlna
I will check minidlna on PC with media player, in future will be checked also on TV
Latest one software will be web server, i choose lighttpdsudo apt install lighttpd
Going into NAS IP address to check if web browser working
Next going into /var/www/html folder and removing all files
cd /var/www/html
rm *
Installing python and python3-pip
sudo apt -install python3 python3-pip
Next creating poweroff.py file, and inserting python code for system shutdown
nano poweroff.py
import os
from bottle import route, run
@route('/<name>')
def index(name):
if name == "power":
os.system("sudo shutdown -h now")
run(host='0.0.0.0', port=8080)
Editing rc.local file to autostart python service
nano /etc/rc.local