]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - support/doc/dependencies.md
Don't force youtube-dl host
[github/Chocobozzz/PeerTube.git] / support / doc / dependencies.md
1 # Dependencies
2
3 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`.
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
27 1. 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
33 2. It would be wise to disable root access and to continue this tutorial with a user with sudoers group access
34
35 3. 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)
37 4. 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
40 5. Install Python:
41
42 On Ubuntu <= bionic (18.04 LTS) or Debian <= Buster:
43
44 ```
45 sudo apt update
46 sudo apt install python-dev
47 python --version # Should be >= 2.x or >= 3.x
48 ```
49
50 On Ubuntu >= focal (20.04 LTS) or Debian >= Bullseye:
51
52 ```
53 sudo apt update
54 sudo apt install python3-dev python-is-python3 # python-is-python2 should also work
55 python --version # Should be >= 2.x or >= 3.x
56 ```
57
58 6. Install common dependencies:
59
60 ```
61 sudo apt update
62 sudo apt install certbot nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git cron wget
63 ffmpeg -version # Should be >= 4.1
64 g++ -v # Should be >= 5.x
65 ```
66
67 Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
68
69 ```
70 sudo systemctl start redis postgresql
71 ```
72
73 ## Arch Linux
74
75 1. Run:
76
77 ```
78 sudo pacman -S nodejs-lts-fermium yarn ffmpeg postgresql openssl redis git wget unzip python base-devel npm nginx
79 ```
80
81 Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
82
83 ```
84 sudo systemctl start redis postgresql
85 ```
86
87 ## CentOS 7
88
89 1. 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
92 2. Install yarn:
93 [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
94
95 3. 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
100 4. Install Packages:
101
102 ```
103 sudo yum update
104 sudo yum install epel-release centos-release-scl
105 sudo yum update
106 sudo yum install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git devtoolset-7
107 ```
108
109 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.
110
111 ```
112 sudo scl enable devtoolset-7 bash
113 ```
114
115 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:
116
117 ```
118 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
119 ```
120
121 6. Initialize the PostgreSQL database:
122
123 ```
124 sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
125 ```
126
127 Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
128
129 ```
130 sudo systemctl enable --now redis
131 sudo systemctl enable --now postgresql
132 ```
133
134 ## Centos 8
135
136 1. 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
139 2. Install yarn:
140 [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
141
142 3. 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
146 4. Install packages:
147
148 ```
149 sudo dnf update
150 sudo dnf install epel-release
151 sudo dnf update
152 sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
153 ```
154
155 5. You'll need a symlink for python3 to python for youtube-dl to work
156
157 ```
158 sudo ln -s /usr/bin/python3 /usr/bin/python
159 ```
160
161 6. Initialize the PostgreSQL database:
162
163 ```
164 sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
165 ```
166
167 Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
168
169 ```
170 sudo systemctl enable --now redis
171 sudo systemctl enable --now postgresql
172 ```
173
174 ## Rocky Linux 8.4
175
176 1. Pull the latest updates:
177 ```
178 sudo dnf update -y
179 ```
180
181 2. Install NodeJS 12.x (or 14):
182 ```
183 sudo dnf module install -y nodejs:12
184 ```
185
186 3. Install yarn:
187 ```
188 sudo npm install --global yarn
189 ```
190
191 4. Install or compile ffmpeg (if you want to compile... enjoy):
192 ```
193 sudo dnf install -y epel-release
194 sudo dnf --enablerepo=powertools install -y SDL2 SDL2-devel
195 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
196 sudo dnf install -y ffmpeg
197 sudo dnf update -y
198 ```
199
200 5. Install PostgreSQL and Python3 and other stuff:
201 ```
202 sudo dnf install -y nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git python3
203 sudo ln -s /usr/bin/python3 /usr/bin/python
204 sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
205 sudo systemctl enable --now redis
206 sudo systemctl enable --now postgresql
207 ```
208
209 6. Configure the peertube user:
210 ```
211 sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
212 ```
213
214 7. 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
222 1. Upgrade your packages:
223
224 ```
225 dnf upgrade
226 ```
227
228 2. Add a user with sudoers group access:
229
230 ```
231 useradd my-peertube-user
232 passwd my-peertube-user
233 usermod my-peertube-user -a -G wheel # Add my-peertube-user to sudoers
234 su my-peertube-user
235 ```
236
237 3. (Optional) Install certbot (choose instructions for your distribution):
238 [https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
239
240 4. 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
243 5. Install yarn:
244 [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
245
246 6. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
247
248 ```
249 sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
250 ```
251 This is necessary because `ffmpeg` is not in the Fedora repos.
252
253 7. Run:
254
255 ```
256 sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git vim
257 ffmpeg -version # Should be >= 4.1
258 g++ -v # Should be >= 5.x
259 ```
260
261 8. Configure nginx
262
263 ```
264 sudo mkdir /etc/nginx/sites-available
265 sudo mkdir /etc/nginx/sites-enabled
266 sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
267 ```
268
269 9. 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
276 sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
277 sudo systemctl enable postgresql.service
278 sudo systemctl start postgresql.service
279 # Nginx
280 sudo systemctl enable nginx.service
281 sudo systemctl start nginx.service
282 # Redis
283 sudo systemctl enable redis.service
284 sudo systemctl start redis.service
285 ```
286
287 10. Firewall
288
289 By 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 ```
293 sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
294 sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
295 ```
296 - Optional
297
298 ```
299 sudo firewall-cmd --permanent --zone=public --add-service=http
300 sudo firewall-cmd --permanent --zone=public --add-service=https
301 ```
302
303 - Reload firewall
304
305 ```
306 sudo firewall-cmd --reload
307 ```
308
309 11. Configure max ports
310
311 This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
312
313 ```
314 echo 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
321 1. 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
329 2. Install Node.JS
330
331 ```
332 sudo dnf module install nodejs:12
333 ```
334
335 3. Install Yarn
336
337 ```
338 curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
339 sudo dnf install yarn
340 ```
341
342 4. Install FFmpeg
343
344 ```
345 sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-$(arch)-rpms"
346 sudo dnf install --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
347 sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
348 sudo dnf upgrade
349 sudo dnf install ffmpeg
350 ```
351
352 5. Run:
353
354 ```
355 sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
356 ```
357
358 6. You'll need a symlink for python3 to python for youtube-dl to work
359
360 ```
361 sudo ln -s /usr/bin/python3 /usr/bin/python
362 ```
363
364 7. Initialize the PostgreSQL database:
365
366 ```
367 sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
368 ```
369
370 Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
371
372 ```
373 sudo systemctl enable --now redis
374 sudo systemctl enable --now postgresql
375 ```
376
377 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:
378
379 8. Configure nginx
380
381 ```
382 sudo mkdir /etc/nginx/sites-available
383 sudo mkdir /etc/nginx/sites-enabled
384 sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
385 sudo systemctl enable --now nginx
386 ```
387
388 9. Prepare directory
389
390 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.
391
392 ```
393 sudo mkdir /var/www
394
395 sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
396 sudo passwd peertube
397
398 sudo chmod 755 /var/www/peertube/
399 ```
400
401 10. Firewall
402
403 By 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 ```
407 sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
408 sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
409 ```
410 - Optional
411
412 ```
413 sudo firewall-cmd --permanent --zone=public --add-service=http
414 sudo firewall-cmd --permanent --zone=public --add-service=https
415 ```
416
417 - Reload firewall
418
419 ```
420 sudo firewall-cmd --reload
421 ```
422
423 11. Configure max ports
424
425 This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
426
427 ```
428 echo 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
436 On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
437
438 1. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed):
439
440 ```
441 pkg
442 pkg update
443 pkg install -y sudo bash wget git python nginx pkgconf postgresql13-server postgresql13-contrib redis openssl node npm yarn ffmpeg unzip
444 ```
445
446 2. 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
452 Uncomment the line 90
453
454 ```
455 %wheel ALL=(ALL) ALL
456 ```
457
458 3. Enable nginx, redis, postgresql services and initialize database.
459
460 ```
461 sysrc postgresql_enable="YES"
462 sysrc redis_enable="YES"
463 sysrc nginx_enable="YES"
464 ```
465
466 Initialize database and start services
467
468 ```
469 service postgresql initdb
470 service postgresql start
471 service redis start
472 service nginx start
473 ```
474
475 ## macOS
476
477 1. Add the packages:
478
479 ```sh
480 brew install bash ffmpeg nginx postgresql openssl gcc make redis git yarn
481 ```
482
483 You may need to update your default version of bash.
484
485 **How to change your default shell**
486
487 ```sh
488 which -a bash # Check where bash is installed
489 bash --version # You need a version at least as recent as 4.0
490 sudo vim /etc/shells # Add in this file : /usr/local/bin/bash
491 chsh -s /usr/local/bin/bash # To set the brew-installed bash as default bash
492 ```
493
494 In a new shell, type `bash --version` to assert your changes took effect and
495 correctly modified your default bash version.
496
497 2. Run the services:
498
499 ```sh
500 brew services run postgresql
501 brew services run redis
502 ```
503
504 On macOS, the `postgresql` user can be `_postgres` instead of `postgres`.
505 If `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
509 1. Add this to ``/etc/portage/sets/peertube``:
510
511 ```
512 net-libs/nodejs
513 sys-apps/yarn
514 media-video/ffmpeg[x264] # Optionnally add vorbis,vpx
515 dev-db/postgresql
516 dev-db/redis
517 dev-vcs/git
518 app-arch/unzip
519 dev-lang/python
520 www-servers/nginx
521
522 # Optional, client for Let’s Encrypt:
523 # app-crypt/certbot
524 ```
525
526 2. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn:
527
528 ```
529 mkdir -p /etc/portage/package.keywords
530 cat << EOF >> /etc/portage/package.keywords/peertube
531 # required by yarn (argument) for PeerTube
532 sys-apps/yarn ~amd64
533 EOF
534 ```
535
536 3. Compile the peertube set:
537
538 ```
539 emerge -a @peertube
540 ```
541
542 4. Initialize the PostgreSQL database if you just merged it:
543
544 ```
545 emerge --config postgresql
546 ```
547
548 5. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot):
549
550 ```
551 rc-update add redis
552 rc-update add postgresql-11
553 rc-service redis start
554 rc-service postgresql-11 start
555 ```
556
557 ## OpenBSD
558
559 1. Install Packages:
560
561 ```
562 pkg_add sudo bash wget git python nginx pkgconf postgresql-server postgresql-contrib redis openssl
563 ```
564
565 2. Install yarn:
566
567 ```
568 npm install --global yarn
569 ```
570
571 3. Allow users in the wheel group to use sudo
572
573 ```
574 visudo
575 ```
576 Uncomment line #43:
577
578 ```
579 %wheel ALL=(ALL) ALL
580 ```
581
582 4. Enable services:
583
584 ```
585 rcctl enable postgresql redis nginx
586 ```
587
588 ## Other distributions
589
590 Feel free to update this file in a pull request!