Difference between revisions of "Linux Nas"

From ElectroDragon
Jump to: navigation, search
(Transmission)
(Samba)
 
Line 19: Line 19:
  
 
== Samba ==
 
== Samba ==
* Install the samba, update maybe necessary
+
* Install the samba, update maybe necessary: '''sudo apt-get install samba samba-common-bin'''
sudo apt-get install samba samba-common-bin
+
* edit config file, we use nano here, some typing work will be needed: '''nano /etc/samba/smb.conf'''
* edit config file, we use nano here, some typing work will be needed
+
* (may not necessry) Give the workgroup and windows support, change the following settings, normally workgroup is default WORKGROUP
nano /etc/samba/smb.conf
+
* (may not necessry) Give the workgroup and windows support, change the following settings
+
 
  workgroup = your_workgroup_name
 
  workgroup = your_workgroup_name
 
  wins support = yes
 
  wins support = yes
Line 57: Line 55:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
* Then restart the samba service
+
* Then restart the samba service ‘’‘’/etc/init.d/samba restart''' or '''service samba restart''' or '''service smbd restart'''
/etc/init.d/samba restart
+
or  
+
service samba restart
+
 
* Finally add the new users pi, and enther the password twice and you can browse raspberrypi in the windows now:
 
* Finally add the new users pi, and enther the password twice and you can browse raspberrypi in the windows now:
 
  smbpasswd -a pi
 
  smbpasswd -a pi
 
  pdbedit -a pi
 
  pdbedit -a pi
 +
* If can not write file, add line '''force user = root'''
  
 
== Transmission ==
 
== Transmission ==

Latest revision as of 05:03, 8 August 2017

MiniDLNA

  • sudo apt-get install minidlna
  • Config file sudo nano /etc/minidlna.conf, example:
media_dir=A,/media/HDD/Music
media_dir=P,/media/HDD/Pictures
media_dir=V,/media/HDD/Movies
# Name that the DLNA server presents to clients.
friendly_name=RASPI MINIDLNA
# set port, can visit later via port
port=8200
  • service start: sudo service minidlna restart, or auto start: update-rc.d minidlna defaults
  • remote play options:
  1. On another RPI: VLC, XMBC KODI,
  2. appstore or android: BubbleUPnP, MediaHouse, mxplayer
  3. smart TV
  4. PC: potplayer
  • User watch max issue: nano edit: /etc/sysctl.conf, add line: fs.inotify.max_user_watches=65536, and run command /sbin/sysctl -p
  • In minidlna conf: also enable inotify=yes and notify_interval=300

Samba

  • Install the samba, update maybe necessary: sudo apt-get install samba samba-common-bin
  • edit config file, we use nano here, some typing work will be needed: nano /etc/samba/smb.conf
  • (may not necessry) Give the workgroup and windows support, change the following settings, normally workgroup is default WORKGROUP
workgroup = your_workgroup_name
wins support = yes
  • Edit following contents at the end of the conf file:
  • complex set (reference only)
# shared name
  [pihome]  
   comment= Pi Home
# shared folder  
   path=/media/SSK 
   browseable=Yes
   writeable=Yes
 
   # only guest=no 
   create mask=0777 
   directory mask=0777 # may not necessary
   public=yes # yes or no for public
   valid users = root pi # allowed user
  • simple set
# shared name
  [pihome]  
   comment= Pi Home
# shared folder  
   path=/media/
   browseable=Yes
   writeable=Yes
   public=yes
   valid users = root pi
  • Then restart the samba service ‘’‘’/etc/init.d/samba restart or service samba restart or service smbd restart
  • Finally add the new users pi, and enther the password twice and you can browse raspberrypi in the windows now:
smbpasswd -a pi
pdbedit -a pi
  • If can not write file, add line force user = root

Transmission

Step Header text Header text
Install apt-get install transmission-daemon Example
  • Use root for transmission-daemon
  • in case hard disk mounted as root, and not changeable ||
  • sudo nano /etc/init.d/transmission-daemon
  • change USER=debian-transmission to USER=root
  •  ? usermod -a -G debian-transmission root //
  •  ? adduser root debian-transmission //add user root to group debian-transmission
  •  ? cat /etc/passwd set debian-transmission number id to 0:0
match the mounted disk
setting config file
  • Run the command to edit setting file:
sudo nano /etc/transmission-daemon/settings.json
-
Setting steps - turn off or edit whitelist IP "rpc-whitelist-enabled": false, so you can login remotely 192.168.1.*
Setting steps - set correct Download folder "download-dir": "/media/SSK",
Setting steps - Change the login user name and password for RPC
"rpc-password": "root",
"rpc-username": "root",
Setting steps - set all downloaded files' permission to 777 "umask": 0
Setting steps - reload config
  • and then restart after you finish editing the configuration file
sudo service transmission-daemon reload
sudo service transmission-daemon restart
  • Kill all daemon to ensure you can edit the setting files.
killall transmission-daemon
login http://192.168.1.113:9091/

Use in OpenWrt

Xuneli Xware

prerequisite

  • use root
  • mount disk, and xunlei will automatically use it and put file in TDDOWNLOAD folder

steps

  • Download file Xware1.0.31_armel_v5te_glibc.zip
  • copy and install file at /home/pi/XL, enter into XL folder and run
  • set right for xunlei file: chmod 777 * -R
  • run ./portal

copy activation code into http://yuancheng.xunlei.com/

Set auto start

sudo nano /etc/rc.local

add the line before exit 0

./home/pi/XL/portal

Check in case:

  • fdisk -l to check if the media mounted or not
  • Auto mount media disk, if failed auto mount reboot it.

Aria2

Install and config

sudo apt-get install aria2 

configure based on RPI
create blank aria2s session file

sudo touch /home/pi/aria2.session  

create config file

sudo nano /home/pi/aria2.conf  

Conf file

#download folder
dir=/media/SSK
disable-ipv6=true
#open RPI for web gui
enable-rpc=true
rpc-allow-origin-all=true
rpc-listen-all=true
#rpc-listen-port=6800
#continue download 
continue=true
input-file=/home/pi/aria2.session
save-session=/home/pi/aria2.session
max-concurrent-downloads=3

Test and run

  • run with conf file
sudo aria2c --conf-path=/home/pi/aria2.conf
  • If all good then set it run on booting
sudo aria2c --conf-path=/home/pi/aria2.conf -D

Set as auto start

sudo nano /etc/init.d/aria2
  • file:
#!/bin/sh
### BEGIN INIT INFO
# Provides:          aria2
# Required-Start:    $remote_fs $network
# Required-Stop:     $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Aria2 Downloader
### END INIT INFO
 
USER=root
CONF=/home/pi/aria2.conf
 
case "$1" in
start)
    echo "Start aria2c"
    umask 0002
    su - $USER -c "aria2c --conf-path=$CONF -D"
    ;;
stop)
    echo "Stopping aria2c, please wait..."
    killall -w aria2c
    ;;
restart)
    echo "Stopping aria2c, please wait..."
    killall -w aria2c
    echo "Start aria2c"
    umask 0002
    su - $USER -c "aria2c --conf-path=$CONF -D"
    ;;
*)
    echo "$0 {start|stop|restart|status}"
    ;;
esac
exit
  • Set the right for the script:
sudo chmod +x /etc/init.d/aria2

現在試下啟動Aria2c

sudo service aria2 start

now check if the aria run or not

sudo ps x |grep aria2

fianlly set it auto start

sudo update-rc.d aria2 defaults

Web GUI by nginx and YAWW

  • install nginx
sudo apt-get install nginx
  • edit and config
sudo nano /etc/nginx/sites-available/default

edit the default port from 80 to 8080 in the configure file

YAWW

Advantages of aria2

  • Can download file from Baiduyun or 115

Baidu Yun

In Openwrt

  • Install SyncY

Raspberry Pi

Install

  • Install python and relevant package "requests"
pip install requests
  • git clone the python files
git clone https://github.com/houtianze/bypy.git
  • Auth, run command
./bypy.py info
after authication, you can find folder "我的应用数据apps" in main folder
  • and run list command to see files in apps folder:
./bypy.py list

Set system locales

  • In raspi-config, first choose:
en-GB.UTF-8 UTF-8
zh_CN.GB2312
zh.CN.GB18030 GB18030
zh_CN.GBK GBK
zh_CN.UTF-8 UTF-8

and then choose: zh_CN.UTF-8 UTF-8

  • Change Timezone to Asia -shanghai
  • Install input method: apt-get install scim-pinyin
  • nano /etc/sysconfig/i18n, change the original to
LANG="zh_CN.UTF-8"
SYSFONT=latarcyrheb-sun16

Usage

./home/pi/bypy/bypy.py syncup
  • or compare
 ./home/pi/bypy/bypy.py compare