Logo       PBase-Foundation

PeerTube

Installation - Summary

Substitute your server's subdomain, email and optional SMTP credentials in the echo commands below. If your server is registered in DNS as your domain's root provide an empty string instead of "peertube" shown in the example.

echo "peertube" > /root/DEFAULT_SUB_DOMAIN.txt
echo "myrealemailaddr@myemail.com" > /root/DEFAULT_EMAIL_ADDRESS.txt
echo "smtp.mailgun.org" > /root/DEFAULT_SMTP_SERVER.txt
echo "postmaster@mail.example.com" > /root/DEFAULT_SMTP_USERNAME.txt
echo "ureplac3-w1threalsmtp-pswrd" > /root/DEFAULT_SMTP_PASSWORD.txt

Node JS 16 or higher is required, it may be installed with:

curl -sL https://rpm.nodesource.com/setup_16.x | bash -
yum -y install nodejs

...then run these yum install commands as detailed below.

yum -y install https://pbase-foundation.com/pbase-repo.rpm
yum -y install activpb-preconfig-postgres-peertube
yum -y install pbase-postgres
yum -y install activpb-peertube

Installation - Step by Step

Here is how to install an instance of the PeerTube federated video hosting and sharing based on the ActivityPub protocol. It assumes your EL8 host is registered in DNS on a "peertube" subdomain like peertube.myexample.com and the installer will use Let's Encrypt to setup HTTPS.

Mastodon requires a working SMTP connection to send user-registration emails. Default values for SMTP and admin email are read from text files like DEFAULT_SMTP_USERNAME.txt under /root.

Step 1: Provide your email address and SMTP credentials by using the echo command to create text files under the /root directory.
This example specifies the peertube subdomain. But if you wish to serve Mastodon from the root of your domain leave the DEFAULT_SUB_DOMAIN empty. These example SMTP values are based on the popular Mailgun email vendor:

echo "myrealemailaddr@myemail.com" > /root/DEFAULT_EMAIL_ADDRESS.txt
echo "peertube" > /root/DEFAULT_SUB_DOMAIN.txt
echo "smtp.mailgun.org" > /root/DEFAULT_SMTP_SERVER.txt
echo "postmaster@mail.example.com" > /root/DEFAULT_SMTP_USERNAME.txt
echo "9replac3-w1threalsmtp-pswd4" > /root/DEFAULT_SMTP_PASSWORD.txt

Step 2: Install the pbase-repo package with the command:
yum -y install https://pbase-foundation.com/pbase-repo.rpm

... when it runs, its output will point out the file pbase_repo.json that now holds copies of the defaults.

Step 3: Install the PeerTube dependencies and pre-configuration package with the command:
yum -y install activpb-preconfig-postgres-peertube

Step 4: It's output will tell you to review pbase_smtp.json in the module-config.d directory:
vi /usr/local/pbase-data/admin-only/module-config.d/pbase_smtp.json

... this file must contain valid outgoing SMTP email server credentials.

Step 5: Install a local database with the pbase-postgres package:
yum -y install pbase-postgres

...or to configure a non-local Postgres instance you must edit pbase_postgres.json in the module-config.d directory instead to provide its connection information.

Step 6: Install the activpb-peertube package with the command:
yum -y install activpb-peertube

... it will take a few minutes for the installer to complete this step as it downloads and builds the dependencies used by Peertube.

It will use Let's Encrypt to generate a certificate for HTTPS connections.
When the activpb-peertube package completes you should have a full working instance of Peertube ready to be administered at https://peertube.myexample.com depending on your domain name.

The output of the installer will show Peertube's initial root user and password.

Step 7: Run the following command to display the password for the peertube root user.
journalctl -u peertube | grep User | cut -d: -f8-

You must login to Peertube as this user/password to do first-time setup of your instance.

Extras

You should secure your server ports with pbase-firewall-enable and lock down SSH access with the pbase-ssh-fail2ban package.

ActivityPub servers need correct time, so if your server doesn't already have NTP/Chrony already running you should sync your clocks with the pbase-timesync-enable package.

yum -y install pbase-firewall-enable
yum -y install pbase-ssh-fail2ban
yum -y install pbase-timesync-enable

