Repository

Looks good to me!

User Tools

Site Tools


topic:linux:ported:pi2

# Header Your content here

Measure temperature natively on Ubuntu: `paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp) | column -s $'\t' -t | sed 's/\(.\)..$/.\1°C/'`

Should give you something like: `cpu-thermal 67.6°C`

IP address on WAN: `192.168.1.191` User: `ubuntu`

Motivation: - QNAP security notification, but unable to update firmware, probably from all the fiddling. - Exposing HTTP port can be dangerous.

Prerequisites: - Raspberry Pi Model 4B - Card reader + SD card - Male micro-HDMI to female HDMI adapter - HDMI cable

---

# Installing Ubuntu on Raspberry Pi

Using Raspberry Pi Imager to install Ubuntu Server 20.04 LTS. This is a required read for setup instructions:

https://ubuntu.com/tutorials/how-to-install-ubuntu-on-your-raspberry-pi

In particular, need to set Wi-Fi credentials in `(system-boot)/network-config`:

``` wifis:

wlan0:
  dhcp4: true
  optional: true
  access-points:
    <wifi network name>:
      password: "<wifi password>"

```

Not really working for me, but you can still connect an Ethernet cable and access it remotely.

Useful things you should already know:

``` screen # multiple windows Ctrl-A + Esc # enter copy mode for scrolling ```

Useful server information commands, from: https://opensource.com/article/20/12/linux-server

``` uptime # server uptime and current users who # current users grep sh$ /etc/passwd # who can access, regex grep lscpu # list CPU, alt "cat /proc/cpuinfo" lsmem # list memory, alt "cat /proc/meminfo" lshw # list hardware attached ps -f # snapshot of current processes, -e for all processes lsof # list open files iptables -L # iptable forwarding ss -tupan # sockets, replace netstat dmesg # device logs journalctl | tail # view systemd journal ```

Stuff to install on Pi:

``` net-tools # ifconfig ```

Package management:

``` sudo apt update && sudo apt upgrade -y ```

Useful starting:

https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-20-04 https://www.howtogeek.com/177621/the-beginners-guide-to-iptables-the-linux-firewall/

``` adduser <username> usermod -aG sudo <username> ```

Firewall, start with UFW to understand what rules need to be done, then manage using the more low-level iptables:

``` ufw allow OpenSSH sudo ufw allow from 192.168.0.0/16 to any port 22 sudo ufw allow from 10.8.0.0/16 to any port 22 sudo ufw allow 443 sudo ufw allow 80 ufw enable ufw status # see rules ufw allow ```

topic/linux/ported/pi2.txt · Last modified: 24 months ago ( 2 May 2023) by 127.0.0.1