These instructions are very bare, and intended only for my own use.
Preparation
-
Write the disk image to the sd card with
dd
, usingBS=4M
. -
Resize the second partition to ~1.5GiB, create an ext4 partition on the remaining space for media storage.
-
Expand the root partition with
e2fsck -f /dev/sdx2
andresize2fs /dev/sdx2
. -
Add an empty file called
ssh
on the boot partition -
Start the Pi and ssh in, username
pi
, passwordraspberry
. -
Run
raspi-config
, set the hostname, reboot. -
Get updates/upgrades.
-
Add
smsc95xx.turbo_mode=N
to/boot/cmdline.txt
(don’t know if still necessary).
Users
-
Run
adduser
. -
Use
usermod -a -G <comma separated groups> louis
to add pi’s groups to new user. -
Add new user to sudoers.
-
Verify the new user works and can
sudo
, then disable the pi account withpasswd -l pi
. -
Add the extra partition to
fstab
, on/local
usingdefaults,noatime 0 2
. -
Run
addgroup local
andadduser louis local
. -
Run
chgrp local /local
, and mount it.
Network Setup
Edit /etc/network/interfaces
to the following:
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp
allow-hotplug wlan0
auto wlan0
iface wlan0 inet static
address 192.168.1.25
netmask 255.255.255.0
gateway 192.168.1.1
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
and /etc/wpa_supplicant/wpa_supplicant.conf
to have
country=NZ
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="{SSID HERE}"
psk="{KEY HERE}"
}
then reboot.
Network bridge setup
-
Add
@reboot sleep 60 && /root/wifibridge.sh
to root’s crontab. -
Create a script
/root/wifibridge.sh
, remembering tochmod +x
it. (See source at gist.)
#!/bin/sh
/sbin/ifconfig eth0 10.0.0.1 netmask 255.255.255.0 up
/sbin/iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
echo "1" | /usr/bin/tee /proc/sys/net/ipv4/ip_forward
Transmission setup
-
Make the
/local/torrents
and/local/torrents/.incomplete
directories. Set their groups tolocal
and permissions to775
. -
Install the
transmission-daemon
andtransmission-cli
packages. -
Add
debian-transmission
to the grouplocal
. -
Stop the transmission service, and make the following settings changes:
"cache-size-mb": 32,
"download-dir": "/local/torrents",
"download-queue-size": 1,
"encryption": 0,
"incomplete-dir": "/local/torrents/.incomplete",
"incomplete-dir-enabled": true,
"peer-limit-global": 40,
"peer-limit-per-torrent": 10,
"peer-socket-tos": "lowcost",
"port-forwarding-enabled": true,
"preallocation": 0,
"prefetch-enabled": 0,
"rpc-authentication-required": false,
"rpc-whitelist": "192.168.1.*",
"rpc-host-whitelist-enabled": false,
"umask": 2
Minidlna setup
-
Install
minidlna
-
Edit
/etc/minidlna.conf
with the following settings:-
media_dir=/local/torrents
-
friendly_name=Pi Torrents
-
-
Restart the minidlna service, then run
service minidlna force-reload
.
Samba setup
-
Install
samba
and create an account withsmbpasswd -a <username>
. -
Remove the default share definitions.
-
To create one private share and one public share (think carefully about whether you want this!)
[Home]
path = /home/louis
writable = yes
valid users = louis
[PiTorrents]
path = /local/torrents
security = share
browseable = yes
writable = yes
guest ok = yes
guest account = nfsnobody
public = yes
force user = root
force group = root