From 5323e10feb193d120bdbbeb219ddb8a2b84bbb62 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 6 Aug 2021 12:51:45 -0400 Subject: peertube tweaks --- peertube.html | 82 +++++++++++++++++++++++++++++++---------------------------- 1 file changed, 43 insertions(+), 39 deletions(-) (limited to 'peertube.html') diff --git a/peertube.html b/peertube.html index cc88f15..d0f7aab 100644 --- a/peertube.html +++ b/peertube.html @@ -69,35 +69,38 @@ exit

Installation

-

This handy one-liner can be used to determine the latest PeerTube version:

+

Using su -l, we will become the PeerTube user to create the required directories and download and install PeerTube itself with the proper permissions. + First, we create the required directories.

-
VERSION=$(curl -s https://api.github.com/repos/chocobozzz/peertube/releases/latest | grep tag_name | cut -d '"' -f 4) && echo "Latest Peertube version is $VERSION"
+
su -l peertube
+mkdir config storage versions
+chmod 750 config
-

Next, a basic directory structure needs to be setup in the PeerTube user's home directory (/var/www/peertube).

+

Downloading PeerTube

+

Still as the PeerTube user, we can now check for the most recent PeerTube versions number, download and install it in the newly created versiond directory.

+
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
-

To ensure permissions remain the same while managing files as PeerTube, sudo can be used to perform actions:

+

Installation via Yarn

-
sudo -u peertube mkdir config storage versions
-sudo -u peertube chmod 750 config
+

The downloaded release can then be symbolically linked to /var/www/peertube/peertube-latest and yarn is used to install PeerTube:

-

Finally, a PeerTube release can be downloaded from the GitHub page using the VERSION variable from before:

- -
cd /var/www/peertube/versions
-sudo -u peertube wget -q "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip"
-sudo -u peertube unzip -q peertube-${VERSION}.zip && sudo -u peertube rm peertube-${VERSION}.zip
- -

The downloaded release can then be symbolically linked to /var/www/peertube/peertube-latest and yarn is used to install PeerTube:

- -

-sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest
-cd ./peertube-latest && sudo -H -u peertube yarn install --production --pure-lockfile
+
cd /var/www/peertube
+ln -s versions/peertube-${VERSION} ./peertube-latest
+cd ./peertube-latest
+yarn install --production --pure-lockfile

Configuration

-

PeerTube's default config file can be copied over to /var/www/peertube/config.production.yaml so it can actually be used:

+

PeerTube's default config file can be copied over to /var/www/peertube/config/production.yaml so it can actually be used:

+ +

Note that we are still running these as the PeerTube user (having run su -l peertube).

cd /var/www/peertube
-	sudo -u peertube cp peertube-latest/production.yaml config/production.yaml
+cp peertube-latest/config/production.yaml.example config/production.yaml

Now the production.yaml file must be edited in the following ways:

@@ -143,9 +146,18 @@ cd ./peertube-latest && sudo -H -u peertube yarn install --production --pure-loc ca_file: null # Used for self signed certificates from_address: 'admin@example.org' -

NGINX

+

At this point, we have done all we need to do as the PeerTube user. Run exit or press Ctrl-d to log out and return to the root prompt where we will configure Nginx and other system settings.

+ +

Certbot

+ +

First, we will want a Certbot SSL certificate to encrypt connections to our PeerTube instance. + Just run the following:

+ +
certbot --nginx -d peertube.example.org certonly
+ +

Nginx

-

PeerTube includes an NGINX configuration that can be copied over to /etc/nginx/sites-available: +

PeerTube includes an Nginx configuration that can be copied over to /etc/nginx/sites-available:

cp /var/www/peertube/peertube-latest/support/nginx/peertube /etc/nginx/sites-available/peertube
@@ -156,43 +168,35 @@ cd ./peertube-latest && sudo -H -u peertube yarn install --production --pure-loc
sed -i 's/${WEBSERVER_HOST}/example.org/g' /etc/nginx/sites-available/peertube
 sed -i 's/${PEERTUBE_HOST}/127.0.0.1:9000/g' /etc/nginx/sites-available/peertube
-

Once you're happy with the NGINX config file, link it to sites-enabled to activate it:

+

Once you're happy with the Nginx config file, link it to sites-enabled to activate it:

ln -s /etc/nginx/sites-available/peertube /etc/nginx/sites-enabled/peertube
-

Encryption with Certbot

- -

It's highly recommended to generate certificates for use with your PeerTube site, and this can be easily done with Let's Encrypt's certbot command:

- -
systemctl stop nginx
-certbot certonly --standalone -d example.org
-sudo systemctl restart nginx
- -

The certificates are generated standalone since the PeerTube NGINX config file already includes configuration for certbot.

-

Running PeerTube

-

A config file for a systemd daemon is included in PeerTube and can be setup like so:

+

A config file for a systemd daemon is included in PeerTube and can be setup and started like so:

cp /var/www/peertube/peertube-latest/support/systemd/peertube.service /etc/systemd/system/
-systemctl daemon-reload
+systemctl daemon-reload +systemctl start peertube -

Now, finally, run the PeerTube daemon to start PeerTube:

- -
systemctl start peertube
+

+ PeerTube will take a momemnt to start, but after it does, you can check its status with systemctl status peertube and at this point, your PeerTube site should be live! +

Using PeerTube

To set a password for your admin user, run:

-
cd /var/www/peertube/peertube-latest && NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run reset-password -- -u root
+
cd /var/www/peertube/peertube-latest
+NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run reset-password -- -u root

Login to your PeerTube instance using the admin email specified in your production.yaml file and the admin password you just set.

Once logged in, it's recommended to create a separate user without admin privileges for uploading videos to PeerTube. - This can be done easily from the users tab in the administration section:

+ This can be done easily from the users tab in the administration section.

Enjoy your PeerTube instance!

-- cgit v1.2.3