Sunday, April 3, 2016

Raspberry Pi 3 - Arrived and setup.

After a bit of waiting my new Raspberry Pi 3 Model B just arrived.  

I wanted to share a few of my steps I used in getting started and paired up with my Mac for easy development.

Having played with both Raspbian and Microsoft IOT Core with my Pi 2.  I currently
prefer to use Raspbian, so this article will focus on that.

1.  Download & Install the Raspbian on an SD Card.
    If you're not familiar with dd then you should consider using the NOOBS install method as it's painless.

    Raspbian is based on Debian Jessie or Jessie Lite (Depending on the choice you made)
    I used the one based on Jessie.
 
2.  Insert SD Card, Hook up Monitor, Mouse, Keyboard, and a network cable.

3.  By default the Raspbian installation ships with pi as the default user and raspberry as the default password.   Unless you plan on keeping your Pi off of any network you need change this.   It's just a matter of time until a worm will be developed looking to infect a Pi with a default password.  So change the default password and if desired create and use a different user all together.

4.  As with all new OS installations you should perform updates right after installation.
    This is very good security practice.   It's also the good to do on regular basis.  
   
    To update Raspbian you use apt-get
    The following two commands will get you updated.
 
    sudo apt-get update
    sudo apt-get dist-upgrade
 
    The first updates the list of packages.
    The second performs all of the upgrades and manages the dependencies that they require.
 
    You will want to do this on a regular basis to keep your machine updated.
    If you want you can setup cron to automatically do this.    After reading the article check out the comments for a good bash script, that will email you when updates are available.
 
5.  Change the hostname if you want.   Since I have multiple pi's I rename each image to be unique.
     If you have the graphical interface you can select the following menu to rename the hostname.

  • Menu (With the raspberry image on it)
  • Preferences
  • Raspberry Pi Configuration

    If you don't have the gui you can edit two files to change the hostname.
       
6.  If you have Pi 3 or an earlier Pi with a USB Wifi Adapter you may want to setup wireless.

7.  Now I set up Fuse for OSX on my Mac so I can make my PI a mount point on mac.   This article I found covers how to set this up.    This allows me to use editors on my Mac to edit files on my machine.   I then use SSH to execute that code on the machine.    I then can disconnect the keyboard, monitor, and mouse from the Pi as it's no longer required as I can use my main machine to easily control it.
 
8.  If you need access to the graphical interface from your mac you can do that as well using VNC, due the nature of what I want to do next I am not installing this at this time.

9.   Beware although this setup works.   You are storing your code directly on the Pi.   So when coding you do run this risk of losing your code if something bad happens.   So since git is preinstalled on Raspbian, I tend to initialize a repository in my code directory, setup remote origin and push the changes to a remote repository.     That way you don't lose your work that is on the pi.  I love BitBucket for this as you can as many free private repositories as you want.



No comments:

Post a Comment