Raspberry NAS

Setup

the raspbian distribution comes with a basic menu helping with the initial setup. You can start it anytime

sudo raspi-config

My first steps were to

  • start the ssh server
  • customize the keyboard to German layout
  • boot to raspi-config off
  • password for the user pi
  • timezone change to my local time

and a password for the root user

 sudo passwd root

Networks

for all the networking stuff, you best set a static ip for the rasberry pi.

sudo nano /etc/network/interfaces

change the content to

iface eth0 inet static
    address 192.168.0.97
    netmask 255.255.255.0
    gateway 192.168.0.1

I had to change the dns entry as well. change it here:

sudo nano /etc/resolv.conf

in most cases the ip is the one of the local router

 nameserver 10.0.0.138

and now we should try it:

 ping www.google.com

if you get some numbers back, you can be sure it works!

cancel it with STRG+C

more info: http://www.penguintutor.com/blog/viewblog.php?blog=6306

wireless network

wpa supplicant is already preinstalled. You need to put your network credentials in /etc/wpa_supplicant/wpa_supplicant.conf.

network={
        ssid="network name"
        scan_ssid=1
        proto=WPA
        id_str="office"
        key_mgmt=WPA-PSK
        pairwise=TKIP
        group=TKIP
        psk="network key"
}

Protect your key and chmod the file to 0600.

Additionally, you can give it a static ip in /etc/network/interfaces. If you want to use a static IP for your networks, you need to define a string (id_str) in the wpa_supplicant.conf (see above). Then, you can define the details for this network the usual way using the string as a reference.

iface office inet static
 address 192.168.0.122
 netmask 255.255.255.0
 gateway 192.168.0.254

add a user

i did this with the following command:

 adduser stefan

an important thing I had to find out the hard way is the parameter for the shell. I had to add the right value and the path to the home directory with

 usermod -s /bin/bash stefan
 usermod -d /home/stefan stefan

and give me sudo permissions:

 sudo adduser stefan sudo

more info: http://www.cyberciti.biz/faq/howto-linux-add-user-use-adduser-command

rsync

install it by

sudo apt-get install rsync

Mounting the USB drive at startup

get a directory for the drive

mkdir Spatzenfest

find out the device UUID with the command

sudo blkid

edit the /etc/fstab file with

sudo nano /etc/fstab

and make an entry with the UUID and the mounting location in the form of

UUID=3bd33694-c3a5-4f90-a34a-26933fec8ab7 /home/stefan/Spatzenfest ext4 defaults 0 0

Samba

I wanted to create a public directory with write and read permissions. So first of all we do a little chmod and chown for the directory we want to share:

sudo apt-get install samba samba-common-bin

add the user:

sudo smbpasswd -a stefan
sudo chown -R USER:USER /home/stefan/Spatzenfest/
sudo chmod -R ug=rwx,o=rwx /home/stefan/Spatzenfest/

then we need to edit the samba configuration file: /etc/samba/smb.conf . At the end of the file insert:

[Spatzenfest]
  comment = Public
  path = /home/stefan/Spatzenfest
#  public = yes
  writeable = yes
  valid users = stefan

you can mount samba shares like this:

sudo mount -t cifs 10.0.0.1:spatzenfest/Music /home/stefan/Music -o user=stefan,passwd=password
sudo mount -t cifs //server/sharedfolder /targetfolder

if that doesn’t work maybe you need to install smbfs or newer cifs-utils package first for cifs to be recognized.

mount: wrong fs type, bad option, bad superblock on
sudo apt-get install cifs-utils

for the share being automatically mounted, I added this line to /etc/fstab :

//10.0.0.1/Spatzenfest/Music /home/stefan/Music cifs user=,passoword= 0 0

more info: http://elinux.org/R-Pi_NAS#Configure_a_public_storage_area_on_the_RPi

VNC Connection

install tightvnc server

 sudo apt-get install tightvncserver

start the server with

vncserver

and provide a password.

then connect to it on the remote machine by specifying the IP and the session number:

10.0.0.66:1

thank you to: http://www.neil-black.co.uk/raspberry-pi-beginners-guide#.UM3Ib1LzsUR

oder um auf den Standarddesktop zu kommen

sudo apt-get install x11vnc
x11vnc -storepasswd

Hostname

change the hostname by replacing raspberrry with the desired hostname:

sudo nano /etc/hostname 
sudo nano /etc/hosts

launch the changes with

 sudo /etc/init.d/hostname.sh start

thanks to http://elsmorian.com/post/23366148056/basic-raspberry-pi-setup

Deluge

for the installation of a headless torrent server you need to install:

sudo apt-get install deluge deluged deluge-webui

I did the configuration of the deluge daemon via ssh

ssh -Y IPOFSERVER
deluge

then the gui of deluge appears.

start the daemon with

deluged

and the web service with

deluge-web --fork

thanks to:

Author: Stefan Schwaha

-<>-

Leave a Reply