]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - support/doc/dependencies.md
Bumped to version v5.2.1
[github/Chocobozzz/PeerTube.git] / support / doc / dependencies.md
... / ...
CommitLineData
1# Dependencies
2
3:warning: **Warning**: dependencies guide is maintained by the community. Some parts may be outdated! :warning:
4
5Main dependencies version supported by PeerTube:
6
7 * `node` >=16.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
361. 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
422. 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
443. 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)
464. 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
495. Install Python:
50
51On Ubuntu <= bionic (18.04 LTS) or Debian <= Buster:
52
53```
54sudo apt update
55sudo apt install python-dev
56python --version # Should be >= 2.x or >= 3.x
57```
58
59On Ubuntu >= focal (20.04 LTS) or Debian >= Bullseye:
60
61```
62sudo apt update
63sudo apt install python3-dev python-is-python3 # python-is-python2 should also work
64python --version # Should be >= 2.x or >= 3.x
65```
66
676. Install common dependencies:
68
69```
70sudo apt update
71sudo apt install certbot nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git cron wget
72ffmpeg -version # Should be >= 4.1
73g++ -v # Should be >= 5.x
74redis-server --version # Should be >= 6.x
75```
76
77Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
78
79```
80sudo systemctl start redis postgresql
81```
82
83## Arch Linux
84
851. Run:
86
87```
88sudo pacman -S nodejs-lts-fermium yarn ffmpeg postgresql openssl redis git wget unzip python base-devel npm nginx
89```
90
91Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
92
93```
94sudo systemctl start redis postgresql
95```
96
97## CentOS 7
98
991. 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
1022. Install yarn:
103[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
104
1053. 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
1104. Install Packages:
111
112```
113sudo yum update
114sudo yum install epel-release centos-release-scl
115sudo yum update
116sudo yum install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git devtoolset-7
117```
118
1195. 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```
122sudo scl enable devtoolset-7 bash
123```
124
125Later 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```
128sudo -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
1316. Initialize the PostgreSQL database:
132
133```
134sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
135```
136
137Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
138
139```
140sudo systemctl enable --now redis
141sudo systemctl enable --now postgresql
142```
143
144## Centos 8
145
1461. 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
1492. Install yarn:
150[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
151
1523. Install or compile ffmpeg:
153
154```
155sudo dnf install epel-release dnf-utils
156sudo yum-config-manager --set-enabled powertools
157sudo yum-config-manager --add-repo=https://negativo17.org/repos/epel-multimedia.repo
158sudo dnf install ffmpeg
159```
160
1614. Install packages:
162
163```
164sudo dnf update
165sudo dnf install epel-release
166sudo dnf update
167sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git unzip
168```
169
1705. You'll need a symlink for python3 to python for youtube-dl to work
171
172```
173sudo ln -s /usr/bin/python3 /usr/bin/python
174```
175
1766. Initialize the PostgreSQL database:
177
178```
179sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
180```
181
182Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
183
184```
185sudo systemctl enable --now redis
186sudo systemctl enable --now postgresql
187```
188
189## Rocky Linux 8.4
190
1911. Pull the latest updates:
192```
193sudo dnf update -y
194```
195
1962. Install NodeJS 16.x:
197```
198sudo dnf module install -y nodejs:16
199```
200
2013. Install yarn:
202```
203sudo npm install --global yarn
204```
205
2064. Install or compile ffmpeg (if you want to compile... enjoy):
207```
208sudo dnf install -y epel-release
209sudo dnf --enablerepo=powertools install -y SDL2 SDL2-devel
210sudo 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
211sudo dnf install -y ffmpeg
212sudo dnf update -y
213```
214
2155. Install PostgreSQL and Python3 and other stuff:
216```
217sudo dnf install -y nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git python3
218sudo ln -s /usr/bin/python3 /usr/bin/python
219sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
220sudo systemctl enable --now redis
221sudo systemctl enable --now postgresql
222```
223
2246. Configure the peertube user:
225```
226sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
227```
228
2297. 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
2371. Upgrade your packages:
238
239```
240dnf upgrade
241```
242
2432. Add a user with sudoers group access:
244
245```
246useradd my-peertube-user
247passwd my-peertube-user
248usermod my-peertube-user -a -G wheel # Add my-peertube-user to sudoers
249su my-peertube-user
250```
251
2523. (Optional) Install certbot (choose instructions for your distribution):
253[https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
254
2554. 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
2585. Install yarn:
259[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
260
2616. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
262
263```
264sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
265```
266This is necessary because `ffmpeg` is not in the Fedora repos.
267
2687. Run:
269
270```
271sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git vim
272ffmpeg -version # Should be >= 4.1
273g++ -v # Should be >= 5.x
274redis-server --version # Should be >= 6.x
275```
276
2778. Configure nginx
278
279```
280sudo mkdir /etc/nginx/sites-available
281sudo mkdir /etc/nginx/sites-enabled
282sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
283```
284
2859. 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
292sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
293sudo systemctl enable postgresql.service
294sudo systemctl start postgresql.service
295# Nginx
296sudo systemctl enable nginx.service
297sudo systemctl start nginx.service
298# Redis
299sudo systemctl enable redis.service
300sudo systemctl start redis.service
301```
302
30310. Firewall
304
305By 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```
309sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
310sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
311```
312- Optional
313
314```
315sudo firewall-cmd --permanent --zone=public --add-service=http
316sudo firewall-cmd --permanent --zone=public --add-service=https
317```
318
319- Reload firewall
320
321```
322sudo firewall-cmd --reload
323```
324
32511. Configure max ports
326
327This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
328
329```
330echo 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
3371. 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
3452. Install Node.JS
346
347```
348sudo dnf module install nodejs:16
349```
350
3513. Install Yarn
352
353```
354curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
355sudo dnf install yarn
356```
357
3584. Install FFmpeg
359
360```
361sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-$(arch)-rpms"
362sudo dnf install --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
363sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
364sudo dnf upgrade
365sudo dnf install ffmpeg
366```
367
3685. Run:
369
370```
371sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
372```
373
3746. You'll need a symlink for python3 to python for youtube-dl to work
375
376```
377sudo alternatives --set python3 /usr/bin/python
378```
379
3807. Initialize the PostgreSQL database:
381
382```
383sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
384```
385
386Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
387
388```
389sudo systemctl enable --now redis
390sudo systemctl enable --now postgresql
391```
392
393If 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
3958. Configure nginx
396
397```
398sudo mkdir /etc/nginx/sites-available
399sudo mkdir /etc/nginx/sites-enabled
400sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
401sudo systemctl enable --now nginx
402```
403
4049. Prepare directory
405
406To 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```
409sudo mkdir /var/www
410
411sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
412sudo passwd peertube
413
414sudo chmod 755 /var/www/peertube/
415```
416
41710. Firewall
418
419By 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```
423sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
424sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
425```
426- Optional
427
428```
429sudo firewall-cmd --permanent --zone=public --add-service=http
430sudo firewall-cmd --permanent --zone=public --add-service=https
431```
432
433- Reload firewall
434
435```
436sudo firewall-cmd --reload
437```
438
43911. Configure max ports
440
441This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
442
443```
444echo 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
452On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
453
4541. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed):
455
456```
457pkg
458pkg update
459pkg install -y sudo bash wget git python nginx pkgconf postgresql13-server postgresql13-contrib redis openssl node npm yarn ffmpeg unzip
460```
461
4622. 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
468Uncomment the line 90
469
470```
471%wheel ALL=(ALL) ALL
472```
473
4743. Enable nginx, redis, postgresql services and initialize database.
475
476```
477sysrc postgresql_enable="YES"
478sysrc redis_enable="YES"
479sysrc nginx_enable="YES"
480```
481
482Initialize database and start services
483
484```
485service postgresql initdb
486service postgresql start
487service redis start
488service nginx start
489```
490
491## macOS
492
4931. Add the packages:
494
495```sh
496brew install bash ffmpeg nginx postgresql openssl gcc make redis git yarn
497```
498
499You may need to update your default version of bash.
500
501**How to change your default shell**
502
503```sh
504which -a bash # Check where bash is installed
505bash --version # You need a version at least as recent as 4.0
506sudo vim /etc/shells # Add in this file : /usr/local/bin/bash
507chsh -s /usr/local/bin/bash # To set the brew-installed bash as default bash
508```
509
510In a new shell, type `bash --version` to assert your changes took effect and
511correctly modified your default bash version.
512
5132. Run the services:
514
515```sh
516brew services run postgresql
517brew services run redis
518```
519
520On macOS, the `postgresql` user can be `_postgres` instead of `postgres`.
521If `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
5251. Add this to ``/etc/portage/sets/peertube``:
526
527```
528net-libs/nodejs
529sys-apps/yarn
530media-video/ffmpeg[x264] # Optionally add vorbis,vpx
531dev-db/postgresql
532dev-db/redis
533dev-vcs/git
534app-arch/unzip
535dev-lang/python
536dev-lang/python-exec
537www-servers/nginx
538
539# Optional, client for Let’s Encrypt:
540# app-crypt/certbot
541```
542
5432. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn:
544
545```
546mkdir -p /etc/portage/package.keywords
547cat << EOF >> /etc/portage/package.keywords/peertube
548# required by yarn (argument) for PeerTube
549sys-apps/yarn ~amd64
550EOF
551```
552
5533. Compile the peertube set:
554
555```
556emerge -a @peertube
557```
558
5594. Initialize the PostgreSQL database if you just merged it:
560
561```
562emerge --config postgresql
563```
564
5655. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot):
566
567```
568rc-update add redis
569rc-update add postgresql-11
570rc-service redis start
571rc-service postgresql-11 start
572```
573
5746. Create Python version symlink for youtube-dl:
575
576```
577emerge -1 python-exec
578```
579
580## OpenBSD
581
5821. Install Packages:
583
584```
585pkg_add sudo bash wget git python nginx pkgconf postgresql-server postgresql-contrib redis openssl
586```
587
5882. Install yarn:
589
590```
591npm install --global yarn
592```
593
5943. Allow users in the wheel group to use sudo
595
596```
597visudo
598```
599Uncomment line #43:
600
601```
602%wheel ALL=(ALL) ALL
603```
604
6054. Enable services:
606
607```
608rcctl enable postgresql redis nginx
609```
610
611## Other distributions
612
613Feel free to update this file in a pull request!