Install basic utilities:
sudo apt net-tools
sudo apt install htop
sudo apt install -y zenity
Update repo and install docker
sudo apt update
sudo apt install -y docker.io
Enable the darker service And verify that the version was installed
sudo systemctl enable --now docker
docker –version
systemctl status docker
Install docker compose
sudo apt install -y docker-compose-plugin
Create the proper folder structure for frigate and moving to the folder
mkdir -p /opt/frigate/config /opt/frigate/media
cd /opt/frigate
To ccheck diversion for both run
docker --version
docker compose version
Configuration files:
cd /opt/frigate
sudo nano /opt/frigate/docker-compose.yml
Copy this into the docker compose file exactly
services:
frigate:
container_name: frigate
image: ghcr.io/blakeblackshear/frigate:stable
restart: unless-stopped
privileged: true
shm_size: "512m"
volumes:
- ./config:/config
- ./media:/media/frigate
ports:
- "5000:5000"
sudo nano /opt/frigate/config/config.yml
mqtt:
enabled: false
detectors:
cpu1:
type: cpu
cameras:
test_camera:
ffmpeg:
inputs:
- path: "rtsp://admin:password@192.168.1.100:554/stream"
roles:
- detect
- record
detect:
width: 1280
height: 720
fps: 5
record:
enabled: true
retain:
days: 7
snapshots:
enabled: true
Automated camera add/remove script
nano /opt/frigate/scripts/camera-wizard-v2.sh
#!/bin/bash
CONFIG="/opt/frigate/config/config.yml"
# Ensure config file exists
mkdir -p /opt/frigate/config
if [ ! -f "$CONFIG" ]; then
cat <<EOF > "$CONFIG"
mqtt:
enabled: false
detectors:
cpu1:
type: cpu
cameras:
EOF
fi
add_camera() {
CAM_NAME=$(zenity --entry --title="Frigate Setup" --text="Camera Name")
# Prevent duplicate camera names
if grep -q "^ $CAM_NAME:" "$CONFIG"; then
zenity --error --text="Camera name already exists!"
return
fi
CAM_IP=$(zenity --entry --title="Frigate Setup" --text="Camera IP Address")
CAM_USER=$(zenity --entry --title="Frigate Setup" --text="Username")
CAM_PASS=$(zenity --password --title="Frigate Setup" --text="Password")
CAM_PATH=$(zenity --entry --title="Frigate Setup" --text="RTSP Path (default /stream)" --entry-text="/stream")
# Basic validation
if [[ -z "$CAM_IP" || -z "$CAM_USER" || -z "$CAM_PASS" ]]; then
zenity --error --text="Missing required fields"
return
fi
RTSP="rtsp://$CAM_USER:$CAM_PASS@$CAM_IP:554$CAM_PATH"
# Append safely
cat <<EOF >> "$CONFIG"
$CAM_NAME:
ffmpeg:
inputs:
- path: "$RTSP"
roles:
- detect
- record
detect:
width: 1280
height: 720
fps: 5
record:
enabled: true
retain:
days: 7
snapshots:
enabled: true
EOF
zenity --info --text="Camera '$CAM_NAME' added successfully"
}
restart_frigate() {
cd /opt/frigate
docker compose restart
if [ $? -eq 0 ]; then
zenity --info --text="Frigate restarted successfully"
else
zenity --error --text="Frigate restart failed - check logs"
fi
}
while true
do
CHOICE=$(zenity --list \
--title="Frigate Camera Wizard v2" \
--column="Action" \
"Add Camera" \
"Restart Frigate" \
"Exit")
case $CHOICE in
"Add Camera") add_camera ;;
"Restart Frigate") restart_frigate ;;
"Exit"|"") break ;;
esac
done
chmod +x /opt/frigate/scripts/camera-wizard.sh