Loading [MathJax]/extensions/TeX/AMSsymbols.js

Saturday, 30 December 2017

Setting up a new Raspberry Pi (2017 Edition)

Last post of the year and admittedly not all that many in 2017. This one is more of a personal reference of the steps taken to setup a new Raspberry Pi. In this case using the Raspbian Jessie OS.

The version of the Pi used here, the Zero W, includes built-in WiFi.

First steps were performed using a Windows 10 machine.

1. Download image. The one I'm using is the 10th April 2017 Raspbian Jessie image.
2. Get a new Micro SD card and plug into the PC. I have an external USB card reader for this. It should appear as a newly mounted drive.
3. Unzip and flash the .img file to the SD card. I use Etcher. Follow the workflow to select the image, select the drive corresponding to the SD card and then Flash.
4. Disconnect the external drive and insert the Micro SD into the Raspberry Pi.

Now I plugged the Raspberry Pi into a TV via HDMI (an HDMI to Micro HDMI connector is required for the Zero) and switched on. At this point you should see it boot and start the windows.

5. Next, the important step, change the default password. Open a command window and use the pwd command.
6. From the same command prompt, enter sudo raspi-config. Select the Advanced Options and Expand Filesystem. This ensures the whole of the SD card is available to the Pi.
7. In the same tool, enable SSH and VNC. This is because I want to remotely logon to the machine from elsewhere on my network.
8. Now reboot.
9. After the machine has restarted I connect to the network using WiFi. I used the UI from Raspbian to do this.
10. Now I can get the latest updates of the OS, sudo apt-get update followed by sudo apt-get upgrade.
11. For the purposes of my network, I want to use a static IP address, rather than use one assigned by DHCP. To do this edit /etc/dhcpcd.conf and add the following lines to the bottom, assuming the router IP is 192.168.0.1 and we want to setup our static IP to 129.168.0.207

   interface wlan0

   static ip_address=192.168.0.207/24
   static routers=192.168.0.1
   static domain_name_servers=192.168.0.1
 
12. Connect to the network share. From the command line it's possible to do this using:

    sudo mount -t cifs -o guest //ip.of.nas/Public /home/pi/NAS

I want to be able to connect automatically on start up. To do this requires a couple of steps, first add the following to the end of /etc/fstab

  //ip.of.nas/Public /home/pi/NAS cifs guest 0 0

However the problem with this as it stands is this step is run before connection to the network at boot time. To fix, open raspi-config, select boot options and Wait for network at boot.
13. Finally reboot. The Raspberry Pi setup is now complete.

No comments:

Post a Comment