Installing NetAlertX on a Raspberry Pi

Installing NetAlertX on a Raspberry Pi is very straightforward and well documented on various sites across the internet. I followed instructions from one these and all appeared fine until I performed an upgrade and lost all my settings. Reading through the official NetAlertX documentation a little more closely however provided the solution. The fix however is simple so read on……

NetAlertX is a network and security scanner for the Raspberry Pi originally developed by Pucherot under the name PiAlert. Both of these packages are available on github but PiAlert is no longer maintained. I would recommend using NetAlertX as this is actively maintained by jokob-sk. To install NetAlertX I would recommend using the docker container instructions here

Ensure your Raspberry Pi is up-to-date

1. Ensure your Raspberry pi is up to date

sudo apt update
sudo apt upgrade -y

Install docker

2. Follow the instructions here to install docker

Create your docker compose file

3. Create a directory to store the Docker compose file. I used the structure proposed by pimylifeup

sudo mkdir -p /opt/stacks/pialert

4. Change into the directory you just created

cd /opt/stacks/pialert

5. Create the Docker compose file

version: "3"
services:
  pialert:
    container_name: pialert
    image: "jokobsk/pi.alert:latest"
    network_mode: "host"
    restart: unless-stopped
    volumes:
      - ./data/config:/app/config
      - ./data/db:/app/db
      - ./data/logs:/app/front/log
    environment:
      - TZ=GB
      - PORT=20211

Make sure to set TZ=GB to your correct timezone using the timezones defined here

Make sure to set the volumes as in the code above. Doing this will ensure your config, database and log files are written into the config, db and log directories. Without this you risk losing your existing config and data files when upgrading NetAlertX from the GUI as I unfortunately found out.

Start NetAlertX

8. Start your NetAlertX docker container by typing the following on the command line within the same directory as your docker-compose.yml file

docker compose up -d

Configure NetAlertX

9. Go to the NetAlertX dashboard page from your web browser using the ip address of the Raspberry Pi it is running on and the port number you have selected. In the above compose.yaml we used port 20211

http://<ip address>:20211

10. From within the NetAlertX dashboard you can configure NetAlertX for your network. Be sure to got to Settings | Core | General |SCAN_SUBNETS to add your own subnet and netmask

Updating NetlertX

Running NetAlertX as a docker container makes it very easy to update

Simply go to the directory containing your docker compose file. In my case this is /opt/stacks/pialert (becasue I originally started out with pialert and migrated to NetlertX)

cd /opt/stacks/pialert

Then pull the new version

docker compose pull

Then let docker restart it with the new image

docker compose up -d

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top