Skip to content

Install Raspbian

ferguman edited this page May 30, 2018 · 1 revision

Assumptions:

  • The target hardware is a MVP II compatible system.
  • The blossom version of the code is being installed
  • You will use an OS X system to prepare and SD card for the Raspberry PI that is attached to your MVP
  • You will configure the SD card to autoconnect to your wireless network on boot. This will allow you to set things up with out needing to connect a keyboard and mouse to your Raspberry Pi.
  • You will use SSH to connect to your MVP to configure it and install the mvp software
  • You will use SSH to configure and control your MVP

What you need:

  • An SD card - Nothing huge 8G or 16G
  • A Macbook Pro or equivalent OS X system
  • An MVP system
  • A LAN with Wifi that both your Macbook Pro and the MVP can connect to.

Get Raspbian

  • Download raspbian. For these instructions I downloaded the zip version of "stretch with desktop" file name: 2018-04-18-raspbian-stretch.zip
  • Double click the file zip file downloaded above at which point your OS X system will unzip the contents. After your system is done unzipping it will create an image file. The image file created on my system was named: 2018-04-18-raspbian-stretch.img. Make note of the image file name. You will need it later when you see "[name_of_your_raspbian_img_file]" in the instructions.
  • Note as time moves on and new versions of Raspbian are released the file names given above will become obsolete. Just go with the flow and use the newest released version of Raspbian. It will probably work but no guarantees. Sorry I didn't create the Internet.

Burn Raspbian to your SD Card

DANGER - if you perform some of these commands incorrectly you could wipe your OS X installation. Only proceed if you are comfortable with the commands involved.

  • Open a command shell in OS X.

  • run: diskutil list. You will see a list of the connected drives. See the sample image below. Take note of the "names" in the list such as /dev/disk3.

  • insert your SD card into your computer's SD card reader.

  • run: diskutil list again. Check the resulting listing. There should be a new drive name (something like "/dev/disk3") that was not present the first time that you ran diskutil. This new drive is your SD cards drive name. Make sure that you use it in place of the text [name_of_your_sd_card_disk] in the instructions that follow.

  • run diskutil unmountDisk [name_of_your_sd_card_disk]. For example on my system my SD card was named /dev/disk3 so I ran the following command: diskutil unmountDisk /dev/disk3.

  • run sudo diskutil eraseDisk FAT32 MVP MBRFormat [name_of_your_sd_card_disk]. Note that this command will erase all the data on the drive name that you supply for [name_of_your_sd_card_disk]. Make damn sure you specify the correct disk name. On my system the command was: sudo diskutil eraseDisk FAT32 MBR MBRFormat /dev/disk3. Note that the second parameter to the eraseDisk command is the name that you want the drive to have and thus you are free to choose whatever you want for this value. I used "MBR".

  • If you run into issues with the above command then:

  • run diskutil unmountDisk [name_of_your_sd_card_disk].

  • run sudo dd bs=1m if=Downloads/[name_of_your_raspbian_img_file] of=[rdisk_access_to_your_sd_card]. For example on my system I ran: sudo dd bs=1m if=Downloads/2018-04-18-raspbian-stretch.img of=/dev/rdisk3. Note that [rdisk_access_to_your_sd_card] is a faster access method to your card. This command will take awhile to complete and will not show any status. Be patient and wait for the command to complete.

Preload your Wifi information onto the SD Card

If you want your new MVP to boot up and automatically join your wireless network then please follow the instructions here. Otherwise skip to the next section.

As per this page you can set things up so that Raspbian will join the wifi network the first time you boot the SD card:

If a wpa_supplicant.conf file is placed into the /boot/ directory, this will be moved to the /etc/wpa_supplicant/ directory the next time the system is booted, overwriting the network settings; this allows a Wifi configuration to be preloaded onto a card from a Windows or other machine that can only see the boot partition.

  • Create a file named wpa_supplicant.conf in the top directory of the newly created SD card image. Use your favorite text editor to open a file and then save the empty file to the top level of the SD card image. Make sure it is saved as wpa_supplicant.conf. Some editors will try to be helpful and name the file wpa_supplicant.conf.txt. Don't let this happen.

  • Prepare your wpa_supplicant.conf file. Edit the file created above to contain the correct wifi information for your new PI. A sample file is copied below. Note that you will have to set your country, ssid, and psk to values that match your network. The sample file contains a hashed psk. Google wpa_supplicant to learn more about how to create this file and hashed psk values. You could put your wifi password directly in this file but it is not recommended as this practice causes your password to be made vulnerable at multiple spots (e.g. on the SD card, in your editor's backup logs, etc).

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
    ssid="the Munster Household"
    psk=1233214123412341241241231241241234123423423423423423423423423423
    key_mgmt=WPA-PSK
}

Enable SSH at First Boot

By default Raspbian boots up with SSH disabled. To tell Raspbian to boot up with SSH enabled create a file named ssh in the root directory. Here is how I did that:

  • df -l Use this command to find the name of your mounted SD volume.
  • cd /Volumes/boot /Volumes/boot was taken from the output of the above command.
  • touch ssh This command creates an empty file named ssh.

Boot your Raspberry Pi and connect with ssh

  • run diskutil eject [name_of_your_sd_card_disk] to eject your SD card. On my system I ran diskUtil eject /dev/disk3.

  • remove the SD card. Put it in your Raspberry pi (need picture showing proper orientation) and power up your pi.

  • Locate your PI on the network and identify it's IP address. I do this by logging into my router and looking at the list of DHCP leases. The PI will identify itself in this list as raspberrypi.

  • run ssh pi@[ip address of your pi] on my setup ran ssh 192.168.4.147

  • You will be prompted for a password. Enter "raspberry". This is the default password. You should change this immediately.

  • run passwd pi and follow the prompts to change your password.