PeerTube is a decentralized, open-source video hosting platform — letting you run your own YouTube-style video sharing site, optionally federated with other PeerTube instances via ActivityPub.
What Makes PeerTube Different
Unlike a simple self-hosted media server, PeerTube is built for public video publishing and discovery, with support for federation (interacting with other PeerTube instances) and peer-to-peer video delivery to reduce server bandwidth load.
Prerequisites
- Ubuntu 22.04/24.04 VPS: 4 vCPU, 4 GB RAM minimum (more for active transcoding)
- PostgreSQL and Redis
- A domain name
Step 1 — Install PostgreSQL and Redis
See How to Install and Secure Redis on Ubuntu & Debian and the PostgreSQL installation guides in the Databases category.
Step 2 — Create the PeerTube Database
sudo -u postgres createuser -P peertube
sudo -u postgres createdb -O peertube -E UTF8 -T template0 peertube_prod
Step 3 — Install Node.js and Yarn
See How to Install Node.js on Ubuntu & Debian (with NVM).
Step 4 — Create a Dedicated System User
sudo useradd -m -d /var/www/peertube -s /bin/bash peertube
Step 5 — Download and Install PeerTube
sudo su - peertube
wget -q "https://github.com/Chocobozzz/PeerTube/releases/latest/download/peertube-vLATEST.zip"
unzip peertube-*.zip
Step 6 — Configure PeerTube
cp config/production.yaml.example config/production.yaml
nano config/production.yaml
Set your domain, database credentials, and Redis connection details.
Step 7 — Set Up as a systemd Service
sudo cp /var/www/peertube/peertube-latest/support/systemd/peertube.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now peertube
Step 8 — Configure Nginx as a Reverse Proxy
PeerTube provides a sample Nginx configuration in its installation files — adapt it for your specific domain.
Step 9 — Add HTTPS
sudo certbot --nginx -d yourdomain.com
Step 10 — Create Your Administrator Account
cd /var/www/peertube/peertube-latest
NODE_ENV=production NODE_CONFIG_DIR=/var/www/peertube/config node dist/scripts/create-admin.js -u admin
Configuring Video Transcoding
PeerTube automatically transcodes uploaded videos into multiple resolutions for adaptive playback — this is CPU-intensive; see How to Set Up a Video Transcoding Pipeline with FFmpeg for the underlying process PeerTube automates.
Federation with Other Instances
Under admin settings, you can follow other PeerTube instances, letting their content appear in your instance's federated timeline, and allow other instances to follow yours — entirely optional, and can be disabled for a fully standalone instance.
Storage Planning
Video hosting requires substantial storage that grows with every upload — consider object storage integration (PeerTube supports S3-compatible storage) for scalable, decoupled video storage rather than relying solely on local VPS disk.
Common Errors
Uploads fail or time out — check Nginx's client_max_body_size and proxy timeout settings, which often need increasing well beyond defaults for video upload workflows.
Continue Reading
- How to Set Up a Video Transcoding Pipeline with FFmpeg
- How to Set Up Self-Hosted S3-Compatible Object Storage with MinIO
- VPS Requirements for Media Streaming Servers
Browse more articles in Media & Streaming Servers.