How to install PeerTube on Nethserver

Peertube is a decentralized youtube replacement, see Feature request: PeerTube on NethServer:

Unfortunately peertube needs nodejs8 and I needed to replace the centos nodejs stack because rh-nodejs8 is not working, see Nethserver-collabora CODE testing and discussion so please don’t run in production.
You need a virtualhost domain like virtualhostdomain.tld.

Get repos - peertube, epel multimedia and nodejs:

wget https://copr.fedorainfracloud.org/coprs/daftaupe/peertube/repo/epel-7/daftaupe-peertube-epel-7.repo -P /etc/yum.repos.d/
wget https://negativo17.org/repos/epel-multimedia.repo -P /etc/yum.repos.d/
curl -sL https://rpm.nodesource.com/setup_8.x | bash -
yum -y install nethserver-postgresql postgresql-contrib nethserver-redis

Create database, db user and needed postgresql extensions (change secret to something more secure):

su - postgres -c psql
create database peertube_prod;
create user peertube with encrypted password 'secret';
grant all privileges on database peertube_prod to peertube;
\c peertube_prod
CREATE EXTENSION pg_trgm;
CREATE EXTENSION unaccent;
\q

Install peertube:

yum -y install peertube

Edit /etc/peertube/production.yaml and set the DB password (that is secret if you didn’t change it in previous step) and your virtual host:

webserver:
...
  hostname: 'virtualhostdomain.tld'
database:
...
  password: 'secret'

Get /etc/httpd/conf.d/peertube.conf and edit the 2 servername directives to match your virtualhost:

wget https://gist.githubusercontent.com/mrmarkuz/de99f0ef59ef7d1716504c710801d4a4/raw/31f742103ad1dfec94408537b34b6d595b902def/peertube.conf -P /etc/httpd/conf.d/

ServerName virtualhostdomain.tld

Restart httpd and start/enable peertube and view peertube log:

systemctl restart httpd
systemctl enable peertube --now && journalctl -f -u peertube

Note the user password and exit journalctl with CTRL-C.

info: Username: root
info: User password: sdalfkdasfkasddfk

Browse to https://virtualhostdomain.tld and login with the given credentials.

9 Likes

Hi,

Really great…
Thank you very much, for this how to.
And thank you, to show how this community is great and have loving memebrs.

3 Likes

Thanks a lot @mrmarkuz! Great work.
I will check with the peertube community if there are any options to get peertube integrated with CentOS7/NethServer in a somewhat more elegant way (nodejs issue)

1 Like

And for polishing ( the path for excelence :innocent:)…
To have a Nethserver package with the « application menu » integration :kissing_heart:

1 Like

I posted on peertube forums with some questions and remarks:

1 Like
Create /usr/share/nethesis/NethServer/Module/Dashboard/Applications/Peertube.php with following content (edit the URL to match your virtualhost):
<?php
namespace NethServer\Module\Dashboard\Applications;

class Peertube extends \Nethgui\Module\AbstractModule implements \NethServer\Module\Dashboard\Interfaces\ApplicationInterface
{
  public function getName()
  {
    return "Peertube";
  }
  public function getInfo()
  {
    return array(
      'url' => "https://vhostdomain.tld",
    );
  }
}
1 Like

Simply brilliant,
Thank you again.

I received a response on my question about NodeJS.
They suggest to use NVM (Nodejs Version Manager): https://github.com/creationix/nvm
Would that be an option?

1 Like

Yes, as it does not touch the systems nodejs, I just have to find the best way that the peertube service uses the nvm version.
I am going to test it ASAP…

1 Like

Would this effect Onlyoffice using Nodejsv8?

I think nvm could be used for onlyoffice too.
But the best way still would be rh-nodejs8 as it’s provided by system package manager and updated.

2 Likes

Many thanks @mrmarkuz!
I’ve test this install, everything works expect to save a new configuration in the web admin interface.
The result is an error : “Server error. Please retry later.”

In /var/log/messages, I can see:
Mar 18 18:34:11 ns peertube: [MyDomain.com:443] 2019-03-18 18:34:11.498 #033[31merror#033[39m: Error in controller. {
Mar 18 18:34:11 ns peertube: “meta”: {
Mar 18 18:34:11 ns peertube: “err”: “Error: EROFS: read-only file system, open ‘/etc/peertube/local-production.json’”
Mar 18 18:34:11 ns peertube: },
Mar 18 18:34:11 ns peertube: “err”: “Error: EROFS: read-only file system, open ‘/etc/peertube/local-production.json’”
Mar 18 18:34:11 ns peertube: }

I found this issues on the Peertube github: workaround to fix permission denied to local-production.json

So I did:
touch /etc/peertube/local-production.json
chown peertube:peertube /etc/peertube/local-production.json

But it doesn’t make the job. The result is the same: this file can’t be written.

An idea?

Confirmed, I get the same error.

As a workaround you may edit /etc/peertube/production.json to fit your needs as recommended in the peertube install docs for centos instead of using the web UI. Don’t forget to remove /etc/peertube/local_production.json and restart the service with systemctl restart peertube.

Thank you, it’s what I already done.

But do you think there is a ‘clean’ solution ?

Maybe it works with the production version, this howto uses the community packages. I never tested on another distro than NS7.

Hello all,

For your information, I had a problem to launch peertube: it was linked with ffmpeg.
If you have this error:

ffmpeg --version
ffmpeg: error while loading shared libraries: libzmq.so.5: cannot open shared object file: No such file or directory

Then you can do:

yum install zeromq

1 Like

Is peertube able to use ldap-auth for userlogins? I would install a standalone peertube server and bind it to the Nethserver/Windows AD Server… ?

Not yet but work in progress:

2 Likes

OK, thanks…

Hello @mrmarkuz,
I can’t start Peertube without error…
Have you been able to make any progress on this subject (nodejs nvm)?