Compatibility: EL8 only

Version 1.0 of the activpb-peertube package only works with Red Hat EL8.
Note: On Red Hat EL 8 you must first enable CodeReadyBuilder repo with:
subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms

Configuration Options

The first and second step of the install initialize the pbase-repo package. It creates the module-config.d directory to hold customizable configuration option files:
/usr/local/pbase-data/admin-only/module-config.d/

The pbase-repo creates this file: pbase_repo.json
it must be edited to set the defaultEmailAddress field with your email.

{
"pbase_repo": {
"defaultEmailAddress": "myaddress@myexample.com",
"defaultDesktopUsername": "",
"defaultSmtpPassword": "9876543210987654321-87654321",
"defaultSubDomain": ""
}
}

The third step of the install is the activpb-preconfig-postgres-peertube package. It places more default option files described below under the /usr/local/pbase-data/admin-only/module-config.d/ directory.

This is the Peertube configuration options file: activpb_peertube.json
These defaults are appropriate for most use cases.
When the peertubeVersion is empty, the most recent release is downloaded. To use a pre-release version simply fill the peertubeVersion field with v-prefixed tag. For example "v3.0.0-rc.1"
If you wish to change the urlSubDomain field, it must also be changed to the same value in the pbase_lets_encrypt.json file.

{
"activpb_peertube" : {
"peertubeVersion": "",
"port": 9000,
"addNgnixProxy": true,
"urlSubDomain": "peertube"
}
}

(Limitations: changing the port or addNgnixProxy field is not implemented in 1.0)


This is the Let's Encrypt configuration options file: pbase_lets_encrypt.json
The emailAddress gets copied from the pbase_repo.json set above. If you wish to change the urlSubDomain field, it must also be changed to the same value in the pbase_lets_encrypt.json file. (If your server is not registered in DNS you should set executeCertbotCmd to false.)

{
"pbase_lets_encrypt" : {
"enableAutoRenew": true,
"executeCertbotCmd": true,
"urlSubDomain": "peertube",
"additionalSubDomain": "",
"emailAddress": "yoursysadmin@yourrealmail.com"
}
}

(Limitations: the additionalSubDomain field is not implemented in 1.0)


This is the SMTP configuration options file: pbase_smtp.json
The defaults are typical for a client using the popular Mailgun service.
Be sure to set the password field with the correct value from the SMTP provider.

{
"pbase_smtp" : {
"server": "smtp.mailgun.org",
"port": 587,
"login": "postmaster@mail.example.com",
"password": "myrealsmtppassword",
"authMethod": "plain",
"openSSLVerifyMode": "none"
}
}

This is the Postgres configuration options file: pbase_postgres.json
The defaults are typical for a standalone Peertube server stack with a local Postgres server, and generally will not need to be modified.

But for an external database server this file must be edited. First, set the install field to false and provide the remote Postgres database's connection information.

{
"pbase_postgres": [
{
"default": {
"hostName": "localhost",
"port": "5432",
"startService": true,
"enableRemoteAccess": true,
"install": true,
"database": [
{
"name": "peertube_prod",
"user": "peertube",
"password": "myrealpostgrespassword",
"characterSet": "UTF8",
"grantCreateDatabase": true
}
]
}
}
]
}

(Limitations: only one database at a time, changing the startService, enableRemoteAccess fields are not implemented in 1.0)

Subdomain name

The default install assumes the 'peertube' subdomain is configured in DNS. But to configure a subdomain besides 'peertube' you must edit the urlSubDomain field in both the pbase_lets_encrypt.json and the activpb_peertube.json files created in step two of the install.

The other option is to have Peertube for your root domain. In this case, simply set the urlSubDomain fields to an empty string.

Source code of this RPM

This is the RPM .spec file containing the code that is executed by the activpb-peertube installer. https://github.com/marklangbehn/pbase-rpm-installer/blob/master/activitypub/activpb-peertube/rpmbuild/SPECS/activpb-peertube.spec

More about Peertube

Visit the Peertube project at:
https://joinpeertube.org/
"PeerTube, developed by Framasoft, is the free and decentralized alternative to video platforms..."