Getting started with PeerTube

Your Own Instance

Setting up your own PeerTube instance and then federating it is not terribly hard. First off, you do not need particularly high-end hardware [4], although a decent network connection is a must. With these requirements, most mid-range servers with decent-sized storage that you can rent from a hosting service for EUR30 (~$32) will do.

The first installation step, as usual, involves securing your server. How to secure your server is beyond the scope of this article. If you have any user-facing service, such as a blog, you already should have secured your server anyway. Notwithstanding, if you need some hints, look into a decent firewall, close every port except the ones you need open, configure your server to not honor password-enabled logins over SSH, and install and set up Fail2Ban [5].

For anyone who has set up a web service before, building a PeerTube instance follows the familiar steps of installing dependencies, setting up databases, installing and configuring PeerTube itself, and setting up your web server.

Written mostly in TypeScript, PeerTube relies on Node.js as its application server, Yarn as a package manager, and PostgreSQL and Redis to store data. FFmpeg is used for processing video in the background, and the supported web server is NGINX. The PeerTube documentation provides a guide on how to install these packages on your machine [6].

The official documentation also describes the process of setting up a peertube user on the system, setting up databases, downloading the PeerTube instance code, and tweaking the code to meet your particular needs. The documentation also covers how to set up your NGINX server, set PeerTube to run as a service, and, finally, how to log in as the administrator [7].

Administration

To quickly and easily acquire content for your instance, federate your instance with other instances. Fill in the details regarding your server so other admins can confirm that your instance is legit: Click on Administration in the sidebar, and go to Configuration | Information.

In the Administration section under Configuration | Basic, you can set up the policy for registering users, as well as how much space you are going to assign each user. Note that there is nothing wrong with maintaining a small, invitation-only instance. It is better to run an instance for 20 people, give them ample space for their content, and keep spammers at bay, than it is to have 2,000 accounts, very limited space for each user, and a mismanaged mess of an instance.

From Basic, you also can set how you want to federate your instance with others in the Federation section. Federating in PeerTube entails setting your instance to follow others – which means your instance will show and share the other instances' content (but not necessarily the other way around, unless they follow you back) – allowing other instances to follow you, and sharing your content on their instances.

To follow an instance with interesting content, go to Federation | Following, click on the Follow button and fill in the text box, with one instance address per line (Figure 6). For followers, you will receive notifications of instances that want to follow yours. You can approve or reject requests by visiting Federation | Followers.

Figure 6: Add new instances to follow and show their content in your instance.

Such is the nature of federation that videos may appear on your instance from instances that you are not directly following. These videos will be reaching you second hand, so to speak, because you are following an instance that is following them. Your instance will be helping to spread these videos from a third party in turn.

In general, this is a good thing, but if you find unsavory content appearing on your instance, you can block whole instances by going to Moderation | Muted servers and adding the offensive domain to the list. However, use this feature sparingly: PeerTube does not host any full videos from other instances on your instance, but it does count on federated instances sharing fragments of videos in order to spread the load in a true P2P fashion. PeerTube relies on instances federating with others to be able to provide a comprehensive service.

The Moderation tab also lets you control your instance's content on a more granular level, allowing you to mute accounts, remove rule-breaking comments, and check reports of abuse coming from users.

If you want to provide more services to your users – for example, the chat option on live streams mentioned earlier – check out the Plugins/Themes tab. Click on Search, and you can install plugins directly into your instance from there. Each plugin has a complete page for settings. The live chat plugin, for example, lets you configure which rooms it will open by default, whether chats will be logged, and more.

Updating

From time to time, you will need to update your instance. Your instance will notify you when a new version of PeerTube is available. In general, you can follow the instructions available from PeerTube [8]; usually an upgrade is as simple as running a script.

That said, occasionally some vital component will change and running a script will not be enough. Always remember to check the new version's release notes before upgrading. The release notes will contain instructions that will help you along the way.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News