Download a root filesystem image (I’d recommend the hard-float flavor of Raspbian Wheezy from this source) and burn it to an SD card. Do not use some no-name SD card—it will get corrupted at some inconvenient time—get a quality card like a SanDisk Extreme III. Burning it is done with a command like (note that dates and version numbers will change):

$ sudo dd bs=1m if=2013-05-25-wheezy-raspbian.img of=/dev/disk3

Then, insert the card into the Raspberry Pi, apply power, and ssh to it using username: pi, password: raspberry. You can use a tool like Fing to find the new IP address on your network. Then:

$ sudo raspi-config

Choose option to expand filesystem, set time zone and locale (prefer UTF-8) under internationalization, set hostname under advanced, then exit the config tool and reboot.

Log back in:

$ sudo apt-get update && sudo apt-get dist-upgrade
$ sudo reboot

Log back in:

$ sudo apt-get install avahi-daemon tightvncserver vim

(installs avahi-daemon bind9-host geoip-database libavahi-core7 libbind9-80 libdns88 libgeoip1 libgpm2 libisc84 libisccc80 libisccfg82 liblwres80 libnss-mdns tightvncserver vim vim-runtime xfonts-base)

$ sudo insserv avahi-daemon
$ sudo reboot

Log back in:

$ sudo vi /etc/avahi/services/multiple.service

<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
   <name replace-wildcards="yes">%h</name>

You can now access the computer as <hostname.local>.

Now, configure the VNC server. Run tightvncserver to create default files, then kill it:

$ tightvncserver
$ killall tightvncserver

You can edit .vnc/xstartup to launch apps of your choice. Keep as is or do something like:

openbox-session &
pcmanfm -d &

*** Username ***

If desired, change "pi" to a different username by editing the following files in /etc: passwd, shadow, group, gshadow, and sudoers. Change “pi” to your username of choice in each one. To do this, first do:

$ sudo bash

Then edit each file in turn and rename /home/pi appropriately. Use visudo to edit sudoers. An easy option for the other files is:

$ sed -i ’s/pi/<new name>/g’

Once you’re done:

$ sudo reboot

If you’re using a pptp VPN provider:

$ sudo apt-get install pptp-linux
$ sudo vi /etc/ppp/peers/my-vpn-provider

pty "pptp <VPN hostname> --nolaunchpppd --debug"
name <VPN username>
password <VPN password>
remotename PPTP
maxfail 0

*** Install Chromium and fonts ***

$ sudo apt-get install chromium-browser ttf-mscorefonts-installer

(installs cabextract chromium chromium-browser chromium-inspector fonts-liberation libnspr4 libnss3 libspeex1 libvpx1 ttf-mscorefonts-installer)

*** External drive support ***

Install filesystem tools for manipulating external hard drives:

$ sudo apt-get install gparted

(installs gparted libatkmm-1.6-1 libcairomm-1.0-1 libglibmm-2.4-1c2a libgtkmm-2.4-1c2a libpangomm-1.4-1)

You can now plug in an external hard drive via USB and run gparted to create ext4, etc. partitions. Note the UUID.

To auto mount, add a line to /etc/fstab:

UUID=“<UUID from gparted>” <mount point≷ ext4 rw,exec,auto,users 0 3

Might need to auto mount. Edit /etc/udev/rules.d/99-mount.rules to contain:

SUBSYSTEM=="block", run+="/bin/mount -a"

Install NTFS support if desired:

$ sudo apt-get install ntfs-3g

Install HFS+ tools if desired:

$ sudo apt-get install hfsplus hfsutils hfsprogs libhfsp0

*** AFP server ***

Seems plenty reliable over based on Time Machine usage.

Install Netatalk:

$ sudo apt-get install netatalk

(installs cracklib-runtime db-util db5.1-util libcrack2 libpam-cracklib lsof netatalk rc wamerican)

Configure Netatalk:

$ sudo /etc/init.d/netatalk stop

