Raspberry Pi Documentation

  • install raspbian by downloading image and then write it to sd with dd
    • sudo dd if=<path to image file> of=/dev/diskX
  • insert into Pi and boot up – should boot into Raspi-config
    • choose 1.Expand Filesystem – this will increase the data partition to use the full SD
    • choose 3 Enable Boot to Desktop
    • choose 7 Overclock – set to Moderate (800MHZ)
    • choose 8 Advanced Options
      • A4 to enable ssh
  • open a terminal once it boots
    • sudo apt-get update && sudo apt-get upgrade
  • Install tightvncserver
    • sudo apt-get install tightvncserver
  • execute it
    • tightvncserver – you will get prompted to set a password and a read-only password
  • change permissions on .Xauthority
  • sudo chown pi /home/pi/.Xauthority
  • create tightvnc init.d script
  • sudo nano /etc/init.d/tightvnc
  • paste in text or type in below

#!/bin/sh
### BEGIN INIT INFO
# Provides: tightvncserver
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start vmc server
# Description:
### END INIT INFO
case “$1″ in
start ) su pi -c ‘vncserver :1 -geometry 1600×900 -depth 16 -pixelformat rgb565:’
echo “VNC Started”
;;
stop ) pkill Xtightvnc
echo “VNC Terminated”
;;
* ) echo “Usage: /etc/init.d/tightvnc {start|stop}”
exit 1
;;
esac

change permissions on file
sudo chmod 755 /etc/init.d/tightvnc
start and stop tightvnc using this script to verify operation
update start up script to execute at startup
sudo update-rc.d tightvnc defaults
reboot and verify that VNC is working – address will be <IP Address>:1 in VNC viewer
Install avahi-zeroconf to not have to worry about IP address
sudo apt-get install avahi-daemon
sudo insserv avahi-daemon
sudo nano /etc/avahi/services/multiple.service
 (get from elinux.org/RPi_Advanced_Setup)
sudo /etc/init.d/avahi-daemon restart
you should then be able to reach the pi from command line on mac via <hostname>.local
install ntfs-3g
sudo apt-get install ntfs-3g
Plug in USB drive
it will probably auto mount.  unmount it
sudo umount /dev/sda1
Create directory in /media for drive (USBHDD1)
sudo mkdir /media/USBHDD1
Backup /etc/fstab
sudo cp /etc/fstab /etc/fstab.backup
Modify fstab to mount the USB drive where we want it to
sudo nano /etc/fstab
add following line to bottom
/dev/sda1<tab>/media/USBHDD1<tab>ntfs-3g<tab>defaults<tab>0<tab>0
save file and remount using sudo mount -a
install samba
sudo apt-get install samba samba-common-bin
backup config file
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.old
edit config file
sudo nano /etc/samba/smb.conf
look for Authentication and remove # to uncomment “security = user”
search for “socket options = TCP_NODELAY” and uncomment it
scroll to bottom and add share details
[Pi_Media]
comment = Pi Media Drive
path = /media/USBHDD1/
valid users = @users
force group = users
read only = no
create mask = 0660
directory mask = 0771

create a new users for the samba share
sudo useradd media -m -G users
create password for user
sudo passwd media
add user to samba password file
sudo smbpasswd -a media
restart samba to apply changes
sudo /etc/init.d/samba restart
install deluge
sudo apt-get install deluged
sudo apt-get install deluge-console

Start and then kill deluge daemon to create config files
deluged
pkill deluged
cp ~/.config/deluge/auth ~/.config/deluge/auth.old
sudo nano ~/.config/deluge/auth

add user:password:level at bottom, in this case “pi:raspberry:10” # level 10 = full-access/admin level
Start deluge daemon and console
deluged
deluge-console

configure remote control in console
config -s allow_remote True
config allow_remote
exit

Stop and restart deluge daemon to apply changes
pkill deluged
deluged

On PC/Mac, download and install the desktop client.
modify interface to uncheck classic and restart
add host
hostname = IP of pi
user and pass = info added to auth file above
Port leave at default
click add
should see status go green
Install deluge WebUI
apt-get install python-mako
apt-get install deluge-web
deluge-web &
#will start webui give you back a prompt  default address is http://<pi IP>/:8112
default password is “deluge”
Install flexget
apt-get install python-pip
pip install flexget (takes a while)
test flexget
flexget -V (display version number)
put config.yml in ~/.config/flexget (create dir if it doesn’t exist)
set up to run hourly
crontab -e
add line
@hourly /usr/local/bin/flexget --cron