In the past I've always attached a keyboard and mouse and HDMI monitor to the Pi to configure it initially. But here is how to configure an SDCard so it is headless, running SSH and connecting to your wifi network:
- dd the Raspbian image to the microSD card
- Re-insert the microSD card on your Linux laptop or desktop PC, it should automount the boot and linux partitions on the card
- cd /media/USERNAME/boot
- The USERNAME is your username
- touch ssh
- cd /media/USERNAME/02133478634982/
- The number above is the partition uuid, check the output from df -h for a clue
- cd etc wpa_supplicant
- wpa_passphrase YOURSSID "yourpassword" >> wpa_supplicant.conf
Then you can unmount the microsd card and put it in your Pi and it will boot up and put itself on your wifi network. I usually run an nmap ping scan (sudo nmap -sP SUBNET/24) to find out what new Raspberry Pi's have appeared on the network, and then add it's MAC address as a static DHCP IP address.
You can then ssh to your newly minted Pi and run sudo raspi-config to do things such as
- Change the hostname
- Set your default locale (eg en_AU.UTF-8) and timezone
- Expand the file system to take the rest of the microsd
- Enable the VNC server (you will need to download RealVNC connect to connect to it as encryption is turned on - don't know how to turn this off).
- Set your HDMI default resolution to something higher than the default, eg 1024x768 - this will allow the VNC server to also be this resolution
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.