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