树莓派配置Samba及Aria2
分类:折腾日期:2017-01-17 - 16:04:29作者:老谢
之前写过 极路由4使用Aria2Gee打造下载中心 之后发现路由器不稳定,Aria2经常掉线,于是想起来可以用树莓派折腾起来,毕竟树莓派比较闲,只跑个LNMP,而且配置比路由器高,肯定要比路由器稳定,于是乎折腾起来!
安装ntfs-3g并挂载硬盘
ntfs-3g可以让linux读写NTFS格式的分区数据,命令如下:
sudo apt-get install fuse-utils ntfs-3g
modprobe fuse
sudo mkdir /mnt/usb_flash
sudo mount /dev/sda1 /mnt/usb_flash/ |
sudo apt-get install fuse-utils ntfs-3g
modprobe fuse
sudo mkdir /mnt/usb_flash
sudo mount /dev/sda1 /mnt/usb_flash/
这里挂载的分区,一般是/dev/sda1,但是请根据实际情况挂载。
安装配置samba
sudo apt-get install samba samba-common-bin
vim /etc/samba/smb.conf |
sudo apt-get install samba samba-common-bin
vim /etc/samba/smb.conf
默认会有一个share共享目录,路径path直接改为挂载的路径即可,如下:
[share]
path = /mnt/usb_flash
available = yes
browsealbe = yes
public = yes
writable = yes |
[share]
path = /mnt/usb_flash
available = yes
browsealbe = yes
public = yes
writable = yes
之后启用samba服务,然后访问下共享目录是否可以正常访问!
安装配置aria2
sudo apt-get install aria2
mkdir /home/aria2
touch /home/aria2/aria2.session
vim /home/aria2/aria2.conf |
sudo apt-get install aria2
mkdir /home/aria2
touch /home/aria2/aria2.session
vim /home/aria2/aria2.conf
#rpc-user=user
#rpc-passwd=passwd
#rpc-secret=token #这里设置你的token
enable-rpc=true
rpc-allow-origin-all=true
rpc-listen-all=true
#rpc-listen-port=6800
max-concurrent-downloads=5
continue=true
max-connection-per-server=5
min-split-size=10M
split=10
max-overall-download-limit=0
max-download-limit=0
max-overall-upload-limit=0
max-upload-limit=0
#lowest-speed-limit=0
#referer=*
dir=/mnt/usb_flash/aria2 #下载文件保存目录
#disk-cache=0
#enable-mmap=true
file-allocation=prealloc
input-file=/home/aria2/aria2.session
save-session=/home/aria2/aria2.session |
#rpc-user=user
#rpc-passwd=passwd
#rpc-secret=token #这里设置你的token
enable-rpc=true
rpc-allow-origin-all=true
rpc-listen-all=true
#rpc-listen-port=6800
max-concurrent-downloads=5
continue=true
max-connection-per-server=5
min-split-size=10M
split=10
max-overall-download-limit=0
max-download-limit=0
max-overall-upload-limit=0
max-upload-limit=0
#lowest-speed-limit=0
#referer=*
dir=/mnt/usb_flash/aria2 #下载文件保存目录
#disk-cache=0
#enable-mmap=true
file-allocation=prealloc
input-file=/home/aria2/aria2.session
save-session=/home/aria2/aria2.session
#!/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
case "$1" in
start)
echo -n "Starting aria2c\n"
sudo -u pi aria2c --conf-path=/home/aria2/aria2.conf -D
;;
stop)
echo -n "Shutting down aria2c\n"
killall aria2c
;;
restart)
killall aria2c
sudo -u pi aria2c --conf-path=/home/aria2/aria2.conf -D
;;
esac
exit |
#!/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
case "$1" in
start)
echo -n "Starting aria2c\n"
sudo -u pi aria2c --conf-path=/home/aria2/aria2.conf -D
;;
stop)
echo -n "Shutting down aria2c\n"
killall aria2c
;;
restart)
killall aria2c
sudo -u pi aria2c --conf-path=/home/aria2/aria2.conf -D
;;
esac
exit
参考教程
坐沙发,老谢好厉害~搞得我都想去买个树莓派了。
搞起来,不吃亏,但是树莓派接硬盘电源要好点,不然带不动
Mark,学习了,树莓派感觉对我现在来说用处不大,买来可能只是吃灰