]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - support/doc/dependencies.md
Don't use min FPS, throw instead
[github/Chocobozzz/PeerTube.git] / support / doc / dependencies.md
CommitLineData
afe81767 1# Dependencies
63bfad7e 2
3dd6d6cd 3Follow the below guides, and check their versions match [required external dependencies versions](https://github.com/Chocobozzz/PeerTube/blob/master/engines.yaml). You can check them automatically via `sudo npx engineslist`.
867ed651 4
c9b36909
RK
5_note_: only **LTS** versions of external dependencies are supported. If no LTS version matching the version constraint is available, only **release** versions are supported.
6
92340699
RK
7<!-- START doctoc generated TOC please keep comment here to allow auto update -->
8<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
9
92340699
RK
10- [Debian / Ubuntu and derivatives](#debian--ubuntu-and-derivatives)
11- [Arch Linux](#arch-linux)
12- [CentOS 7](#centos-7)
4d557df5
C
13- [Centos 8](#centos-8)
14- [Rocky Linux 8.4](#rocky-linux-84)
92340699 15- [Fedora](#fedora)
4d557df5 16- [Red Hat Enterprise Linux 8](#red-hat-enterprise-linux-8)
92340699
RK
17- [FreeBSD](#freebsd)
18- [macOS](#macos)
19- [Gentoo](#gentoo)
4d557df5 20- [OpenBSD](#openbsd)
92340699
RK
21- [Other distributions](#other-distributions)
22
23<!-- END doctoc generated TOC please keep comment here to allow auto update -->
24
e5203ffa 25## Debian / Ubuntu and derivatives
ab87af11
DK
26
271. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation
955f14a4 28
bc2fc1a7 29```
99402413 30# apt-get install curl sudo unzip vim
bc2fc1a7 31```
955f14a4 32
ab87af11
DK
332. It would be wise to disable root access and to continue this tutorial with a user with sudoers group access
34
1d840011 353. Install NodeJS 14.x:
ab87af11 36[https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions](https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions)
d8658f0f 374. Install yarn, and be sure to have [a recent version](https://github.com/yarnpkg/yarn/releases/latest):
ab87af11 38[https://yarnpkg.com/en/docs/install#linux-tab](https://yarnpkg.com/en/docs/install#linux-tab)
63bfad7e 39
4d557df5
C
405. Install Python:
41
42On Ubuntu <= bionic (18.04 LTS) or Debian <= Buster:
43
44```
45sudo apt update
46sudo apt install python-dev
47python --version # Should be >= 2.x or >= 3.x
48```
49
50On Ubuntu >= focal (20.04 LTS) or Debian >= Bullseye:
51
52```
53sudo apt update
54sudo apt install python3-dev python-is-python3 # python-is-python2 should also work
55python --version # Should be >= 2.x or >= 3.x
56```
57
586. Install common dependencies:
63bfad7e 59
afe81767 60```
ab87af11 61sudo apt update
4d557df5 62sudo apt install certbot nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git cron wget
f309a156 63ffmpeg -version # Should be >= 4.1
ab87af11 64g++ -v # Should be >= 5.x
63bfad7e
C
65```
66
81cdf382 67Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
ab87af11 68
81cdf382 69```
ab87af11 70sudo systemctl start redis postgresql
81cdf382
RK
71```
72
afe81767 73## Arch Linux
63bfad7e 74
ab87af11 751. Run:
63bfad7e 76
afe81767 77```
4d557df5 78sudo pacman -S nodejs-lts-fermium yarn ffmpeg postgresql openssl redis git wget unzip python base-devel npm nginx
63bfad7e
C
79```
80
81cdf382 81Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
ab87af11 82
81cdf382 83```
ab87af11 84sudo systemctl start redis postgresql
81cdf382
RK
85```
86
053ad3a3
EC
87## CentOS 7
88
9162476f 891. Install NodeJS 12.x:
ab87af11
DK
90[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
91
f309a156 922. Install yarn:
ab87af11
DK
93[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
94
953. Install or compile ffmpeg:
96
97* Install - [https://linoxide.com/linux-how-to/install-ffmpeg-centos-7/](https://linoxide.com/linux-how-to/install-ffmpeg-centos-7/)
98* Compile - [https://gist.github.com/mustafaturan/7053900#file-latest-ffmpeg-centos6-sh](https://gist.github.com/mustafaturan/7053900#file-latest-ffmpeg-centos6-sh)
99
f309a156 1004. Install Packages:
053ad3a3
EC
101
102```
ab87af11
DK
103sudo yum update
104sudo yum install epel-release centos-release-scl
105sudo yum update
106sudo yum install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git devtoolset-7
0414ed10
O
107```
108
ab87af11
DK
1095. You need to use a more up to date version of G++ in order to run the yarn install command, hence the installation of devtoolset-7.
110
4c86a254 111```
ab87af11 112sudo scl enable devtoolset-7 bash
053ad3a3
EC
113```
114
d4557fd3
RK
115Later when you invoke any node command, please prefix them with `CC=/opt/rh/devtoolset-7/root/usr/bin/gcc CXX=/opt/rh/devtoolset-7/root/usr/bin/g++`, such as with:
116
117```
ab87af11 118sudo -H -u peertube CC=/opt/rh/devtoolset-7/root/usr/bin/gcc CXX=/opt/rh/devtoolset-7/root/usr/bin/g++ yarn install --production --pure-lockfile
d4557fd3
RK
119```
120
f309a156 1216. Initialize the PostgreSQL database:
ab87af11 122
f60e85ce 123```
39072b2f 124sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
f60e85ce
W
125```
126
f309a156 127Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
ab87af11 128
81cdf382 129```
a075cd00
CGI
130sudo systemctl enable --now redis
131sudo systemctl enable --now postgresql
81cdf382
RK
132```
133
a075cd00
CGI
134## Centos 8
135
9162476f 1361. Install NodeJS 12.x:
a075cd00
CGI
137[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
138
f309a156 1392. Install yarn:
a075cd00
CGI
140[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
141
1423. Install or compile ffmpeg:
143
144* Install - [https://linuxize.com/post/how-to-install-ffmpeg-on-centos-8/](https://linuxize.com/post/how-to-install-ffmpeg-on-centos-8/)
145
f309a156 1464. Install packages:
a075cd00
CGI
147
148```
149sudo dnf update
f309a156 150sudo dnf install epel-release
a075cd00
CGI
151sudo dnf update
152sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
153```
154
1555. You'll need a symlink for python3 to python for youtube-dl to work
156
157```
158sudo ln -s /usr/bin/python3 /usr/bin/python
159```
160
f309a156 1616. Initialize the PostgreSQL database:
a075cd00
CGI
162
163```
39072b2f 164sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
a075cd00
CGI
165```
166
f309a156 167Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
a075cd00
CGI
168
169```
170sudo systemctl enable --now redis
171sudo systemctl enable --now postgresql
172```
173
d35f3a86 174## Rocky Linux 8.4
f68d1cb6 175
d35f3a86 1761. Pull the latest updates:
f68d1cb6
W
177```
178sudo dnf update -y
179```
180
2a21507a 1812. Install NodeJS 12.x (or 14):
f68d1cb6
W
182```
183sudo dnf module install -y nodejs:12
184```
185
d35f3a86 1863. Install yarn:
f68d1cb6
W
187```
188sudo npm install --global yarn
189```
190
d35f3a86 1914. Install or compile ffmpeg (if you want to compile... enjoy):
f68d1cb6 192```
d35f3a86 193sudo dnf install -y epel-release
f68d1cb6
W
194sudo dnf --enablerepo=powertools install -y SDL2 SDL2-devel
195sudo dnf install -y --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm
196sudo dnf install -y ffmpeg
197sudo dnf update -y
198```
199
2005. Install PostgreSQL and Python3 and other stuff:
201```
202sudo dnf install -y nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git python3
203sudo ln -s /usr/bin/python3 /usr/bin/python
204sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
205sudo systemctl enable --now redis
206sudo systemctl enable --now postgresql
207```
208
2096. Configure the peertube user:
210```
211sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
212```
213
2147. Unknown missing steps:
d35f3a86
C
215- Steps missing here... these were adapted from the CentOS 8 steps which abruptly ended.
216- /var/www/peertube does not exist yet (expected? done in future steps? documentation?).
217- Nothing about Certbot, NGINX, Firewall settings, and etc.
218- Hopefully someone can suggest what is missing here with some hints so I can add it?
a075cd00 219
0a314a99 220## Fedora
221
ab87af11
DK
2221. Upgrade your packages:
223
0a314a99 224```
225dnf upgrade
226```
ab87af11
DK
227
2282. Add a user with sudoers group access:
229
0a314a99 230```
231useradd my-peertube-user
232passwd my-peertube-user
233usermod my-peertube-user -a -G wheel # Add my-peertube-user to sudoers
234su my-peertube-user
235```
ab87af11 236
d8658f0f 2373. (Optional) Install certbot (choose instructions for your distribution):
0a314a99 238[https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
ab87af11 239
9162476f 2404. Install NodeJS 12.x:
0a314a99 241[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
ab87af11 242
f309a156 2435. Install yarn:
0a314a99 244[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
ab87af11
DK
245
2466. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
247
0a314a99 248```
249sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
250```
251This is necessary because `ffmpeg` is not in the Fedora repos.
252
ab87af11
DK
2537. Run:
254
0a314a99 255```
39072b2f 256sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git vim
f309a156 257ffmpeg -version # Should be >= 4.1
0a314a99 258g++ -v # Should be >= 5.x
259```
ab87af11 260
8182a370
FS
2618. Configure nginx
262
263```
264sudo mkdir /etc/nginx/sites-available
265sudo mkdir /etc/nginx/sites-enabled
266sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
267```
268
2699. Post-installation
0a314a99 270
271_from [PostgreSQL documentation](https://www.postgresql.org/download/linux/redhat/):_
272> Due to policies for Red Hat family distributions, the PostgreSQL installation will not be enabled for automatic start or have the database initialized automatically.
ab87af11 273
0a314a99 274```
275# PostgreSQL
39072b2f 276sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
0a314a99 277sudo systemctl enable postgresql.service
278sudo systemctl start postgresql.service
279# Nginx
280sudo systemctl enable nginx.service
281sudo systemctl start nginx.service
282# Redis
283sudo systemctl enable redis.service
284sudo systemctl start redis.service
285```
ab87af11 286
8182a370 28710. Firewall
0a314a99 288
51c35447 289By default, you cannot access your server via public IP. To do so, you must configure firewall:
ab87af11 290
644800ef 291- Ports used by peertube dev setup:
0a314a99 292```
0a314a99 293sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
294sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
644800ef
FS
295```
296- Optional
297
298```
299sudo firewall-cmd --permanent --zone=public --add-service=http
300sudo firewall-cmd --permanent --zone=public --add-service=https
301```
302
303- Reload firewall
304
305```
306sudo firewall-cmd --reload
307```
308
30911. Configure max ports
310
311This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
312
313```
314echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
315```
316
317[More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
318
319## Red Hat Enterprise Linux 8
320
3211. Register system as root user to Red Hat Subscription Management (create a free Red Hat account if you don't have one yet).
322
323```
324# subscription-manager register --username <username> --password <password> --auto-attach
325# dnf upgrade
326# reboot
327```
328
3292. Install Node.JS
330
331```
332sudo dnf module install nodejs:12
333```
334
3353. Install Yarn
336
337```
338curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
339sudo dnf install yarn
340```
341
3424. Install FFmpeg
343
344```
345sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-$(arch)-rpms"
346sudo dnf install --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
347sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
348sudo dnf upgrade
349sudo dnf install ffmpeg
350```
351
3525. Run:
353
354```
355sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
356```
357
3586. You'll need a symlink for python3 to python for youtube-dl to work
359
360```
361sudo ln -s /usr/bin/python3 /usr/bin/python
362```
363
3647. Initialize the PostgreSQL database:
365
366```
367sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
368```
369
370Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
371
372```
373sudo systemctl enable --now redis
374sudo systemctl enable --now postgresql
375```
376
377If you are running the production guide, you also need to slightly pre-configure nginx, because nginx is packaged differently in the Red Hat family distributions:
378
3798. Configure nginx
380
381```
382sudo mkdir /etc/nginx/sites-available
383sudo mkdir /etc/nginx/sites-enabled
384sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
385sudo systemctl enable --now nginx
386```
387
3889. Prepare directory
389
390To add the 'peertube' user, you first have to create the 'www' folder and once the 'peertube' user is added, you have to set the access permissions.
391
392```
393sudo mkdir /var/www
394
395sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
396sudo passwd peertube
397
398sudo chmod 755 /var/www/peertube/
399```
400
40110. Firewall
402
403By default, you cannot access your server via public IP. To do so, you must configure firewall:
404
405- Ports used by peertube dev setup:
406```
407sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
408sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
409```
410- Optional
411
412```
0a314a99 413sudo firewall-cmd --permanent --zone=public --add-service=http
414sudo firewall-cmd --permanent --zone=public --add-service=https
644800ef
FS
415```
416
417- Reload firewall
418
419```
0a314a99 420sudo firewall-cmd --reload
421```
0a314a99 422
8182a370 42311. Configure max ports
ab87af11 424
f309a156 425This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
ab87af11 426
0a314a99 427```
428echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
429```
ab87af11 430
0a314a99 431[More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
432
644800ef 433
4c86a254
GN
434## FreeBSD
435
436On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
437
f309a156 4381. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed):
ab87af11 439
4c86a254 440```
ab87af11
DK
441pkg
442pkg update
f6160062 443pkg install -y sudo bash wget git python nginx pkgconf postgresql13-server postgresql13-contrib redis openssl node npm yarn ffmpeg unzip
4c86a254
GN
444```
445
f309a156 4462. Allow users in the wheel group (hope you don't forgot to add your user on wheel group!) to use sudo.
ab87af11 447
4c86a254
GN
448```
449# visudo
450```
451
ab87af11 452Uncomment the line 90
f309a156 453
4c86a254
GN
454```
455%wheel ALL=(ALL) ALL
456```
457
f309a156 4583. Enable nginx, redis, postgresql services and initialize database.
4c86a254 459
4c86a254 460```
ab87af11
DK
461sysrc postgresql_enable="YES"
462sysrc redis_enable="YES"
463sysrc nginx_enable="YES"
4c86a254
GN
464```
465
ab87af11
DK
466Initialize database and start services
467
4c86a254 468```
ab87af11
DK
469service postgresql initdb
470service postgresql start
471service redis start
472service nginx start
4c86a254
GN
473```
474
2f7ac618 475## macOS
2f7ac618 476
ab87af11
DK
4771. Add the packages:
478
02d6226a
AV
479```sh
480brew install bash ffmpeg nginx postgresql openssl gcc make redis git yarn
ab87af11 481```
02d6226a
AV
482
483You may need to update your default version of bash.
484
485**How to change your default shell**
486
487```sh
488which -a bash # Check where bash is installed
489bash --version # You need a version at least as recent as 4.0
490sudo vim /etc/shells # Add in this file : /usr/local/bin/bash
491chsh -s /usr/local/bin/bash # To set the brew-installed bash as default bash
ab87af11
DK
492```
493
d35f3a86 494In a new shell, type `bash --version` to assert your changes took effect and
02d6226a
AV
495correctly modified your default bash version.
496
ab87af11 4972. Run the services:
2f7ac618 498
02d6226a 499```sh
ab87af11
DK
500brew services run postgresql
501brew services run redis
502```
396f224b 503
02d6226a 504On macOS, the `postgresql` user can be `_postgres` instead of `postgres`.
ddc7d3ec 505If `sudo -u postgres createuser -P peertube` gives you an `unknown user: postgres` error, you can try `sudo -u _postgres createuser -U peertube`.
02d6226a 506
396f224b
HM
507## Gentoo
508
ab87af11
DK
5091. Add this to ``/etc/portage/sets/peertube``:
510
396f224b
HM
511```
512net-libs/nodejs
513sys-apps/yarn
514media-video/ffmpeg[x264] # Optionnally add vorbis,vpx
515dev-db/postgresql
516dev-db/redis
517dev-vcs/git
518app-arch/unzip
8182a370 519dev-lang/python
396f224b 520www-servers/nginx
396f224b 521
ab87af11 522# Optional, client for Let’s Encrypt:
396f224b 523# app-crypt/certbot
396f224b
HM
524```
525
ab87af11
DK
5262. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn:
527
bfc6bb94
W
528```
529mkdir -p /etc/portage/package.keywords
530cat << EOF >> /etc/portage/package.keywords/peertube
531# required by yarn (argument) for PeerTube
532sys-apps/yarn ~amd64
533EOF
534```
535
ab87af11
DK
5363. Compile the peertube set:
537
396f224b
HM
538```
539emerge -a @peertube
540```
541
ab87af11
DK
5424. Initialize the PostgreSQL database if you just merged it:
543
396f224b
HM
544```
545emerge --config postgresql
546```
547
ab87af11
DK
5485. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot):
549
396f224b
HM
550```
551rc-update add redis
c1109b45 552rc-update add postgresql-11
396f224b 553rc-service redis start
c1109b45 554rc-service postgresql-11 start
396f224b 555```
f309a156 556
80428d16
G
557## OpenBSD
558
5591. Install Packages:
560
561```
562pkg_add sudo bash wget git python nginx pkgconf postgresql-server postgresql-contrib redis openssl
563```
564
5652. Install yarn:
566
567```
568npm install --global yarn
569```
570
5713. Allow users in the wheel group to use sudo
572
573```
574visudo
575```
576Uncomment line #43:
577
578```
579%wheel ALL=(ALL) ALL
580```
581
5824. Enable services:
583
584```
585rcctl enable postgresql redis nginx
586```
587
afe81767 588## Other distributions
63bfad7e
C
589
590Feel free to update this file in a pull request!