Skip to content

Instantly share code, notes, and snippets.

@viliampucik
Last active April 19, 2020 15:52
Show Gist options
  • Save viliampucik/440b3c1a47c69b842741f0cafd8318f5 to your computer and use it in GitHub Desktop.
Save viliampucik/440b3c1a47c69b842741f0cafd8318f5 to your computer and use it in GitHub Desktop.
Ubuntu Headless
# Unmount mounted microSD card partitions, just in case
sudo umount /dev/mmcblk0p1
sudo umount /dev/mmcblk0p2
# Download the latest Ubuntu Server and upload it to microSD card: https://ubuntu.com/download/raspberry-pi
wget http://cdimage.ubuntu.com/releases/19.10.1/release/ubuntu-19.10.1-preinstalled-server-arm64+raspi3.img.xz
xzcat ubuntu-19.10.1-preinstalled-server-arm64+raspi3.img.xz | sudo dd of=/dev/mmcblk0 bs=4M conv=fsync status=progress
sync
sudo partprobe /dev/mmcblk0
sudo mkdir /tmp/rpi
sudo mount /dev/mmcblk0p1 /tmp/rpi
# Configure static IPs: https://netplan.io/examples#using-dhcp-and-static-addressing and https://ubuntu.com/tutorials/how-to-install-ubuntu-on-your-raspberry-pi#3-wifi-or-ethernet
sudo tee /tmp/rpi/network-config > /dev/null <<'EOF'
version: 2
ethernets:
eth0:
# dhcp4: true
addresses: [192.168.1.254/24]
gateway4: 192.168.1.1
nameservers:
addresses: [9.9.9.9]
optional: true
wifis:
wlan0:
# dhcp4: true
addresses: [192.168.1.253/24]
gateway4: 192.168.1.1
nameservers:
addresses: [9.9.9.9]
optional: true
access-points:
YOUR_WIFI_NAME:
password: "YOUR_WIFI_PASSWORD"
EOF
sudo umount /tmp/rpi
sudo rm -rf /tmp/rpi
# Boot RPi from microSD card
ssh ubuntu@192.168.1.254
#ubuntu
# OS update
sudo apt update
sudo apt full-upgrade
# Reboot to apply the changes
sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment