====== PeerTube Installation ====== ===== 1. System preparation ===== Install all required packages: apt install -y curl sudo unzip vim ffmpeg postgresql postgresql-contrib g++ make redis-server git python-dev cron wget Start PostgreSQL and Redis: systemctl start postgresql redis ===== 2. Node.js & Yarn installation ===== Your guide says Node.js 14 is needed, but PeerTube 7.2.1 (newer version) requires Node.js >= 20. So you must install Node.js 20 (instead of 14) to fix the incompatibility. curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - sudo apt install -y nodejs npm install --global yarn Check versions: node -v # should show v20.x.x or higher yarn -v ===== 3. Create PeerTube user ===== useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube ===== 4. Set up PostgreSQL database and user ===== su -l postgres createuser -P peertube # remember the password! createdb -O peertube -E UTF8 -T template0 peertube_prod psql -c "CREATE EXTENSION pg_trgm;" peertube_prod psql -c "CREATE EXTENSION unaccent;" peertube_prod exit ===== 5. Create PeerTube directories ===== su -l peertube mkdir config storage versions chmod 750 config exit ===== 6. Download & extract PeerTube ===== su -l peertube VERSION=$(curl -s https://api.github.com/repos/chocobozzz/peertube/releases/latest | grep tag_name | cut -d '"' -f 4) cd /var/www/peertube/versions wget "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" unzip peertube-${VERSION}.zip rm peertube-${VERSION}.zip exit ===== 7. Install Yarn dependencies ===== su -l peertube cd /var/www/peertube ln -s versions/peertube-${VERSION} ./peertube-latest cd peertube-latest yarn install --production --pure-lockfile exit ===== 8. Adjust configuration ===== su -l peertube cd /var/www/peertube cp peertube-latest/config/production.yaml.example config/production.yaml vim config/production.yaml # set hostname, database, admin email, SMTP etc. exit ===== 9. Get SSL certificate with Certbot ===== certbot --nginx -d your.hostname.tld certonly ===== 10. Configure Nginx ===== cp /var/www/peertube/peertube-latest/support/nginx/peertube /etc/nginx/sites-available/peertube sed -i 's/${WEBSERVER_HOST}/your.hostname.tld/g' /etc/nginx/sites-available/peertube sed -i 's/${PEERTUBE_HOST}/127.0.0.1:9000/g' /etc/nginx/sites-available/peertube ln -s /etc/nginx/sites-available/peertube /etc/nginx/sites-enabled/peertube systemctl reload nginx ===== 11. Start PeerTube as a service ===== cp /var/www/peertube/peertube-latest/support/systemd/peertube.service /etc/systemd/system/ systemctl daemon-reload systemctl start peertube systemctl status peertube # check if running ===== 12. Set admin password ===== su -l peertube cd /var/www/peertube/peertube-latest NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run reset-password -- -u root exit