LIVEReading: Run Your Own Ad-Free Video Platform with PeerTubeTotal time: 18 minSteps: 6Worked first time: 45% LIVEReading: Run Your Own Ad-Free Video Platform with PeerTubeTotal time: 18 minSteps: 6Worked first time: 45%
CBW
Run Your Own Ad-Free Video Platform with PeerTube
Spicygithub.com/chocobozzz/peertube2026-07-06

Run Your Own Ad-Free Video Platform with PeerTube

PeerTube lets you host your own YouTube-style video site that federates with other instances. This guide uses Docker to get it running on your own server.

// Build stats

  • Total time18 min
  • Number of steps6
  • DifficultySpicy
  • Worked first time45%
// Before you start

What you need

  • A Linux server (Ubuntu 22.04 recommended) with at least 2 CPU cores, 2 GB RAM, and 20 GB storage
  • A domain name pointed at your server's IP address (e.g. video.yourdomain.com)
  • Docker and Docker Compose installed on the server
  • Port 80 and 443 open in your server firewall
  • Basic comfort running commands in a terminal via SSH
  • An email address for the admin account and SSL certificate
01
Step 1 of 6

Download the official Docker Compose setup

3 min

PeerTube's team maintains an official Docker Compose file that bundles everything you need: the app, a PostgreSQL database, Redis cache, and an Nginx web server. You will download that file and its companion environment template into a fresh folder on your server.

Terminal · mac
$ mkdir ~/peertube && cd ~/peertube && curl -fsSL https://raw.githubusercontent.com/chocobozzz/peertube/master/support/docker/production/docker-compose.yml -o docker-compose.yml && curl -fsSL https://raw.githubusercontent.com/chocobozzz/peertube/master/.env.example -o .env
What you should see
Two files appear in ~/peertube: docker-compose.yml and .env. No errors printed.
This might happen

curl: command not found

Install curl first: sudo apt-get install -y curl

02
Step 2 of 6

Configure your domain and admin email in .env

5 min

The .env file is a plain text configuration file. You need to set three things: your domain name, your admin email, and a strong secret key. Open the file with nano (a simple text editor), find each line, and replace the placeholder values. The secret key can be any long random string — the command below generates one for you.

Terminal · mac
$ cd ~/peertube && SECRET=$(openssl rand -hex 32) && sed -i "s|PEERTUBE_SECRET=.*|PEERTUBE_SECRET=${SECRET}|" .env && nano .env
What you should see
nano opens the .env file. Look for PEERTUBE_WEBSERVER_HOSTNAME and set it to your domain (e.g. video.yourdomain.com). Set PEERTUBE_ADMIN_EMAIL to your email. PEERTUBE_SECRET is already filled in. Save with Ctrl+O then Enter, exit with Ctrl+X.
This might happen

You forget to change PEERTUBE_WEBSERVER_HOSTNAME and the site loads with a wrong URL or SSL fails

Re-open .env with nano, fix the hostname, then run docker compose down && docker compose up -d to restart

03
Step 3 of 6

Create the required local storage folders

2 min

PeerTube stores uploaded videos, thumbnails, and logs in folders on your server. Docker needs these folders to exist before it starts, otherwise it will throw permission errors. This command creates them all at once and sets the correct ownership.

Terminal · mac
$ mkdir -p ~/peertube/docker-volume/nginx ~/peertube/docker-volume/data ~/peertube/docker-volume/config && sudo chown -R 1000:1000 ~/peertube/docker-volume
What you should see
No output means success. You can verify with: ls ~/peertube/docker-volume
04
Step 4 of 6

Pull images and start PeerTube

10 min

This command downloads all the Docker images (PeerTube app, Postgres, Redis, Nginx) and starts them in the background. The first run takes several minutes because it is downloading roughly 1-2 GB of images. After that, future starts are fast.

Terminal · mac
$ cd ~/peertube && docker compose pull && docker compose up -d
What you should see
You will see lines like 'Pulling peertube ... done' for each service, then 'Creating peertube_peertube_1 ... done'. All containers show as 'Up' when you run: docker compose ps
This might happen

A container shows 'Exit 1' or 'Restarting' in docker compose ps

Check logs with: docker compose logs peertube — the most common cause is a typo in .env (wrong hostname or missing secret). Fix .env and run docker compose up -d again.

05
Step 5 of 6

Retrieve the auto-generated admin password

1 min

On first boot PeerTube creates an admin account and prints a random password to its logs. You need to grab that password now so you can log in to the web interface.

Terminal · mac
$ cd ~/peertube && docker compose logs peertube | grep -A2 'User admin created'
What you should see
A line like: 'User admin created. Password: aBcDeFgH1234...' — copy that password somewhere safe.
This might happen

Nothing is returned by the grep command

The container may still be initializing. Wait 60 seconds and try again. If still empty, run: docker compose logs peertube | grep -i password

06
Step 6 of 6

Log in and complete setup in the web UI

5 min

Open a browser and go to https://video.yourdomain.com (replace with your actual domain). Log in with username 'root' and the password you just copied. PeerTube will walk you through a short setup wizard where you set your instance name, description, and default language. After that your instance is live and ready to upload videos.

Terminal · mac
$ echo 'Open https://YOUR_DOMAIN in your browser and log in as root'
What you should see
You see the PeerTube homepage with your instance name. After logging in as root you are taken to the admin dashboard.
This might happen

Browser shows an SSL certificate error or 'site can't be reached'

DNS may not have propagated yet (can take up to 24 hours). Verify your domain points to the server IP with: nslookup video.yourdomain.com — also confirm ports 80 and 443 are open in your server's firewall.

// Status

cooked. baked. worked.

A fully functional, publicly accessible PeerTube video instance at your domain where you can upload videos, create channels, and federate with other PeerTube and Mastodon instances.

// the honest bit

The honest part

PeerTube is a serious self-hosted application, not a weekend toy. You are responsible for storage costs as your video library grows — video files are large. Transcoding (converting uploaded videos to multiple resolutions) is CPU-intensive and slow on small servers; a $6/month VPS will struggle. Federation with other instances is automatic but your instance needs to be publicly reachable with a valid SSL certificate to participate. Upgrades require pulling new Docker images and occasionally running database migrations. This guide covers a working baseline — production hardening (backups, email delivery, object storage for videos) requires additional reading of the official admin docs at docs.joinpeertube.org.