There were two things in my last post that I wanted to improve.
First, the whole procedure of flashing could have been automated. Lucky us, there is already a tool.
Second, having to attach a keyboard, network cable and screen sucks. It is not necessary at all.
On a Mac, I installed Homebrew as a prerequisite:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Of course other software is needed, but more on that below.
Flashing the Disk and WLAN Setup
The small script called “flash” downloads the disk image, flashes the card, and sets up WLAN.
Again, some prerequisites need to be installed.
brew install pv
brew install awscli
brew install wget
wget https://raw.githubusercontent.com/hypriot/flash/master/$(uname -s)/flash
chmod +x flash
sudo mv flash /usr/local/bin/flash
Now, with just one command, everything will be set up.
flash -n <hostname> -s <ssid> -p <passwd> http://downloads.hypriot.com/hypriot-rpi-20151115-132854.img.zip
After that, take out the card, insert it into your RPi. Plug in power and enjoy the show.
Connecting
As noted above, there is no need to attach a keyboard and screen to find out the IP address of your RPi as long as it has a network connection.
Since we set the hostname before, check whether the host is online with
ping -c 1 <hostname>
as described in this blog post, and then connect with
ssh root@<hostname>
if the host is reachable.
If you are using a different image, you can do the following to find your RPi.
With a small tool called nmap you can scan your network and get the IP addresses for all Raspberry Pis on your LAN.
Installing nmap is as easy as:
brew install nmap
Then try to find the IP addresses with:
sudo nmap -sP 192.168.178.0/24 | awk '/^Nmap/{ip=$NF}/B8:27:EB/{print ip}'
With the result, just connect to the RPi:
ssh root@<that_ip>
See this post on Stack Exchange for more context.
Oh, and don’t forget to change your password with passwd. ;-)
Done for today!