#RaspberryPi – 1st setup no monitor 📺: Wifi 📶 auto connect, SSH, rename, update, docker 🐳 and more! Update 2021-Mar-22

Buy Me A Coffee

Updated version of this post here.

Hi!

Let’s start installing the latest Raspberry Pi OS image in an SD card. Next steps will be focus on how to access and control remotely your device you may want to follow this steps.

raspberry Pi Images install SO

This tutorial and tips works for Raspberry Pi 3, 4 and Zero.

Update 2021-Mar-22.

The version 1.6 of Raspberry Pi Imager includes a new feature that allows to

  • Define HostName
  • Enable SSH
  • Configure Wifi
  • Set locale

Directly from the tool. Just press [Ctrl-Shift-X] and define this settings on the tool screen.

I’ll leave the old-school standard methods below just as a reference.

Configure Wireless connection (old-school)

In the SD Card, you need to create a file named [wpa_supplicant.conf] in the root of the SD card with the following information:

country=ca
update_config=1
ctrl_interface=/var/run/wpa_supplicant

network={
 scan_ssid=1
 ssid=" Your WiFi SSID"
 psk="You amazing password"
}

The file content is very straight forward to understand. Main values to complete are [ssid] and [psk].

Once you put the SD card in the device and start the device, it will automatically connect to the configured WiFi.

Enable SSH (old-school)

If you also want to enable SSH, you need to create a blank file named [ssh] to the main partition.

Once you put the SD card in the device and start the device, it will automatically enable the SSH service.

So, you need to create and copy 2 files to the root of your SD card

  • wpa_supplicant.conf
  • ssh

Find the IP address in your network

And that’s it, your Raspberry Pi will be connected to the Wifi and with SSH enabled. At this moment we can use a tool like AngryIp (see references) to detect the new device in the network

My new device IP is: 192.168.1.246

I’m trying to avoid Java updates, and even install java, so lately I use a mobile app: Fing, and after a search the results are nicer.

Access via SSH

I used to like Putty to connect to my device, however during the past months I’ve been using Windows Terminal and Powershell. In order to access the device I need to execute the command

ssh user@deviceaddress

and my data is

  • user: pi
  • ip: 192.168.1.246
  • password: raspberry

You can now start working with your Raspberry Pi !

Important: the default password is raspberry, please follow next step!

Change Password

The default password for the device is “raspberry”, and as usual, it’s recommended to change it. In order to do this, in the ssh terminal, let’s access to the device configuration

sudo raspi-config

This will open the configuration for the device.

raspi config main menu

Option number 1 will allow us to change the password.

Rename the device

In the same section we can change the Host Name.

And define the new name for the Raspberry Pi device.

Expand FileSystem

Another important option in the configuration is to expand the SD disk.In the same configuration screen, select

  • 6. Advanced Options
  • Expand File System
raspi config advanced options

Now we need to reboot and after the reboot the file system should have been expanded to include all available space on your micro-SD card. Reboot with the command

sudo reboot

Update the device

There are 2 ways to update the device, using commands and using raspi-config.

  • In the Raspi Config main menu, the option 8 will launch the update commands.
  • If you prefer to manually type an update command, this one works for me
sudo -- sh -c 'apt-get update; apt-get upgrade -y; apt-get dist-upgrade -y; apt-get autoremove -y; apt-get autoclean -y'
updates complete

Install Docker

The information is available from the Official Docker Documentation

curl -fsSL https://get.docker.com -o get-docker.sh

sudo sh get-docker.sh

And then, a simple check for the docker version with the command

docker version

Conclusion

And that’s it, we have our device updated and running with the latest software versions and we didn’t use a monitor! I’ll update this post frequently to make it relevant with my personal best practices.

Happy coding!

Greetings

El Bruno


My posts on Raspberry Pi ⚡🐲⚡

Dev posts for Raspberry Pi
Tools and Apps for Raspberry Pi
Setup the device
Hardware

3 thoughts on “#RaspberryPi – 1st setup no monitor 📺: Wifi 📶 auto connect, SSH, rename, update, docker 🐳 and more! Update 2021-Mar-22

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.