Set Up Ubuntu on Raspberry Pi4 without Monitor

0xkoji - Jun 6 '21 - - Dev Community

Step.1 Download Ubuntu image

Download 64-bit from the following link.
https://ubuntu.com/download/raspberry-pi

Step.2 Write image on MicroSD card

Write the image by Raspberry Pi Imager

You can download Raspberry Pi Imager here
https://www.raspberrypi.org/software/

Writing steps are very simple.

  1. open Raspberry Pi Imager
  2. Operating System --> Use Custom
  3. Storage --> Select your microSD card
  4. Click WRITE

Alt Text

Step.3 Modify networks settings for ssh

Connect your MicroSD to your mac and open system-boot.
There is a file, network-config and open it by an editor.
Change MY_WIFI and MY_PASSWORD to your wifi settings.

version: 2
ethernets:
  eth0:
    dhcp4: true
    optional: true
wifis:
  wlan0:
    dhcp4: true
    optional: true
    access-points:
      "MY_WIFI":
        password: "MY_PASSWORD"
Enter fullscreen mode Exit fullscreen mode

Step.4 Check user-data

Open user-data and check ssh information.

# On first boot, set the (default) ubuntu user's password to "ubuntu" and 
# expire user passwords
chpasswd:
  expire: true
  list:
  - ubuntu:ubuntu

# Enable password authentication with the SSH daemon
ssh_pwauth: true
Enter fullscreen mode Exit fullscreen mode

Step.5 ssh to ubuntu

Search your localnet work to find out your raspberry pi's ip address.

In my case, I used arp-scan.

# install arp-scan via homebrew
$ brew install arp-scan

# scan localnet
$ sudo arp-scan --localnet
Enter fullscreen mode Exit fullscreen mode
$ ssh ubuntu@raspberrypi_ip_address
# password is ubuntu
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .