Log inSign up

PocketBase as a lightweight backend service

Download the Linux zip from the PocketBase releases page, unpack the pocketbase binary into /opt/pocketbase, run pocketbase serve --http=127.0.0.1:8090 from a systemd unit under its own user, and put Nginx with a Certbot certificate in front. The admin dashboard then lives at https://pb.example.net/_/, backed by one SQLite database in pb_data.

Topic: Self-hosted apps · Tested on: Ubuntu 24.04 and 22.04, Debian 12 and 13, Rocky Linux 9, AlmaLinux 9 · Updated 2026-12-03

Why is PocketBase so light to host?

PocketBase is one Go executable that bundles an embedded SQLite database, auth, file storage, realtime subscriptions and an admin UI. There is no separate database server or runtime to install, so even the smallest plan with 1 GB of RAM handles a typical app. Disk speed matters more than CPU count, which makes NVMe plans a good fit.

You need Ubuntu 24.04/22.04, Debian 12/13, Rocky Linux 9 or AlmaLinux 9, a sudo user (see first SSH session) and a hostname like pb.example.net pointing to 198.51.100.24.

How do you download and unpack the binary?

Look up the latest version number on the PocketBase GitHub releases page, then fetch the matching linux_amd64 zip.

sudo apt install -y unzip curl        # Ubuntu, Debian
sudo dnf install -y unzip curl        # Rocky, Alma
PB_VERSION=0.xx.y                     # replace with the current release
cd /tmp
curl -fsSLO https://github.com/pocketbase/pocketbase/releases/download/v$PB_VERSION/pocketbase_${PB_VERSION}_linux_amd64.zip
sudo useradd --system --home /opt/pocketbase --shell /usr/sbin/nologin pocketbase
sudo mkdir -p /opt/pocketbase
sudo unzip -o pocketbase_${PB_VERSION}_linux_amd64.zip pocketbase -d /opt/pocketbase
sudo chown -R pocketbase:pocketbase /opt/pocketbase
/opt/pocketbase/pocketbase --version

The data folder pb_data is created next to the binary on first start, which keeps everything for this app under one directory.

How do you run PocketBase as a systemd service?

A unit file keeps it running across reboots and crashes. Create /etc/systemd/system/pocketbase.service:

[Unit]
Description=PocketBase
After=network.target

[Service]
Type=simple
User=pocketbase
Group=pocketbase
WorkingDirectory=/opt/pocketbase
ExecStart=/opt/pocketbase/pocketbase serve --http=127.0.0.1:8090
Restart=always
RestartSec=5s
LimitNOFILE=4096

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now pocketbase
systemctl status pocketbase --no-pager
curl -s http://127.0.0.1:8090/api/health

The health endpoint answers with a short JSON message when the server is up. Listening on 127.0.0.1 keeps the raw port private; more about unit files is in systemd services.

How do you create the first superuser?

On its first start PocketBase prints a one-time installer link in the log; you can open it through an SSH tunnel, but the command line is quicker:

sudo -u pocketbase /opt/pocketbase/pocketbase superuser upsert admin@example.net 'a-long-random-password'

Run it from any directory: the binary finds pb_data beside itself. The same command resets the password later if you lose it. Sign in at /_/ once HTTPS is ready.

How do you configure Nginx for PocketBase?

Realtime subscriptions use server-sent events, which need buffering off and a long read timeout. Install Nginx and Certbot (apt install nginx certbot python3-certbot-nginx, or the same names through dnf after epel-release), then create /etc/nginx/conf.d/pocketbase.conf:

server {
    listen 80;
    listen [::]:80;
    server_name pb.example.net;
    client_max_body_size 20M;
    location / {
        proxy_pass http://127.0.0.1:8090;
        proxy_http_version 1.1;
        proxy_set_header Connection '';
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_buffering off;
        proxy_read_timeout 360s;
    }
}
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d pb.example.net

Rocky and Alma also need sudo setsebool -P httpd_can_network_connect 1. Allow web traffic with sudo ufw allow 'Nginx Full' on Ubuntu and Debian, or firewall-cmd --permanent --add-service=http --add-service=https and a reload on Rocky and Alma. In the dashboard, under Settings, set the trusted proxy header to X-Real-IP so rate limits and logs see real client addresses.

How does PocketBase send verification and reset emails?

Out of the box it tries the local sendmail binary, which usually is not what you want on a VPS. Open Settings, Mail settings, enable SMTP and enter an authenticated relay: host, port 587, TLS, username and password, plus the sender name and address. Send a test email from the same page.

Direct sending on port 25 is not something to plan around; ask support with a ticket first. The SMTP relay guide shows how to configure SPF and DKIM for the sender domain.

How do you back up PocketBase data?

Everything sits in /opt/pocketbase/pb_data: the SQLite files and uploaded files. Copying the folder while the server writes to it can produce an inconsistent database, so use the built-in backups. Under Settings, Backups, create a backup now or set a cron expression such as 0 3 * * * for a nightly zip. The archives appear in pb_data/backups; copy them off the server with rsync or rclone.

sudo ls -lh /opt/pocketbase/pb_data/backups

How do you update to a newer PocketBase release?

The prebuilt binary can update itself. It downloads the newest release, keeps a backup of the old executable and data, and exits so systemd can restart it.

sudo -u pocketbase /opt/pocketbase/pocketbase update
sudo systemctl restart pocketbase
/opt/pocketbase/pocketbase --version

PocketBase is still before version 1.0, so read the changelog: some releases change the Go or JavaScript hook APIs. If you extend PocketBase with your own Go code, rebuild against the new module version instead of using the update command.

What if realtime events never arrive in the browser?

Check that proxy_buffering off is present and that Connection is an empty string; buffering holds the event stream until the connection closes. Run journalctl -u pocketbase -f while you subscribe from the client to see the request. A 413 status during uploads means client_max_body_size is smaller than the file.

Plans that fit this guide

Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.

All prices
PlanFits becauseSizeMonthlyOrder from
A1-1a small app or prototype1 vCPU, 1 GB RAM, 25 GB NVMe$3.60/mo$43.20 for 12 months
A1-2more users and file uploads1 vCPU, 2 GB RAM, 50 GB NVMe$7.20/mo$43.20 for 6 months

Questions about PocketBase backend

Can PocketBase get its own certificate without Nginx?

Yes. pocketbase serve pb.example.net binds ports 80 and 443 and obtains a certificate automatically. Nginx is shown here because it lets other sites share the server.

Is SQLite a limit for production?

For many small and medium apps it is not; PocketBase uses WAL mode and handles many reads at once. Very write-heavy workloads or several app servers sharing one database are better served by a client-server database.

Can I add custom server code?

Yes, with JavaScript hooks in a pb_hooks folder next to the binary, or by using PocketBase as a Go library and compiling your own binary.

Where are uploaded files stored?

In pb_data/storage by default. An S3-compatible remote can be configured in the settings if you have one.

How do I run two PocketBase apps on one server?

Give each its own folder, user, systemd unit and loopback port (8090, 8091), plus one Nginx server block per hostname.