]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - support/doc/dependencies.md
Translated using Weblate (Croatian)
[github/Chocobozzz/PeerTube.git] / support / doc / dependencies.md
CommitLineData
afe81767 1# Dependencies
63bfad7e 2
461bcc1a
S
3:warning: **Warning**: dependencies guide is maintained by the community. Some parts may be outdated! :warning:
4
3dd6d6cd 5Follow 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`.
867ed651 6
c9b36909
RK
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
92340699
RK
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
3e2b75ee 12- [Debian / Ubuntu and derivatives](#debian-ubuntu-and-derivatives)
92340699
RK
13- [Arch Linux](#arch-linux)
14- [CentOS 7](#centos-7)
4d557df5
C
15- [Centos 8](#centos-8)
16- [Rocky Linux 8.4](#rocky-linux-84)
92340699 17- [Fedora](#fedora)
4d557df5 18- [Red Hat Enterprise Linux 8](#red-hat-enterprise-linux-8)
92340699
RK
19- [FreeBSD](#freebsd)
20- [macOS](#macos)
21- [Gentoo](#gentoo)
4d557df5 22- [OpenBSD](#openbsd)
92340699
RK
23- [Other distributions](#other-distributions)
24
25<!-- END doctoc generated TOC please keep comment here to allow auto update -->
26
e5203ffa 27## Debian / Ubuntu and derivatives
ab87af11
DK
28
291. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation
955f14a4 30
bc2fc1a7 31```
99402413 32# apt-get install curl sudo unzip vim
bc2fc1a7 33```
955f14a4 34
ab87af11
DK
352. It would be wise to disable root access and to continue this tutorial with a user with sudoers group access
36
1d840011 373. Install NodeJS 14.x:
ab87af11 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)
d8658f0f 394. Install yarn, and be sure to have [a recent version](https://github.com/yarnpkg/yarn/releases/latest):
ab87af11 40[https://yarnpkg.com/en/docs/install#linux-tab](https://yarnpkg.com/en/docs/install#linux-tab)
63bfad7e 41
4d557df5
C
425. Install Python:
43
44On Ubuntu <= bionic (18.04 LTS) or Debian <= Buster:
45
46```
47sudo apt update
48sudo apt install python-dev
49python --version # Should be >= 2.x or >= 3.x
50```
51
52On Ubuntu >= focal (20.04 LTS) or Debian >= Bullseye:
53
54```
55sudo apt update
56sudo apt install python3-dev python-is-python3 # python-is-python2 should also work
57python --version # Should be >= 2.x or >= 3.x
58```
59
606. Install common dependencies:
63bfad7e 61
afe81767 62```
ab87af11 63sudo apt update
4d557df5 64sudo apt install certbot nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git cron wget
f309a156 65ffmpeg -version # Should be >= 4.1
ab87af11 66g++ -v # Should be >= 5.x
63bfad7e
C
67```
68
81cdf382 69Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
ab87af11 70
81cdf382 71```
ab87af11 72sudo systemctl start redis postgresql
81cdf382
RK
73```
74
afe81767 75## Arch Linux
63bfad7e 76
ab87af11 771. Run:
63bfad7e 78
afe81767 79```
4ff75a3b 80sudo pacman -S nodejs-lts-fermium yarn ffmpeg postgresql openssl redis git wget unzip python base-devel npm nginx
63bfad7e
C
81```
82
81cdf382 83Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
ab87af11 84
81cdf382 85```
ab87af11 86sudo systemctl start redis postgresql
81cdf382
RK
87```
88
053ad3a3
EC
89## CentOS 7
90
4ff75a3b 911. Install NodeJS 14.x:
ab87af11
DK
92[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
93
f309a156 942. Install yarn:
ab87af11
DK
95[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
96
973. 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
f309a156 1024. Install Packages:
053ad3a3
EC
103
104```
ab87af11
DK
105sudo yum update
106sudo yum install epel-release centos-release-scl
107sudo yum update
108sudo yum install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git devtoolset-7
0414ed10
O
109```
110
ab87af11
DK
1115. 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
4c86a254 113```
ab87af11 114sudo scl enable devtoolset-7 bash
053ad3a3
EC
115```
116
d4557fd3
RK
117Later 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```
ab87af11 120sudo -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
d4557fd3
RK
121```
122
f309a156 1236. Initialize the PostgreSQL database:
ab87af11 124
f60e85ce 125```
39072b2f 126sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
f60e85ce
W
127```
128
f309a156 129Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
ab87af11 130
81cdf382 131```
a075cd00
CGI
132sudo systemctl enable --now redis
133sudo systemctl enable --now postgresql
81cdf382
RK
134```
135
a075cd00
CGI
136## Centos 8
137
4ff75a3b 1381. Install NodeJS 14.x:
a075cd00
CGI
139[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
140
f309a156 1412. Install yarn:
a075cd00
CGI
142[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
143
1443. Install or compile ffmpeg:
145
383dbdec 146```
147sudo dnf install epel-release dnf-utils
148sudo yum-config-manager --set-enabled powertools
149sudo yum-config-manager --add-repo=https://negativo17.org/repos/epel-multimedia.repo
150sudo dnf install ffmpeg
151```
a075cd00 152
f309a156 1534. Install packages:
a075cd00
CGI
154
155```
156sudo dnf update
f309a156 157sudo dnf install epel-release
a075cd00 158sudo dnf update
383dbdec 159sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git unzip
a075cd00
CGI
160```
161
1625. You'll need a symlink for python3 to python for youtube-dl to work
163
164```
165sudo ln -s /usr/bin/python3 /usr/bin/python
166```
167
f309a156 1686. Initialize the PostgreSQL database:
a075cd00
CGI
169
170```
39072b2f 171sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
a075cd00
CGI
172```
173
f309a156 174Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
a075cd00
CGI
175
176```
177sudo systemctl enable --now redis
178sudo systemctl enable --now postgresql
179```
180
d35f3a86 181## Rocky Linux 8.4
f68d1cb6 182
d35f3a86 1831. Pull the latest updates:
f68d1cb6
W
184```
185sudo dnf update -y
186```
187
4ff75a3b 1882. Install NodeJS 14.x:
f68d1cb6 189```
4ff75a3b 190sudo dnf module install -y nodejs:14
f68d1cb6
W
191```
192
d35f3a86 1933. Install yarn:
f68d1cb6
W
194```
195sudo npm install --global yarn
196```
197
d35f3a86 1984. Install or compile ffmpeg (if you want to compile... enjoy):
f68d1cb6 199```
d35f3a86 200sudo dnf install -y epel-release
f68d1cb6
W
201sudo dnf --enablerepo=powertools install -y SDL2 SDL2-devel
202sudo 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
203sudo dnf install -y ffmpeg
204sudo dnf update -y
205```
206
2075. Install PostgreSQL and Python3 and other stuff:
208```
209sudo dnf install -y nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git python3
210sudo ln -s /usr/bin/python3 /usr/bin/python
211sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
212sudo systemctl enable --now redis
213sudo systemctl enable --now postgresql
214```
215
2166. Configure the peertube user:
217```
218sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
219```
220
2217. Unknown missing steps:
d35f3a86
C
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?
a075cd00 226
0a314a99 227## Fedora
228
ab87af11
DK
2291. Upgrade your packages:
230
0a314a99 231```
232dnf upgrade
233```
ab87af11
DK
234
2352. Add a user with sudoers group access:
236
0a314a99 237```
238useradd my-peertube-user
239passwd my-peertube-user
240usermod my-peertube-user -a -G wheel # Add my-peertube-user to sudoers
241su my-peertube-user
242```
ab87af11 243
d8658f0f 2443. (Optional) Install certbot (choose instructions for your distribution):
0a314a99 245[https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
ab87af11 246
4ff75a3b 2474. Install NodeJS 14.x:
0a314a99 248[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
ab87af11 249
f309a156 2505. Install yarn:
0a314a99 251[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
ab87af11
DK
252
2536. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
254
0a314a99 255```
256sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
257```
258This is necessary because `ffmpeg` is not in the Fedora repos.
259
ab87af11
DK
2607. Run:
261
0a314a99 262```
39072b2f 263sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git vim
f309a156 264ffmpeg -version # Should be >= 4.1
0a314a99 265g++ -v # Should be >= 5.x
266```
ab87af11 267
8182a370
FS
2688. Configure nginx
269
270```
271sudo mkdir /etc/nginx/sites-available
272sudo mkdir /etc/nginx/sites-enabled
273sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
274```
275
2769. Post-installation
0a314a99 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.
ab87af11 280
0a314a99 281```
282# PostgreSQL
39072b2f 283sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
0a314a99 284sudo systemctl enable postgresql.service
285sudo systemctl start postgresql.service
286# Nginx
287sudo systemctl enable nginx.service
288sudo systemctl start nginx.service
289# Redis
290sudo systemctl enable redis.service
291sudo systemctl start redis.service
292```
ab87af11 293
8182a370 29410. Firewall
0a314a99 295
51c35447 296By default, you cannot access your server via public IP. To do so, you must configure firewall:
ab87af11 297
644800ef 298- Ports used by peertube dev setup:
0a314a99 299```
0a314a99 300sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
301sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
644800ef
FS
302```
303- Optional
304
305```
306sudo firewall-cmd --permanent --zone=public --add-service=http
307sudo firewall-cmd --permanent --zone=public --add-service=https
308```
309
310- Reload firewall
311
312```
313sudo firewall-cmd --reload
314```
315
31611. Configure max ports
317
318This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
319
320```
321echo 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
3281. 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
3362. Install Node.JS
337
338```
4ff75a3b 339sudo dnf module install nodejs:14
644800ef
FS
340```
341
3423. Install Yarn
343
344```
345curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
346sudo dnf install yarn
347```
348
3494. Install FFmpeg
350
351```
352sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-$(arch)-rpms"
353sudo dnf install --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
354sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
355sudo dnf upgrade
356sudo dnf install ffmpeg
357```
358
3595. Run:
360
361```
362sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
363```
364
3656. You'll need a symlink for python3 to python for youtube-dl to work
366
367```
3a63b110 368sudo alternatives --set python3 /usr/bin/python
644800ef
FS
369```
370
3717. Initialize the PostgreSQL database:
372
373```
374sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
375```
376
377Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
378
379```
380sudo systemctl enable --now redis
381sudo systemctl enable --now postgresql
382```
383
384If 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
3868. Configure nginx
387
388```
389sudo mkdir /etc/nginx/sites-available
390sudo mkdir /etc/nginx/sites-enabled
391sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
392sudo systemctl enable --now nginx
393```
394
3959. Prepare directory
396
397To 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```
400sudo mkdir /var/www
401
402sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
403sudo passwd peertube
404
405sudo chmod 755 /var/www/peertube/
406```
407
40810. Firewall
409
410By 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```
414sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
415sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
416```
417- Optional
418
419```
0a314a99 420sudo firewall-cmd --permanent --zone=public --add-service=http
421sudo firewall-cmd --permanent --zone=public --add-service=https
644800ef
FS
422```
423
424- Reload firewall
425
426```
0a314a99 427sudo firewall-cmd --reload
428```
0a314a99 429
8182a370 43011. Configure max ports
ab87af11 431
f309a156 432This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
ab87af11 433
0a314a99 434```
435echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
436```
ab87af11 437
0a314a99 438[More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
439
644800ef 440
4c86a254
GN
441## FreeBSD
442
443On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
444
f309a156 4451. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed):
ab87af11 446
4c86a254 447```
ab87af11
DK
448pkg
449pkg update
f6160062 450pkg install -y sudo bash wget git python nginx pkgconf postgresql13-server postgresql13-contrib redis openssl node npm yarn ffmpeg unzip
4c86a254
GN
451```
452
f309a156 4532. Allow users in the wheel group (hope you don't forgot to add your user on wheel group!) to use sudo.
ab87af11 454
4c86a254
GN
455```
456# visudo
457```
458
ab87af11 459Uncomment the line 90
f309a156 460
4c86a254
GN
461```
462%wheel ALL=(ALL) ALL
463```
464
f309a156 4653. Enable nginx, redis, postgresql services and initialize database.
4c86a254 466
4c86a254 467```
ab87af11
DK
468sysrc postgresql_enable="YES"
469sysrc redis_enable="YES"
470sysrc nginx_enable="YES"
4c86a254
GN
471```
472
ab87af11
DK
473Initialize database and start services
474
4c86a254 475```
ab87af11
DK
476service postgresql initdb
477service postgresql start
478service redis start
479service nginx start
4c86a254
GN
480```
481
2f7ac618 482## macOS
2f7ac618 483
ab87af11
DK
4841. Add the packages:
485
02d6226a
AV
486```sh
487brew install bash ffmpeg nginx postgresql openssl gcc make redis git yarn
ab87af11 488```
02d6226a
AV
489
490You may need to update your default version of bash.
491
492**How to change your default shell**
493
494```sh
495which -a bash # Check where bash is installed
496bash --version # You need a version at least as recent as 4.0
497sudo vim /etc/shells # Add in this file : /usr/local/bin/bash
498chsh -s /usr/local/bin/bash # To set the brew-installed bash as default bash
ab87af11
DK
499```
500
d35f3a86 501In a new shell, type `bash --version` to assert your changes took effect and
02d6226a
AV
502correctly modified your default bash version.
503
ab87af11 5042. Run the services:
2f7ac618 505
02d6226a 506```sh
ab87af11
DK
507brew services run postgresql
508brew services run redis
509```
396f224b 510
02d6226a 511On macOS, the `postgresql` user can be `_postgres` instead of `postgres`.
ddc7d3ec 512If `sudo -u postgres createuser -P peertube` gives you an `unknown user: postgres` error, you can try `sudo -u _postgres createuser -U peertube`.
02d6226a 513
396f224b
HM
514## Gentoo
515
ab87af11
DK
5161. Add this to ``/etc/portage/sets/peertube``:
517
396f224b
HM
518```
519net-libs/nodejs
520sys-apps/yarn
7a4fd56c 521media-video/ffmpeg[x264] # Optionally add vorbis,vpx
396f224b
HM
522dev-db/postgresql
523dev-db/redis
524dev-vcs/git
525app-arch/unzip
8182a370 526dev-lang/python
a232d3e5 527dev-lang/python-exec
396f224b 528www-servers/nginx
396f224b 529
ab87af11 530# Optional, client for Let’s Encrypt:
396f224b 531# app-crypt/certbot
396f224b
HM
532```
533
ab87af11
DK
5342. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn:
535
bfc6bb94
W
536```
537mkdir -p /etc/portage/package.keywords
538cat << EOF >> /etc/portage/package.keywords/peertube
539# required by yarn (argument) for PeerTube
540sys-apps/yarn ~amd64
541EOF
542```
543
ab87af11
DK
5443. Compile the peertube set:
545
396f224b
HM
546```
547emerge -a @peertube
548```
549
ab87af11
DK
5504. Initialize the PostgreSQL database if you just merged it:
551
396f224b
HM
552```
553emerge --config postgresql
554```
555
ab87af11
DK
5565. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot):
557
396f224b
HM
558```
559rc-update add redis
c1109b45 560rc-update add postgresql-11
396f224b 561rc-service redis start
c1109b45 562rc-service postgresql-11 start
396f224b 563```
f309a156 564
32e06ca4 5656. Create Python version symlink for youtube-dl:
566
567```
a232d3e5 568emerge -1 python-exec
32e06ca4 569```
570
80428d16
G
571## OpenBSD
572
5731. Install Packages:
574
575```
576pkg_add sudo bash wget git python nginx pkgconf postgresql-server postgresql-contrib redis openssl
577```
578
5792. Install yarn:
580
581```
582npm install --global yarn
583```
584
5853. Allow users in the wheel group to use sudo
586
587```
588visudo
589```
590Uncomment line #43:
591
592```
593%wheel ALL=(ALL) ALL
594```
595
5964. Enable services:
597
598```
599rcctl enable postgresql redis nginx
600```
601
afe81767 602## Other distributions
63bfad7e
C
603
604Feel free to update this file in a pull request!