To setup the Pi to act as a host, made sure you have these:
-
Pi: Purchase it via raspberrypi.com.
-
Case: A case is not required, but it is recommended. Some cases come with heat sink to help keep your Pi a little cooler.
-
Power supply: A micro USB power supply with at least 2.5A at 5v of power. Some cell phone chargers are compatible. You may have one already.
-
SD Card: You need a 32GB or larger micro SD card. MMS messages need a place to store the media file. More messages, more storage needed. Recommend a Kingston or SanDIsk. You may already have one.
-
Adapter: Make sure your desktop/laptop computer has a SD card reader/writer. If not, you can purchase a USB to Micro SD adapter for about $10.
-
Download and Install: The Raspberry Pi Imager software. It will write the Ubuntu server software to the SD card. Get it from from raspberrypi.com/software.
Follow these steps to install Ubuntu:
-
Insert the SD card into your laptop/desktop reader or adapter.
-
Open the Raspberry Pi Imager application.
-
Select your device as the Raspberry Pi Zero 2 W.
-
Select the OS, under "Other General-purpose OS", select the Ubuntu Server for ARM64 and latest LTS version.
-
Select the storage device as the SD card you inserted in step 1.
-
Select Customization and enter the following:
-
A host name, i.e. "raspi02w"
-
Localization for timezone and keyboard type (despite no keyboard!)
-
User name and password for logon
-
Enter Wifi SSID and password. It needs to be a for a 2.4GHz network. If unsure, logon to your router to confirm. Look for the wireless or Wifi settings section.
-
Enable SSH and use password authentication.
-
-
Write the image to the SD card
-
Once done, remove the SD card from laptop/desktop and insert into the Raspberry Pi.
-
Power on the Raspberry Pi.
-
Logon to your local router and check for current IP addresses. It may be under DHCP or current clients or other.
-
Look for the "raspi02w" name and note the IP address.
-
Open your favorite SSH client and connect to the raspi02w IP address.
-
Logon using the ID and password set in step 6.3.
-
Need some updates:
sudo apt update && sudo apt upgrade -
Need some power management software:
sudo apt install iw
-
To disable power management, type this command:
sudo iw wlan0 set power_save off -
We'll schedule power save off at each reboot:
sudo crontab -e
-
If asked about editor, select "nano". Paste the following at the bottom:
@reboot /usr/sbin/iw wlan0 set power_save off > /tmp/power_save_log.txt 2>&1
-
To save, press ctrl-s. To exit, press ctrl-x.
-
Setup swap space using these commands:
sudo fallocate -l 256M /swap.img sudo chmod 600 /swap.img sudo mkswap /swap.img sudo swapon /swap.img
-
To re-enable after next reboot:
sudo nano /etc/fstab
-
Paste the following at the bottom of the file:
/swap.img swap swap defaults 0 0
-
Save and exit
-
Adjust the Swappiness value lower so as to not use the swap file unless needed. Ubuntu default is 60. We'll set it to 30:
sudo sysctl vm.swappiness=30
-
To make sure it remembers after reboot, open sysctl.conf:
sudo nano /etc/sysctl.conf
-
Paste this line at the bottom:
vm.swappiness=30
-
Save and exit
-
Reboot and confirm everything is set:
sudo shutdown --reboot now
-
After a minute or two, reconnect via SSH and logon.
-
Type these commands to confirm settings:
iw wlan0 get power_save free -h cat /proc/sys/vm/swappiness
-
If it looks good, you are all set!