Then edit /etc/netatalk/AppleVolumes.default:

Add "rw" to the line starting with ":DEFAULT:"

Comment out the line starting with "~/" if desired.
Add lines for Time Machine shares:

/<Path to shared directory> “<share name>" allow:<tm user> options:upriv,usedots,tm

Restart netatalk:

$ sudo /etc/init.d/netatalk restart

It will take about five seconds for the host to show up by name on the network.

Add time-machine users as needed:

$ sudo useradd <tm user> -m -G users
$ sudo passwd <tm user>

*** AFP client ***

Note that the AFP client is buggy as hell. Be forewarned!

$ sudo apt-get install afpfs-ng

(installs afpfs-ng afpfs-ng-utils libafpclient0)

Add user to group fuse:

$ sudo usermod -a -G fuse <username>
$ sudo reboot

To mount a volume:

$ mount_afp 'afp://<username>:<password>@<server>.local/<‘share name> <mount point>

To remove a user from the group:

$ sudo gpasswd -d <username> fuse


$ deluser <username> fuse

*** NFS server***

$ sudo apt-get install nfs-kernel-server
$ sudo update-rc.d rpcbind enable

Add shared directories to /etc/exports

Then reboot. After editing /etc/exports in the future, restart the NFS server with:

$ sudo /etc/init.d/nfs-kernel-server restart

*** NFS client ***

$ sudo apt-get install nfs-common
$ sudo update-rc.d rpcbind enable

Then reboot.

*** Samba (for masochists) ***

Install Samba:

$ sudo apt-get install samba samba-common-bin

Back up the original configuration file:

$ sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak

Then edit /etc/samba/smb.conf

Uncomment (remove hash) from "security = user" and add to the bottom:

[<SMB name>]
comment = <Helpful comment>
path = <Path to shared directory>
valid users = <Username>
create mask = 0660
directory mask = 0770
read only = no

Restart Samba:

$ sudo /etc/init.d/samba restart

Then, create user the user listed above if they don’t already exist and add to Samba users:

$ sudo useradd <username> -m -G users
$ sudo passwd <username>
$ sudo smbpasswd -a <username>

*** Set up a DLNA server ***

$ sudo apt-get install minidlna

(installs libavcodec53 libavformat53 libavutil51 libdirac-encoder0 libgsm1 libmp3lame0 libschroedinger-1.0-0 libspeex1 libtheora0 libva1 libvpx1 libx264-123 libxvidcore4 minidlna)

Edit /etc/minidlna.conf

Add: "media_dir=V,<media directory>"
Comment out: "media_dir=/var/lib/minidlna"
Uncomment: “log_dir=/var/log”

Make sure that <media directory> is owned by minidlna:minidlna.

Start MiniDLNA for the first time:

$ sudo minidlna -R

Start the service:

$ sudo service minidlna restart

*** Video Transcoding ***

$ sudo apt-get install libav-tools

(installs libav-tools libavdevice53 libavfilter2 libdc1394-22 libjack-jackd2-0 libopencv-core2.3 libopencv-imgproc2.3 libpostproc52 libraw1394-11 libswscale2)

*** Dynamic DNS services ***

$ sudo apt-get install ddclient

*** If you need unrar ***

$ sudo vi /etc/apt/sources.list

Add a line with: deb-src wheezy main contrib non-free rpi

Update the database:

$ sudo apt-get update

Create and enter a working directory for building unrar-nonfree:

$ mkdir ~/unrar-nonfree
$ cd ~/unrar-nonfree

Install dependencies needed by unrar-unfree:

$ sudo apt-get build-dep unrar-nonfree

Download unrar-nonfree source and build the .deb:

$ sudo apt-get source -b unrar-nonfree

Install the .deb; its name will depend on the version:

$ sudo dpkg -i unrar*.deb

Remove the working directory and files:

$ cd ..
$ rm -rf ~/unrar-nonfree

Last edit: 8 November 2013