RASPI – Part 2 – loading the OS and configuration.

There are many distros of OS available for the Pi, but I am going to be talking about Raspian “wheezy” (scroll down on their page) .  Regardless of the OS you choose everything that follows should apply.

Prerequisites:

  1. a Pi in an assembled enclosure
  2. an SD card – I am using a Lexar 32 gig class 10
  3. a computer capable of writing your OS of choice onto the SD card – I am using a Dell Laptop running Ubuntu 12.04 – LTS
  4. a wireless USB dongle (ASUS N10 for example – check the list of approved hardware)  or a wired network close by
  5. a powered USB 2.0 hub
  6. a keyboard and mouse
  7. a monitor – can be a TV (the Pi has an HDMI out)

 

Our goal:  To install an OS (Raspian “Wheezy”) and configure our wireless networking  without DHCP so that we may use remote desktop to access the Pi.

 

Procedures:

  1. go to the website noted above and download the Raspian “wheezy” file to your Linux laptop.
  2. cd to the directory containing the download
  3. unzip 2013-05-25-wheezy-raspbian.zip (your file name will most likely be different) – unzipping yields the following file name in this example:
    2013-05-25-wheezy-raspbian.img
  4. in a terminal window do:  “df” and note the output
  5. insert your SD card and do a “df” again.  Note the device that shows up.  Its important that you identify the correct device for you SD card.  My card shows as:                                   /dev/sdb1 31263744  32  31263712   1% /media/9016-4EF8
  6. unmount /dev/sdb1 – my situation
  7. sudo dd bs=4M if=2013-05-25-wheezy-raspbian.img of=/dev/sdb  <—NOT sdb1note in the above:
    a.  “if=” is my release of Raspian “wheezy”
    b.  “of=” is my “filesystem name” from the “df” command less
    the trailing 1, i.e., /dev/sdb NOT /dev/sdb1this write will take awhile.  when complete
  8. sudo sync
  9. remove the card.
  10. without adding power to your Pi plug in the keyboard, mouse, and wireless dongle into the USB hub.  Plug the hub into one of the USB ports on the Pi.  Connect the Pi to a monitor.
  11. plug the Pi into a power source (A UPS would be a great idea since incorrectly shutting down the Pi could result in SD card corruption and you would have to do this all over again unless you have a backup image that you can re-blow onto your SD card.
  12. First boot for the Pi will present you with the following screen (double click the image to enlarge):raspi_configHere you want select:  1, 2, 3, 4 (locale, keyboard, and timezone), 8 (advanced options:  hostname, SSH – enable) and any others that might apply.  You can always launch this configuration dialog at a later time by opening a terminal and enter “sudo raspi-config”
  13. OK.  Now lets configure our networking for both wired and wireless.  Note:  the baseline configuration of this device like so many others assumes that the network  you will be connecting to offers DHCP.  Probably most homes use DHCP, but if you don’t then you will have a problem with connecting with the default configuration.  This part of the configuration deals with setting a networking in a non DHCP environment.  Its simple and quick.  We will modify one file and reboot.  Here is how:

a.  open a terminal window and login as root:  sudo –s

b.  cd /etc/network

c.  cp interfaces interfaces.bu  (your making a copy of this file in case you hose it)

d.  using your favorite editor (I use vi) edit the file:  vi interfaces

e.  and make it look like this (for clarity I will use two IP address – one for wired and one for wireless.  they will be 192.168.1.12 and 192.168.1.13 respectively:

———cut here ——–

# define wired setup begins here

auto lo

iface lo inet loopback

iface eth0 inet static

address  192.168.1.12

gateway 192.168.1.xxx (depends upon you setup)

netmask 255.255.255.0

network 192.168.1.0

broadcast  192.168.1.255

dns-nameservers  zzz.zzz.zzz.zzz, zzz.zzz.zzz.zzz (provided by your ISP)

 

#define wireless setup begins here

auto wlan0

allow-hotplug wlan0

iface wlan0 inet static

address  192.168.1.13 ( this MUST NOT be the same as the wired network above)

gateway 192.168.1.xxx  (depends upon you setup)

netmask 255.255.255.0

network 192.168.1.0

broadcast  192.168.1.255

dns-nameservers  zzz.zzz.zzz.zzz, zzz.zzz.zzz.zzz (provided by your ISP)

wpa-passphrase -your router/access points password

wpa-ssid – the name your router/access point broadcasts

——–cut here——–

DONE

I have not found an acceptable way on this OS to restart the network without it telling me that command has been deprecated, so I resort to a reboot – sudo reboot

when the Pi comes up login and issue sudo ifconfig –a you should see something like this:

ifconfig

Note that I have airbrushed the mac addr portion.  You are interested in the wlan0 entry.  You should see your ip, broadcast addr, and netmask that you entered in the interfaces file.

Test by loading your favorite website in a browser.

 

Now that we are networked lets update our Pi to the latest bug fixes etc. (networking must be working for this to happen)

  1. sudo apt-get update
  2. sudo apt-get upgrade
  3. sudo apt-get dist-upgrade

Lets install remote desktop software

  1. on the Pi – sudo apt-get install tightvncserver
  2. in a terminal window start the sever – vncserver

provide a passwd – remember it.  you will need it was logging in from the client

answer “no” to view only password.

On another computer that will access the Pi you need to install a vnc client.  There are many to choose from and they are available for windows and for Linux.

When you decide on a client log into your Pi through a screen like this (depending on the client you choose your screen will be different in appearance):

vnc_client

Your address in the “VNC Server” field would be 192.168.1.13:1 (NOTE:  the “:1” as part of the address) as per the above examples.

And how the Pi desktop looks from a windows machine:

 

raspi desktop

Leave A Reply

Your email address will not be published. Required fields are marked *


*

Bad Behavior has blocked 449 access attempts in the last 7 days.