Installation 2023, Dec 15-17
- Old SD card seemed corrupted
- New installation necessary
https://ubuntu.com/tutorials/how-to-install-ubuntu-on-your-raspberry-pi
As soon as there is a connection to an ubuntu server: upgrade system
- sudo apt update
- sudo apt upgrade
- sudo apt dist-upgrade
(repeat after restart)
Install software:
- sudo apt install build-essential
- sudo apt install libboost-all-dev
- sudo apt install libusb-1.0-0-dev
- sudo apt install libv4l-dev
sudo apt install libopencv-dev
Old notes
Prepare SDCARD
- Download image: https://ubuntu.com/download/raspberry-pi
https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.4-preinstalled-server-arm64+raspi.img.xz - Unzip the image: unxz ubuntu-22.04-preinstalled-server-arm64+raspi.img.xz
- Insert SDCARD, find where it is: lsblk -p
- MAKE SURE YOU HAVE THE CORRECT DEVICE!:
sudo dd if=ubuntu-22.04-preinstalled-server-arm64+raspi.img of=/dev/sdc bs=4M conv=fsync
...
- The login username is "ubuntu", password is "ubuntu" (it takes a bit until this user can login)
- adduser facet (for e320pi it is e320)
- sudo usermod -a -G sudo facet
- sudo reboot now
Wifi
Update system
Once an internet connection is established (see, e.g., "internet access via gateway computer"):
- sudo apt-get update
- sudo apt-get upgrade
In case there are issues with "hold back" packages:
sudo apt-get --with-new-pkgs upgrade
In case there are issues with unattended-upgr:
- get process id with "ps -e | grep unat
- sudo kill -9 "PID"
Setup name resolution
- nano /etc/systemd/resolved.conf
[Resolve] - DNS=1.1.1.1 8.8.8.8
- service systemd-resolved restart
- systemd-resolve --status
Change hostname
hostnamectl set-hostname new-hostname
Enable ssh
- sudo apt install ssh
- sudo systemctl enable --now ssh
- sudo systemctl status ssh
Configure firewall
- sudo ufw default deny incoming
- sudo ufw default allow outgoing
- sudo ufw allow ssh
- sudo ufw enable
Test
Connect the pi with a crossover cable to an ethernet adapter on a "gateway computer"
Install DHCP server on gateway computer:
- https://ubuntu.com/server/docs/how-to-install-and-configure-isc-dhcp-server
- Change the configuration files as instructed; use this:
subnet 192.168.110.0 netmask 255.255.255.0 {
range 192.168.110.200 192.168.110.250;
}
- Check: sudo systemctl status isc-dhcp-server.service
- ssh e320@172.25.77.100: connection should be possible
sysctl -w net.ipv4.ip_forward=1
Old notes
Connect pi with, e.g., USB3-Ethernet adapter to laptop via cross-over cable or network switch. On the pi:
- ip a (to list network interfaces)
- sudo ip addr add 192.168.0.8/255.255.255.0 dev eth0 (with correct device name for above)
On the gateway computer:
- Install DHCP server
- ip a
- sudo ip addr add 192.168.0.42/255.255.255.0 dev enx00e04c680dc9 (with correct device name for above)
Mutual ping on both devices: ping 192.168.0.42 / ping 192.268.0.8
On the pi:
- Add route: sudo ip route add default via 192.168.0.42
- nano /etc/systemd/resolved.conf
under "[Resolve]" make sure it reads:
DNS=1.1.1.1 8.8.8.8 service systemd-resolved restart
On the gateway computer:
- Use iptable to do the forwarding:sudo iptables -A FORWARD -o wlo1 -i enx00e04c680dc9 -s 192.168.0.0/255.255.255.0 -m conntrack --ctstate NEW -j ACCEPT (wlo1 is the network interface with internet access)
sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -t nat -F POSTROUTING
sudo iptables -t nat -A POSTROUTING -o wlo1 -j MASQUERADE - Connect wifi adapter
- list network interfaces: