#RaspberryPi – 1st setup no monitor 📺: Wifi 📶 auto connect, SSH, rename, update, docker 🐳 and more! Update 2022-Mar-10
Tags: englishpost, configuration, filesystem
Published: 2022-03-10 20:32:41

---
title: #RaspberryPi – 1st setup no monitor 📺: Wifi 📶 auto connect, SSH,  rename, update, docker 🐳 and more! Update 2022-Mar-10
published: true
date: 2022-03-10 14:00:00 UTC
tags: EnglishPost,Configuration,EnglishPost,FileSystem
canonical_url: 
---

## Content

1. Create SD card using Raspberry Pi Imager
2. Configure Wireless connection (if needed)
3. Enable SSH (if needed)
4. Find the IP address in your network
5. Access via SSH
6. Change Password (if needed)
7. Rename the device (if needed)
8. Expand FileSystem
9. Update the device
10. Install Docker
11. Setup SSH password-less access to the Raspberry Pi
12. Setup password-less access to remote work with docker 🐳
13. Run Docker 🐳 commands without sudo

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](https://brunocapuano.files.wordpress.com/2020/12/raspberry-pi-images-install-so.png?w=716)

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

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 pressing the [Config] button

![raspberry pi imager config](https://brunocapuano.files.wordpress.com/2022/03/raspberry-pi-imager-config.jpg?w=697)

_ **Note:** Open the setting using this button is new in the latest Raspverry Pi imager version._

We can define this settings on the tool screen.

![](https://brunocapuano.files.wordpress.com/2021/03/raspberry-pi-imager-advanced-options.png?w=348)

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

## Configure Wireless connection (if needed)

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 (if needed) 

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

![](https://brunocapuano.files.wordpress.com/2020/01/angry-ip-find-raspberry-pi.png?w=543)

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.

![](https://brunocapuano.files.wordpress.com/2021/01/find-detected-devices.png?w=469)

## 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

![](https://brunocapuano.files.wordpress.com/2020/01/access-to-raspberry-pi-via-ssh-with-windows-terminal.png?w=914)

You can now start working with your Raspberry Pi !

If you get a SSH error message similar to this one

```

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
---
Host key verification failed.

```

You need to run this command to fix the host hey.

```

# ssh-keygen -R <host>
ssh-keygen -R 192.168.1.247

```

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

## Change Password (if needed) 

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](https://brunocapuano.files.wordpress.com/2020/12/raspi-config-main-menu.png?w=1024)

Option number 1 will allow us to change the password.

![](https://brunocapuano.files.wordpress.com/2020/12/raspi-config-change-password.png?w=1024)

## Rename the device (if needed) 

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](https://brunocapuano.files.wordpress.com/2020/12/raspi-config-advanced-options.png?w=1024)

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](https://brunocapuano.files.wordpress.com/2020/12/raspberry-pi-updates-completed.png?w=791)

## 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

```

## Setup ssh password-less access to the Raspberry Pi

The main resource is an official one fro the Raspberry Pi org: [Passwordless SSH access](https://www.raspberrypi.org/documentation/remote-access/ssh/passwordless.md). Here is a quick resume for Windows 11 users. First let’s run this command

```

ls ~/.ssh

```

I already keys on my computer, so I found id\_sa and id\_rsa.pub.

![raspberry pi ssh keys](https://brunocapuano.files.wordpress.com/2021/08/raspberry-pi-ssh-keys.png?w=645)

Now, let’s copy them to the device. For this this command:

```

cat ~/.ssh/id_rsa.pub | ssh <USERNAME>@<IP-ADDRESS> 'mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys'

```

And that’s it! Now we can ssh the Raspberry Pi without password.

_ **Disclaimer:** you know that this is not a very secure practice?_

## Setup SSH password-less access to remote work with docker 🐳

Once we finished ssh password-less access, we can easily configure a TCP-enabled Docker.

I followed the next steps. First, let’s edit _docker.service_ with the command:

```

sudo nano /lib/systemd/system/docker.service

```

And add [-H tcp://0.0.0.0:2375] at [ExecStart] section:

![raspberry pi ssh password less docker](https://brunocapuano.files.wordpress.com/2021/08/raspberry-pi-ssh-password-less-docker-1.png?w=976)

And restart the device or just the needed services

- run _sudo systemctl daemon-reload_
- run _sudo systemctl restart docker_

## Run Docker 🐳 commands without sudo

Now let’s upgrade our docker commands, so we can run them without sudo. Just run this commands

```

sudo groupadd docker
sudo gpasswd -a $USER docker

```

And also restart the service:

```

sudo service docker restart

```

## 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

- [How to grant permissions to a folder after git clone, to perform dotnet restore on a Raspberry Pi](https://elbruno.com/2020/01/04/howto-grant-permissions-to-a-folder-after-git-clone-to-perform-dotnet-restore-on-a-raspberrypi-dotnetcore/) 
- [How to install .Net Core 3.1 in a Raspberry Pi 4](https://elbruno.com/2019/12/30/raspberypi-how-to-install-net-core-3-1-in-a-raspberry-pi-4/) 
- [Installing Visual Studio Code in a Raspberry Pi 4, run as root, fix black screen](https://elbruno.com/2019/10/01/vscode-installing-visual-studio-code-code-in-a-raspberrypi-run-as-root-fix-black-screen-updated/)
- [How to install .Net Core in a Raspberry Pi 4 and test with Hello World](https://elbruno.com/2019/08/27/raspberrypi-how-to-install-dotnetcore-in-a-raspberrypi4-and-test-with-helloworld-of-course/) 
- [Build and Run C# NetCore projects in a Raspberry Pi 4 with Visual Studio Code](https://elbruno.com/2019/08/28/vscode-build-and-run-c-dotnetcore-projects-in-raspberrypi/) 
- [Let’s do some Git dev in Raspberry Pi 4 (GitHub and Azure DevOps!)](https://elbruno.com/2019/09/02/vscode-lets-do-some-git-dev-in-raspberrypi-github-and-azure-devops/) 
- [Install OpenCV](https://elbruno.com/2020/01/23/raspberrypi-install-opencv/) 
- [Install Python 🐍 Virtual Environments in Raspberry Pi](https://elbruno.com/2020/01/29/raspberrypi-install-virtual-environments/)
- [Setup SSH passwordless access to remote work with Docker 🐳](https://elbruno.com/2021/02/01/raspberrypi-setup-ssh-passwordless-access-to-remote-work-with-docker-%f0%9f%90%b3/)
- [Manage Docker 🐳 as a non-root user](https://elbruno.com/2021/02/02/raspberrypi-manage-docker-%f0%9f%90%b3-as-a-non-root-user/)
- [Build Docker 🐳 images from Visual Studio Code remotely using a Raspberry Pi](https://elbruno.com/2021/02/03/raspberrypi-build-docker-%f0%9f%90%b3-images-from-visual-studio-code-remotely-using-a-raspberry-pi-azureiot/)

###### Tools and Apps for Raspberry Pi

- [Where is my Task Manager in RaspberryPi? Let’s try htop](https://elbruno.com/2019/09/23/raspberrypi-where-is-my-task-manager-lets-try-htop/)
- [Multi-monitor 📺 in Raspberry Pi 4 rocks !](https://elbruno.com/2019/09/30/raspberrypi-multimonitor-support-in-raspberrypi4-rocks/)
- [Double Commander on RaspberryPi4, because files are important](https://elbruno.com/2019/10/02/raspberrypi-double-commander-on-raspberrypi4-because-files-are-important/)
- [How to install Docker 🐳 in a Raspberry Pi 4](https://elbruno.com/2020/01/24/raspberrypi-how-to-install-docker-updated-2020-01-24/)
- [Installing Visual Studio Code in a Raspberry Pi](https://elbruno.com/2019/08/20/vscode-installing-visual-studio-code-in-a-raspberrypi-a-couple-of-lessons-learned-code/) 
- [Installing Visual Studio Code in a Raspberry Pi, run as root, fix black screen (Updated)](https://elbruno.com/2019/10/01/vscode-installing-visual-studio-code-code-in-a-raspberrypi-run-as-root-fix-black-screen-updated/)
- [6 commands to install OpenCV for Python 🐍 in a Raspberry Pi 4](https://elbruno.com/2019/10/01/raspberrypi-6-commands-to-install-opencv-for-python-in-raspberrypi4/) 

###### Setup the device

- [1st Setup without monitor 📺: auto connect to WiFi 📶, enable SSH, update and more](https://elbruno.com/2021/06/07/raspberrypi-1st-setup-no-monitor-%f0%9f%93%ba-wifi-%f0%9f%93%b6-auto-connect-ssh-rename-update-docker-%f0%9f%90%b3-and-more-update-2021-june-07/)
- [Setup without monitor: enable VNC](https://elbruno.com/2020/01/21/raspberrypi-setup-without-monitor-enable-vnc/)
- [How to enable auto start with HDMI safe mode](https://elbruno.com/2019/08/22/raspberrypi-how-to-enable-auto-start-with-hdmi-safe-mode/)
- [Running a Python 🐍 script in a Python Virtual Environment on reboot / startup](https://elbruno.com/2019/07/30/raspberrypi-running-a-python-script-in-a-python-virtual-environment-on-reboot-startup/)
- [Setup Wifi on Ubuntu](https://elbruno.com/2021/02/12/raspberrypi-update-or-setup-wifi-configuration-in-ubuntu/)

###### Hardware

- [Ice Tower, the best cooler 🧊 for your device! From 70C to <40C in a 60 minutes process running at 100% in all 4 cores](https://elbruno.com/2020/01/06/raspberrypi-ice-tower-the-best-cooler-for-your-device-from-70c-to-40c-in-a-60-minutes-process-running-at-100-in-all-4-cores)
- [Intel Neural Stick 2, Performance differences in Face Recognition using OpenVino](https://elbruno.com/2020/01/28/raspberrypi-performance-differences-in-facerecognition-using-openvino-code-with-code/)