Its been a while since i’ve had time to play around with my pi. I decided to have another go at getting Samba up and running… but first, setting the foundations:

Formatting the SD Card:

The first thing you’ll want to do is grab the rasbian image from raspberrypi.org. You’ll want the wheezy raw image.

Once the download has finished, open up a terminal and unzip the image (it has suprisingly good compression):

    unzip 2014-01-07-wheezy-raspbian.zip

You then need to find out where your SD card is. This can be done by executing df -h (You might want to run this before and after you insert the SD card ):

    df -h

In my case there are two mount points. They both/all need to be unmounted:

    umount /dev/sdb1
    umount /dev/sdb2

You can then write the image to the SD card using the dd command (an alternative is to use ImageWriter, or on Windows Win32 Disk Imager):

    sudo dd  bs=1M if=2014-01-07-wheezy-raspbian.img of=/def/sdb

“bs” is the block size – apparently you can increase this to 4 and it will take less time.
Note that for the target, “sdb” is used as opposed to sdb1 or sdb2. This is is because we want to overwrite the existing partitions.

SSH:

You are now ready to fire up the Pi; connect it to your router and with the SD card in turn it on. You can then log into your router to find out its ip.

An alternative is to use nmap:

    sudo apt-get install nmap
    sudo nmap -T5 10.13.37.1-255 -p 22 –open

This scans the ip range specified and prints the host’s ip for which port 22 open.

[EDIT 30/01/14] Perhaps a better way is to look at the address resolution protocol tables using the ‘arp’ command. ‘b8:27:eb’ is the range of MAC addresses that have been reserved for the raspberry pi foundation; using the arp tables we can marry this MAC to an ip address:


    arp -n | grep ‘b8:27:eb’

You can now ssh into the pi (I think older releases didn’t have ssh enabled by default?):

    ssh pi@192.168…

We can now configure the pi:

    sudo raspi-config

This has changed since last time I saw it. The only thing I really wanted to change (this time round) was to expand the filesystem.

I found these commands useful:
    sudo reboot
    sudo poweroff

VNC Server:

The next think I wanted to do was set up a vnc server. As per the previous post:

    sudo apt-get install tightvncserver
    sudo nano /etc/init.d/tightvnc

span { font-family: ‘Courier New’; font-size: 10pt; color: #000000; } .sc0 { } .sc2 { color: #008000; } .sc3 { color: #FF0000; } .sc4 { font-weight: bold; color: #0000FF; } .sc5 { color: #808080; } .sc6 { color: #808080; } .sc7 { font-weight: bold; color: #804000; } .sc8 { }

#!/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 vnc server # Description: ### END INIT INFO case “$1” in start) su raspberry -c ‘vncserver :1 -geometry 1024×768 -depth 16 -pixelformat rgb565:’ echo “VNC Started” ;; stop) pkill Xtightvnc echo “VNC Terminated” ;; *) echo “Usage: /etc/init.d/tightvnc {start|stop}” exit 1 ;; esac

    sudo chmod +x /etc/init.d/tightvnc
    sudo update-rc.d tightvnc defaults
    sudo reboot

You should now be able to vnc to your pi (after installing a vnc viewer on your client).

Advertisements