PeerTube is a federated (ActivityPub) video hosting platform. It has more moving parts than Owncast or MediaMTX — PostgreSQL, Redis, and optionally an SMTP relay — so the officially recommended path is Docker Compose, which is what this guide uses.
Assumptions: Ubuntu 22.04/24.04 VPS with at least 2 vCPU / 4GB RAM (PeerTube + transcoding is memory- and CPU-hungry — check your RamNode plan's specs before proceeding), root/sudo access, and a domain (e.g. videos.example.com) pointed at the VPS.
1. Initial server prep
sudo apt update && sudo apt upgrade -y
sudo apt install -y curl wget ufw nginx certbot python3-certbot-nginx apt-transport-https ca-certificates gnupg2. Install Docker and Docker Compose
curl -fsSL https://get.docker.com | sudo sh
sudo usermod -aG docker $USER
newgrp dockerVerify:
docker --version
docker compose version3. Configure the firewall
sudo ufw allow OpenSSH
sudo ufw allow 'Nginx Full'
sudo ufw enablePeerTube's own container ports stay bound to 127.0.0.1 and are reached only through Nginx, so no extra ports need opening (RTMP live streaming, if enabled, uses 1935 — add it if you plan to use PeerTube's live feature: sudo ufw allow 1935/tcp).
4. Set up the PeerTube directory and Compose files
sudo mkdir -p /var/www/peertube
sudo chown $USER:$USER /var/www/peertube
cd /var/www/peertube
curl https://raw.githubusercontent.com/Chocobozzz/PeerTube/develop/support/docker/production/docker-compose.yml -o docker-compose.yml
curl https://raw.githubusercontent.com/Chocobozzz/PeerTube/develop/support/docker/production/.env -o .env5. Configure the .env file
nano .envSet at minimum:
PEERTUBE_HOSTNAME=videos.example.com
PEERTUBE_ADMIN_EMAIL=you@example.com
POSTGRES_USER=peertube
POSTGRES_PASSWORD=CHANGE_ME_TO_A_LONG_RANDOM_STRING
POSTGRES_DB=peertube
# SMTP - required for account confirmation / notifications
PEERTUBE_SMTP_HOSTNAME=smtp.yourprovider.com
PEERTUBE_SMTP_PORT=587
PEERTUBE_SMTP_USERNAME=you@example.com
PEERTUBE_SMTP_PASSWORD=your-smtp-password
PEERTUBE_SMTP_FROM=you@example.comGenerate a strong Postgres password:
openssl rand -hex 246. Start the stack
docker compose up -dThis pulls and starts three containers: peertube, postgres, and redis. First startup runs database migrations and can take a couple of minutes.
docker compose logs -f peertubeWait until you see it listening on port 9000 internally before moving on.
7. Reverse proxy with Nginx + TLS
PeerTube publishes an official Nginx template. Grab it:
sudo curl https://raw.githubusercontent.com/Chocobozzz/PeerTube/develop/support/nginx/peertube -o /etc/nginx/sites-available/peertubeEdit it and replace the server_name and webserver_host placeholders with videos.example.com, and confirm it proxies to 127.0.0.1:9000 (PeerTube's default internal port):
sudo nano /etc/nginx/sites-available/peertubeEnable it and issue a cert:
sudo ln -s /etc/nginx/sites-available/peertube /etc/nginx/sites-enabled/peertube
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d videos.example.comThe official template already includes the large client_max_body_size and long timeout values needed for big video uploads — don't shrink them.
8. Create your admin account
The root user's password is generated on first boot. Retrieve it:
docker compose logs peertube | grep -A1 "username"Log in at https://videos.example.com/login, then immediately change the password in Account Settings.
9. Post-install configuration
In the admin panel (/admin/config):
- Set instance name, description, terms
- Configure Transcoding — enable only the resolutions your VPS's CPU can realistically handle; PeerTube transcoding is the single biggest resource consumer
- Configure storage quotas per user
- If federating, review the federation/moderation settings before opening registrations
10. Ongoing maintenance
- Update:
cd /var/www/peertube && docker compose pull && docker compose up -d - Logs:
docker compose logs -f peertube - Back up: the
./datavolume directory in/var/www/peertube(videos, config) and apg_dumpof the Postgres container - Disk space: video storage grows fast — monitor with
df -hand consider attaching RamNode block storage if you outgrow local disk
Troubleshooting
| Symptom | Check |
|---|---|
| 502 from Nginx | docker compose ps — is the peertube container healthy? docker compose logs peertube |
| Uploads fail partway | client_max_body_size in Nginx config, and disk space |
| Videos stuck "transcoding" | CPU load (htop) — you may have enabled too many resolutions for your vCPU count |
| Can't send confirmation emails | Double check SMTP credentials in .env, then docker compose up -d to reload |
