Pi4 with Raspbian Bullseye: Difference between revisions
(Initial) |
(Adding) |
||
Line 1: | Line 1: | ||
'''''Work in progress''''' | '''''Work in progress''''' | ||
== Introduction == | |||
The Raspberry Pi is excellent in the role of RMS station. It has just enough processing power with proper external connections. The task of RMS station can be combined with other tasks, as long as they are not too heavy. Possible examples: | The Raspberry Pi is excellent in the role of RMS station. It has just enough processing power with proper external connections. The task of RMS station can be combined with other tasks, as long as they are not too heavy. Possible examples: | ||
* ADSB receiver | |||
* NTP server | |||
[[File:Pi4 cpu usage.png]] | |||
Memory usage, on average, stays below 1GB so any model would suffice. If your have more memory you could do without a swap partition. This is especially useful if the station uses a flash card as storage. The RMS station task causes a lot of read/write actions. The best way would be to add an external USB3 disk. Any disk would do. External power for the disk should not be necessary, as long as relatively small SSD disks are used. | Memory usage, on average, stays below 1GB so any model would suffice. If your have more memory you could do without a swap partition. This is especially useful if the station uses a flash card as storage. The RMS station task causes a lot of read/write actions. The best way would be to add an external USB3 disk. Any disk would do. External power for the disk should not be necessary, as long as relatively small SSD disks are used. | ||
[[File:Pi4 memory usage.png]] | |||
If you decide to add an SSD disk to the Raspberry, see these instructions to boot from SSD by default. [https://www.tomshardware.com/how-to/boot-raspberry-pi-4-usb] | If you decide to add an SSD disk to the Raspberry, see these instructions to boot from SSD by default. [https://www.tomshardware.com/how-to/boot-raspberry-pi-4-usb] | ||
Line 12: | Line 18: | ||
This howto assumes you are logged into the Pi with SSH (secure shell). You can also connect monitor and keyboard or use VNC to connect to the Raspberry (enable VNC using raspi-config). | This howto assumes you are logged into the Pi with SSH (secure shell). You can also connect monitor and keyboard or use VNC to connect to the Raspberry (enable VNC using raspi-config). | ||
== Connecting to the network == | |||
There are several option to setup networking connections. The best way would be to connect the camera and the Raspberry to a switch. If you have no wired network available you could connect the camera to the Raspberry directy and then connect the Raspberry to the main network over Wifi. | |||
=== If you want to connect the camera to your Pi directly === | |||
If you want to do this you have to setup a DHCP service on the Raspberry. You can find the proper way to configure the camera in the manual to build one. Make sure to use and address range different from your main network. | |||
''(Note: These instructions were copied over from the original manual)'' | |||
1. First, install the DHCP server: | |||
sudo apt-get install -y isc-dhcp-server | |||
2. Edit the DHCP configuration file: | |||
sudo nano /etc/dhcp/dhcpd.conf | |||
We need to add a fixed address for the camera, so append this at the end of the file: | |||
subnet 192.168.42.0 netmask 255.255.255.0 { | |||
authoritative; | |||
pool { | |||
range 192.168.42.10 192.168.42.10; | |||
} | |||
option broadcast-address 192.168.42.255; | |||
default-lease-time 600; | |||
max-lease-time 7200; | |||
option domain-name "local"; | |||
} | |||
This will assign a fixed IP address 192.168.42.10 to the camera. | |||
3. Edit the DCHP server configuration so it will only listen to the ethernet interface. Open the file: | |||
sudo nano /etc/default/isc-dhcp-server | |||
and edit the line with INTERFACESv4 by adding "eth0": | |||
INTERFACESv4="eth0" | |||
4. Next, we need to give the ethernet interface the proper subnet. Open: | |||
sudo nano /etc/dhcpcd.conf | |||
and add this at the end of the file: | |||
interface eth0 | |||
static ip_address=192.168.42.1/24 | |||
This will give the ethernet interface a static IP address. | |||
5. Finally, the DHCP server will try to run before the ethernet interface is up, which will produce an error. We can tell it to try again, until it is successful. Run the following commands: | |||
sudo cp /run/systemd/generator.late/isc-dhcp-server.service /etc/systemd/system | |||
sudo nano /etc/systemd/system/isc-dhcp-server.service | |||
Edit the [Service] section: | |||
* set ''Restart=on-failure'' | |||
* add ''RestartSec=5'' to instruct systemd to wait 5 seconds before restarting a failed service. | |||
Add the [Install] section which is missing, and add the follow line to it: | |||
WantedBy=multi-user.target | |||
Run the commands: | |||
sudo systemctl daemon-reload | |||
sudo systemctl disable isc-dhcp-server | |||
sudo systemctl enable isc-dhcp-server | |||
6. Reboot so to test the configuration: | |||
sudo reboot | |||
Make sure the camera is connected to the Pi’s ethernet interface, and that a fixed IP address of 192.168.42.10 is set on the camera. | |||
7. Now, if you run ''arp -a'', you will be able to see the IP camera: | |||
? (192.168.42.10) at 00:12:16:b6:79:db [ether] on eth0 | |||
If not, check the status of the DHCP server service: | |||
sudo service isc-dhcp-server status | |||
The service should be active. | |||
== Preparation of the Raspberry Pi to run RMS == | |||
If the Raspberry is already running. Check if your filesystem is using the full disk. To do this log in to the Pi and run the command: | |||
df -h | |||
The size of ''/dev/root'' should be near your disk size. If it is not, you still need to expand the filesystem. Use raspi-config for this task. | |||
sudo raspi-config | |||
- ''Choose “Advanced Options” (6) and then “Expand Filesystem” (A1)'' | |||
While you are in raspi-config also set GPU memory to 256 | |||
- ''Choose “Performance options” (4) and then “GPU Memory” (P2)'' | |||
And set the timezone to UTC | |||
- ''Choose “Localisation options” (5) and then “None of the above” and then “UTC”'' | |||
Save your settings and exit raspi-config without rebooting the Pi | |||
If your Raspberry has 2GB of memory or less, you can enable swap by editing (''sudo nano /etc/dphys-swapfile'') the file ''/etc/dphys-swapfile'' and set | |||
CONF_SWAPSIZE=1024 | |||
Save the file and do: | |||
service dphys-swapfile restart | |||
Reboot the pi | |||
sudo shutdown -r now | |||
== Create user accounts == | |||
After reboot, login as user ''pi'' and create an account to run RMS and an account for yourself. You could also use the ''pi'' account, but using non-default usernames is a best (security) practise. | |||
sudo useradd -m [your name] -g pi -G adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,input,render,netdev,spi,i2c,gpio,lpadmin | |||
sudo passwd [yourname] | |||
sudo echo [yourname] ALL=(ALL) NOPASSWD: ALL | |||
sudo useradd -m rms | |||
sudo passwd -l rms | |||
Now you have an account on your name equal to the ''pi'' account and a locked ''rms'' account. we don’t need interactive logon for ''rms'' so blocking it is a wise thing to do. | |||
Now log out of the Pi and login under your own account. Then do: | |||
sudo passwd -l pi | |||
By default the ''/tmp'' directory is used for temporary file storage. This directory is located in the working memory of the Pi and not on disk. As such, there is not enough space available in this directory to do the installation. So we need to use another location. | |||
Become user ''rms'' and use another directory for temporary file storage: | |||
sudo su - rms | |||
mkdir tmp | |||
echo export TMP=/home/rms/tmp >> .profile | |||
echo export TEMP=/home/rms/tmp >> .profile | |||
exit |
Revision as of 10:20, 20 January 2023
Work in progress
Introduction
The Raspberry Pi is excellent in the role of RMS station. It has just enough processing power with proper external connections. The task of RMS station can be combined with other tasks, as long as they are not too heavy. Possible examples:
- ADSB receiver
- NTP server
Memory usage, on average, stays below 1GB so any model would suffice. If your have more memory you could do without a swap partition. This is especially useful if the station uses a flash card as storage. The RMS station task causes a lot of read/write actions. The best way would be to add an external USB3 disk. Any disk would do. External power for the disk should not be necessary, as long as relatively small SSD disks are used.
If you decide to add an SSD disk to the Raspberry, see these instructions to boot from SSD by default. [1]
The easiest way to run an RMS station is by using the standard RMS image. If you want to have more control, because the Pi will be doing other things as well, or want to have more control over versions used you can build your own. With the latest version of Raspbian, this is not a hard task. You can start by flashing either the default or the lite version of Raspbian Bullseye to your flash card or USB disk.
This howto assumes you are logged into the Pi with SSH (secure shell). You can also connect monitor and keyboard or use VNC to connect to the Raspberry (enable VNC using raspi-config).
Connecting to the network
There are several option to setup networking connections. The best way would be to connect the camera and the Raspberry to a switch. If you have no wired network available you could connect the camera to the Raspberry directy and then connect the Raspberry to the main network over Wifi.
If you want to connect the camera to your Pi directly
If you want to do this you have to setup a DHCP service on the Raspberry. You can find the proper way to configure the camera in the manual to build one. Make sure to use and address range different from your main network. (Note: These instructions were copied over from the original manual)
1. First, install the DHCP server:
sudo apt-get install -y isc-dhcp-server
2. Edit the DHCP configuration file:
sudo nano /etc/dhcp/dhcpd.conf
We need to add a fixed address for the camera, so append this at the end of the file:
subnet 192.168.42.0 netmask 255.255.255.0 { authoritative; pool { range 192.168.42.10 192.168.42.10; } option broadcast-address 192.168.42.255; default-lease-time 600; max-lease-time 7200; option domain-name "local"; }
This will assign a fixed IP address 192.168.42.10 to the camera.
3. Edit the DCHP server configuration so it will only listen to the ethernet interface. Open the file:
sudo nano /etc/default/isc-dhcp-server
and edit the line with INTERFACESv4 by adding "eth0":
INTERFACESv4="eth0"
4. Next, we need to give the ethernet interface the proper subnet. Open:
sudo nano /etc/dhcpcd.conf
and add this at the end of the file:
interface eth0 static ip_address=192.168.42.1/24
This will give the ethernet interface a static IP address.
5. Finally, the DHCP server will try to run before the ethernet interface is up, which will produce an error. We can tell it to try again, until it is successful. Run the following commands:
sudo cp /run/systemd/generator.late/isc-dhcp-server.service /etc/systemd/system sudo nano /etc/systemd/system/isc-dhcp-server.service
Edit the [Service] section:
- set Restart=on-failure
- add RestartSec=5 to instruct systemd to wait 5 seconds before restarting a failed service.
Add the [Install] section which is missing, and add the follow line to it:
WantedBy=multi-user.target
Run the commands:
sudo systemctl daemon-reload sudo systemctl disable isc-dhcp-server sudo systemctl enable isc-dhcp-server
6. Reboot so to test the configuration:
sudo reboot
Make sure the camera is connected to the Pi’s ethernet interface, and that a fixed IP address of 192.168.42.10 is set on the camera.
7. Now, if you run arp -a, you will be able to see the IP camera: ? (192.168.42.10) at 00:12:16:b6:79:db [ether] on eth0 If not, check the status of the DHCP server service:
sudo service isc-dhcp-server status
The service should be active.
Preparation of the Raspberry Pi to run RMS
If the Raspberry is already running. Check if your filesystem is using the full disk. To do this log in to the Pi and run the command:
df -h
The size of /dev/root should be near your disk size. If it is not, you still need to expand the filesystem. Use raspi-config for this task.
sudo raspi-config
- Choose “Advanced Options” (6) and then “Expand Filesystem” (A1)
While you are in raspi-config also set GPU memory to 256
- Choose “Performance options” (4) and then “GPU Memory” (P2)
And set the timezone to UTC
- Choose “Localisation options” (5) and then “None of the above” and then “UTC”
Save your settings and exit raspi-config without rebooting the Pi
If your Raspberry has 2GB of memory or less, you can enable swap by editing (sudo nano /etc/dphys-swapfile) the file /etc/dphys-swapfile and set
CONF_SWAPSIZE=1024
Save the file and do:
service dphys-swapfile restart
Reboot the pi
sudo shutdown -r now
Create user accounts
After reboot, login as user pi and create an account to run RMS and an account for yourself. You could also use the pi account, but using non-default usernames is a best (security) practise.
sudo useradd -m [your name] -g pi -G adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,input,render,netdev,spi,i2c,gpio,lpadmin sudo passwd [yourname] sudo echo [yourname] ALL=(ALL) NOPASSWD: ALL sudo useradd -m rms sudo passwd -l rms
Now you have an account on your name equal to the pi account and a locked rms account. we don’t need interactive logon for rms so blocking it is a wise thing to do.
Now log out of the Pi and login under your own account. Then do:
sudo passwd -l pi
By default the /tmp directory is used for temporary file storage. This directory is located in the working memory of the Pi and not on disk. As such, there is not enough space available in this directory to do the installation. So we need to use another location.
Become user rms and use another directory for temporary file storage:
sudo su - rms mkdir tmp echo export TMP=/home/rms/tmp >> .profile echo export TEMP=/home/rms/tmp >> .profile exit