]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - support/doc/dependencies.md
Don't use min FPS, throw instead
[github/Chocobozzz/PeerTube.git] / support / doc / dependencies.md
... / ...
CommitLineData
1# Dependencies
2
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`.
4
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
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
10- [Debian / Ubuntu and derivatives](#debian--ubuntu-and-derivatives)
11- [Arch Linux](#arch-linux)
12- [CentOS 7](#centos-7)
13- [Centos 8](#centos-8)
14- [Rocky Linux 8.4](#rocky-linux-84)
15- [Fedora](#fedora)
16- [Red Hat Enterprise Linux 8](#red-hat-enterprise-linux-8)
17- [FreeBSD](#freebsd)
18- [macOS](#macos)
19- [Gentoo](#gentoo)
20- [OpenBSD](#openbsd)
21- [Other distributions](#other-distributions)
22
23<!-- END doctoc generated TOC please keep comment here to allow auto update -->
24
25## Debian / Ubuntu and derivatives
26
271. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation
28
29```
30# apt-get install curl sudo unzip vim
31```
32
332. It would be wise to disable root access and to continue this tutorial with a user with sudoers group access
34
353. Install NodeJS 14.x:
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)
374. Install yarn, and be sure to have [a recent version](https://github.com/yarnpkg/yarn/releases/latest):
38[https://yarnpkg.com/en/docs/install#linux-tab](https://yarnpkg.com/en/docs/install#linux-tab)
39
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:
59
60```
61sudo apt update
62sudo apt install certbot nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git cron wget
63ffmpeg -version # Should be >= 4.1
64g++ -v # Should be >= 5.x
65```
66
67Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
68
69```
70sudo systemctl start redis postgresql
71```
72
73## Arch Linux
74
751. Run:
76
77```
78sudo pacman -S nodejs-lts-fermium yarn ffmpeg postgresql openssl redis git wget unzip python base-devel npm nginx
79```
80
81Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
82
83```
84sudo systemctl start redis postgresql
85```
86
87## CentOS 7
88
891. Install NodeJS 12.x:
90[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
91
922. Install yarn:
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
1004. Install Packages:
101
102```
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
107```
108
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
111```
112sudo scl enable devtoolset-7 bash
113```
114
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```
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
119```
120
1216. Initialize the PostgreSQL database:
122
123```
124sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
125```
126
127Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
128
129```
130sudo systemctl enable --now redis
131sudo systemctl enable --now postgresql
132```
133
134## Centos 8
135
1361. Install NodeJS 12.x:
137[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
138
1392. Install yarn:
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
1464. Install packages:
147
148```
149sudo dnf update
150sudo dnf install epel-release
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
1616. Initialize the PostgreSQL database:
162
163```
164sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
165```
166
167Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
168
169```
170sudo systemctl enable --now redis
171sudo systemctl enable --now postgresql
172```
173
174## Rocky Linux 8.4
175
1761. Pull the latest updates:
177```
178sudo dnf update -y
179```
180
1812. Install NodeJS 12.x (or 14):
182```
183sudo dnf module install -y nodejs:12
184```
185
1863. Install yarn:
187```
188sudo npm install --global yarn
189```
190
1914. Install or compile ffmpeg (if you want to compile... enjoy):
192```
193sudo dnf install -y epel-release
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:
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?
219
220## Fedora
221
2221. Upgrade your packages:
223
224```
225dnf upgrade
226```
227
2282. Add a user with sudoers group access:
229
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```
236
2373. (Optional) Install certbot (choose instructions for your distribution):
238[https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
239
2404. Install NodeJS 12.x:
241[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
242
2435. Install yarn:
244[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
245
2466. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
247
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
2537. Run:
254
255```
256sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git vim
257ffmpeg -version # Should be >= 4.1
258g++ -v # Should be >= 5.x
259```
260
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
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.
273
274```
275# PostgreSQL
276sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
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```
286
28710. Firewall
288
289By default, you cannot access your server via public IP. To do so, you must configure firewall:
290
291- Ports used by peertube dev setup:
292```
293sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
294sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
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```
413sudo firewall-cmd --permanent --zone=public --add-service=http
414sudo firewall-cmd --permanent --zone=public --add-service=https
415```
416
417- Reload firewall
418
419```
420sudo firewall-cmd --reload
421```
422
42311. Configure max ports
424
425This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
426
427```
428echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
429```
430
431[More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
432
433
434## FreeBSD
435
436On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
437
4381. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed):
439
440```
441pkg
442pkg update
443pkg install -y sudo bash wget git python nginx pkgconf postgresql13-server postgresql13-contrib redis openssl node npm yarn ffmpeg unzip
444```
445
4462. Allow users in the wheel group (hope you don't forgot to add your user on wheel group!) to use sudo.
447
448```
449# visudo
450```
451
452Uncomment the line 90
453
454```
455%wheel ALL=(ALL) ALL
456```
457
4583. Enable nginx, redis, postgresql services and initialize database.
459
460```
461sysrc postgresql_enable="YES"
462sysrc redis_enable="YES"
463sysrc nginx_enable="YES"
464```
465
466Initialize database and start services
467
468```
469service postgresql initdb
470service postgresql start
471service redis start
472service nginx start
473```
474
475## macOS
476
4771. Add the packages:
478
479```sh
480brew install bash ffmpeg nginx postgresql openssl gcc make redis git yarn
481```
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
492```
493
494In a new shell, type `bash --version` to assert your changes took effect and
495correctly modified your default bash version.
496
4972. Run the services:
498
499```sh
500brew services run postgresql
501brew services run redis
502```
503
504On macOS, the `postgresql` user can be `_postgres` instead of `postgres`.
505If `sudo -u postgres createuser -P peertube` gives you an `unknown user: postgres` error, you can try `sudo -u _postgres createuser -U peertube`.
506
507## Gentoo
508
5091. Add this to ``/etc/portage/sets/peertube``:
510
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
519dev-lang/python
520www-servers/nginx
521
522# Optional, client for Let’s Encrypt:
523# app-crypt/certbot
524```
525
5262. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn:
527
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
5363. Compile the peertube set:
537
538```
539emerge -a @peertube
540```
541
5424. Initialize the PostgreSQL database if you just merged it:
543
544```
545emerge --config postgresql
546```
547
5485. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot):
549
550```
551rc-update add redis
552rc-update add postgresql-11
553rc-service redis start
554rc-service postgresql-11 start
555```
556
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
588## Other distributions
589
590Feel free to update this file in a pull request!