Deploy a federated, self-hosted YouTube alternative for video hosting, live streaming, and building your own video community.
Grab the automated bash script from GitHub to follow along with the video.
wget https://raw.githubusercontent.com/mhmdali94/Docker/main/media/peertube/peertube-ubuntu.sh
chmod +x peertube-ubuntu.sh
sudo bash peertube-ubuntu.sh
The script installs Docker, pulls the PeerTube, PostgreSQL, and Redis images, and starts all containers. PeerTube will be available on port 9000. The installer also configures the required environment variables and volume mounts for persistent video storage.
wget https://raw.githubusercontent.com/mhmdali94/Docker/main/media/peertube/peertube-ubuntu.sh
chmod +x peertube-ubuntu.sh
sudo bash peertube-ubuntu.sh
Open your browser and navigate to PeerTube. On first run, create your administrator account with a secure password and configure your instance name, description, and default language. This sets up your personal video community.
http://<your-server-ip>:9000
Click "Publish" in the top menu to upload a video. Drag and drop your video file or browse to select it. Fill in the title, description, tags, and privacy settings (Public, Unlisted, or Private). PeerTube will automatically transcode the video into multiple resolutions for adaptive streaming.
In the Admin panel, enable ActivityPub federation to join the Fediverse and allow other PeerTube instances to follow your channels. To enable live streaming, turn on the live feature in Admin > Configuration, then use OBS or any RTMP client pointing to your server on port 1935 with your stream key.
# RTMP stream URL for OBS
rtmp://<your-server-ip>:1935/live/YOUR_STREAM_KEY
| Port | Purpose |
|---|---|
| 9000 | PeerTube Web UI |
| 1935 | RTMP live streaming |
| 5432 | PostgreSQL database (internal) |
PeerTube is an open-source, self-hosted video platform using peer-to-peer technology to reduce server bandwidth. Instances can federate with each other via ActivityPub, allowing content to be discovered across the Fediverse. It supports live streaming, playlists, chapters, and a plugin ecosystem.
PeerTube eliminates dependence on YouTube, Vimeo, or other corporate platforms. You control monetization policies, content moderation, data privacy, and storage. Federation means your videos are discoverable from Mastodon, Peertube.social, and other Fediverse platforms without re-uploading.
PeerTube uses port 9000 for the web interface and port 1935 for RTMP live streaming ingest. Expose port 9000 via HTTPS through a reverse proxy. Open port 1935 in your firewall only if you plan to use live streaming features.
Alternatives include Jellyfin (private media server, no uploading), Owncast (live streaming only), Odysee (blockchain-based), and Vimeo (cloud, polished). Choose PeerTube for a full YouTube alternative with federation and live streaming on your own server.
Avoid PeerTube if you only need to serve pre-recorded videos to a small private audience — Jellyfin or a simple video web server is much lighter. PeerTube requires significant storage and CPU for video transcoding.
PrismaTechWork provides end-to-end infrastructure services — from initial deployment and security hardening to ongoing monitoring, automated backups, and dedicated support. Whether you need a single-server setup or a multi-site network, our team ensures your infrastructure is built right, secured properly, and maintained reliably.
Yes. PeerTube uses WebTorrent to distribute video delivery across viewers. When multiple people watch the same video simultaneously, their browsers share chunks of the video with each other, reducing the bandwidth your server must serve. This is transparent to viewers and works in any modern browser.
Yes. PeerTube supports live streaming via RTMP ingest on port 1935. Configure OBS or any RTMP-compatible streaming software to stream to rtmp://YOUR_SERVER_IP:1935/live with the stream key shown in PeerTube's live stream settings.
Federation means your PeerTube instance communicates with other PeerTube instances via the ActivityPub protocol. Videos on your instance can be followed and shared by users on other instances. Users on Mastodon can also follow your PeerTube channel and see new video posts in their timeline.
Storage depends on your video library size. PeerTube stores multiple transcoded versions of each video at different resolutions. A 1-hour 1080p video may require 2 to 5 GB of storage after transcoding. Plan for object storage (S3-compatible) for large libraries to avoid filling your server disk.
Yes. PeerTube supports video privacy settings: public (visible to all), unlisted (accessible via direct link only), private (visible only to the uploader), and password-protected. You can also restrict upload permissions to admins only, making it a curated platform.
Yes. PeerTube supports chapters defined as timestamps in the video description. For captions and subtitles, upload SRT or VTT files in multiple languages — they appear as selectable subtitle tracks in the video player.
Yes. PeerTube supports S3-compatible object storage for video files, reducing the load on your server disk. Configure the objectStorage section in your config with your S3 bucket name, region, and credentials. This is recommended for large video libraries.
Each PeerTube video has an embed code available from the video page Share menu. Copy the iframe embed code and paste it into any HTML page. The embedded player respects the video's privacy settings — private videos cannot be embedded.