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