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