]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - support/doc/dependencies.md
Pointer to Debian guide on how to add a sudo user
[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
5Main dependencies version supported by PeerTube:
6
7 * `node` >=14.x
8 * `yarn` >=1.x
9 * `postgres` >=10.x
10 * `redis-server` >=5.x
aca96f80 11 * `ffmpeg` >=4.3
9ef3aeac 12
867ed651 13
c9b36909
RK
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
92340699
RK
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
3e2b75ee 19- [Debian / Ubuntu and derivatives](#debian-ubuntu-and-derivatives)
92340699
RK
20- [Arch Linux](#arch-linux)
21- [CentOS 7](#centos-7)
4d557df5
C
22- [Centos 8](#centos-8)
23- [Rocky Linux 8.4](#rocky-linux-84)
92340699 24- [Fedora](#fedora)
4d557df5 25- [Red Hat Enterprise Linux 8](#red-hat-enterprise-linux-8)
92340699
RK
26- [FreeBSD](#freebsd)
27- [macOS](#macos)
28- [Gentoo](#gentoo)
4d557df5 29- [OpenBSD](#openbsd)
92340699
RK
30- [Other distributions](#other-distributions)
31
32<!-- END doctoc generated TOC please keep comment here to allow auto update -->
33
e5203ffa 34## Debian / Ubuntu and derivatives
ab87af11
DK
35
361. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation
955f14a4 37
bc2fc1a7 38```
99402413 39# apt-get install curl sudo unzip vim
bc2fc1a7 40```
955f14a4 41
c092b863 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).
ab87af11 43
a3de59ab 443. Install NodeJS 16.x:
ab87af11 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)
d8658f0f 464. Install yarn, and be sure to have [a recent version](https://github.com/yarnpkg/yarn/releases/latest):
ab87af11 47[https://yarnpkg.com/en/docs/install#linux-tab](https://yarnpkg.com/en/docs/install#linux-tab)
63bfad7e 48
4d557df5
C
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:
63bfad7e 68
afe81767 69```
ab87af11 70sudo apt update
4d557df5 71sudo apt install certbot nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git cron wget
f309a156 72ffmpeg -version # Should be >= 4.1
ab87af11 73g++ -v # Should be >= 5.x
9ef3aeac 74redis-server --version # Should be >= 5.x
63bfad7e
C
75```
76
81cdf382 77Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
ab87af11 78
81cdf382 79```
ab87af11 80sudo systemctl start redis postgresql
81cdf382
RK
81```
82
afe81767 83## Arch Linux
63bfad7e 84
ab87af11 851. Run:
63bfad7e 86
afe81767 87```
4ff75a3b 88sudo pacman -S nodejs-lts-fermium yarn ffmpeg postgresql openssl redis git wget unzip python base-devel npm nginx
63bfad7e
C
89```
90
81cdf382 91Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
ab87af11 92
81cdf382 93```
ab87af11 94sudo systemctl start redis postgresql
81cdf382
RK
95```
96
053ad3a3
EC
97## CentOS 7
98
a3de59ab 991. Install NodeJS 16.x:
ab87af11
DK
100[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
101
f309a156 1022. Install yarn:
ab87af11
DK
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
f309a156 1104. Install Packages:
053ad3a3
EC
111
112```
ab87af11
DK
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
0414ed10
O
117```
118
ab87af11
DK
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
4c86a254 121```
ab87af11 122sudo scl enable devtoolset-7 bash
053ad3a3
EC
123```
124
d4557fd3
RK
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```
ab87af11 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
d4557fd3
RK
129```
130
f309a156 1316. Initialize the PostgreSQL database:
ab87af11 132
f60e85ce 133```
39072b2f 134sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
f60e85ce
W
135```
136
f309a156 137Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
ab87af11 138
81cdf382 139```
a075cd00
CGI
140sudo systemctl enable --now redis
141sudo systemctl enable --now postgresql
81cdf382
RK
142```
143
a075cd00
CGI
144## Centos 8
145
a3de59ab 1461. Install NodeJS 16.x:
a075cd00
CGI
147[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
148
f309a156 1492. Install yarn:
a075cd00
CGI
150[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
151
1523. Install or compile ffmpeg:
153
383dbdec 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```
a075cd00 160
f309a156 1614. Install packages:
a075cd00
CGI
162
163```
164sudo dnf update
f309a156 165sudo dnf install epel-release
a075cd00 166sudo dnf update
383dbdec 167sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git unzip
a075cd00
CGI
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
f309a156 1766. Initialize the PostgreSQL database:
a075cd00
CGI
177
178```
39072b2f 179sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
a075cd00
CGI
180```
181
f309a156 182Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
a075cd00
CGI
183
184```
185sudo systemctl enable --now redis
186sudo systemctl enable --now postgresql
187```
188
d35f3a86 189## Rocky Linux 8.4
f68d1cb6 190
d35f3a86 1911. Pull the latest updates:
f68d1cb6
W
192```
193sudo dnf update -y
194```
195
a3de59ab 1962. Install NodeJS 16.x:
f68d1cb6 197```
a3de59ab 198sudo dnf module install -y nodejs:16
f68d1cb6
W
199```
200
d35f3a86 2013. Install yarn:
f68d1cb6
W
202```
203sudo npm install --global yarn
204```
205
d35f3a86 2064. Install or compile ffmpeg (if you want to compile... enjoy):
f68d1cb6 207```
d35f3a86 208sudo dnf install -y epel-release
f68d1cb6
W
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:
d35f3a86
C
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?
a075cd00 234
0a314a99 235## Fedora
236
ab87af11
DK
2371. Upgrade your packages:
238
0a314a99 239```
240dnf upgrade
241```
ab87af11
DK
242
2432. Add a user with sudoers group access:
244
0a314a99 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```
ab87af11 251
d8658f0f 2523. (Optional) Install certbot (choose instructions for your distribution):
0a314a99 253[https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
ab87af11 254
a3de59ab 2554. Install NodeJS 16.x:
0a314a99 256[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
ab87af11 257
f309a156 2585. Install yarn:
0a314a99 259[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
ab87af11
DK
260
2616. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
262
0a314a99 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
ab87af11
DK
2687. Run:
269
0a314a99 270```
39072b2f 271sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git vim
f309a156 272ffmpeg -version # Should be >= 4.1
0a314a99 273g++ -v # Should be >= 5.x
9ef3aeac 274redis-server --version # Should be >= 5.x
0a314a99 275```
ab87af11 276
8182a370
FS
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
0a314a99 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.
ab87af11 289
0a314a99 290```
291# PostgreSQL
39072b2f 292sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
0a314a99 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```
ab87af11 302
8182a370 30310. Firewall
0a314a99 304
51c35447 305By default, you cannot access your server via public IP. To do so, you must configure firewall:
ab87af11 306
644800ef 307- Ports used by peertube dev setup:
0a314a99 308```
0a314a99 309sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
310sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
644800ef
FS
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```
a3de59ab 348sudo dnf module install nodejs:16
644800ef
FS
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```
3a63b110 377sudo alternatives --set python3 /usr/bin/python
644800ef
FS
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```
0a314a99 429sudo firewall-cmd --permanent --zone=public --add-service=http
430sudo firewall-cmd --permanent --zone=public --add-service=https
644800ef
FS
431```
432
433- Reload firewall
434
435```
0a314a99 436sudo firewall-cmd --reload
437```
0a314a99 438
8182a370 43911. Configure max ports
ab87af11 440
f309a156 441This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
ab87af11 442
0a314a99 443```
444echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
445```
ab87af11 446
0a314a99 447[More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
448
644800ef 449
4c86a254
GN
450## FreeBSD
451
452On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
453
f309a156 4541. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed):
ab87af11 455
4c86a254 456```
ab87af11
DK
457pkg
458pkg update
f6160062 459pkg install -y sudo bash wget git python nginx pkgconf postgresql13-server postgresql13-contrib redis openssl node npm yarn ffmpeg unzip
4c86a254
GN
460```
461
f309a156 4622. Allow users in the wheel group (hope you don't forgot to add your user on wheel group!) to use sudo.
ab87af11 463
4c86a254
GN
464```
465# visudo
466```
467
ab87af11 468Uncomment the line 90
f309a156 469
4c86a254
GN
470```
471%wheel ALL=(ALL) ALL
472```
473
f309a156 4743. Enable nginx, redis, postgresql services and initialize database.
4c86a254 475
4c86a254 476```
ab87af11
DK
477sysrc postgresql_enable="YES"
478sysrc redis_enable="YES"
479sysrc nginx_enable="YES"
4c86a254
GN
480```
481
ab87af11
DK
482Initialize database and start services
483
4c86a254 484```
ab87af11
DK
485service postgresql initdb
486service postgresql start
487service redis start
488service nginx start
4c86a254
GN
489```
490
2f7ac618 491## macOS
2f7ac618 492
ab87af11
DK
4931. Add the packages:
494
02d6226a
AV
495```sh
496brew install bash ffmpeg nginx postgresql openssl gcc make redis git yarn
ab87af11 497```
02d6226a
AV
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
ab87af11
DK
508```
509
d35f3a86 510In a new shell, type `bash --version` to assert your changes took effect and
02d6226a
AV
511correctly modified your default bash version.
512
ab87af11 5132. Run the services:
2f7ac618 514
02d6226a 515```sh
ab87af11
DK
516brew services run postgresql
517brew services run redis
518```
396f224b 519
02d6226a 520On macOS, the `postgresql` user can be `_postgres` instead of `postgres`.
ddc7d3ec 521If `sudo -u postgres createuser -P peertube` gives you an `unknown user: postgres` error, you can try `sudo -u _postgres createuser -U peertube`.
02d6226a 522
396f224b
HM
523## Gentoo
524
ab87af11
DK
5251. Add this to ``/etc/portage/sets/peertube``:
526
396f224b
HM
527```
528net-libs/nodejs
529sys-apps/yarn
7a4fd56c 530media-video/ffmpeg[x264] # Optionally add vorbis,vpx
396f224b
HM
531dev-db/postgresql
532dev-db/redis
533dev-vcs/git
534app-arch/unzip
8182a370 535dev-lang/python
a232d3e5 536dev-lang/python-exec
396f224b 537www-servers/nginx
396f224b 538
ab87af11 539# Optional, client for Let’s Encrypt:
396f224b 540# app-crypt/certbot
396f224b
HM
541```
542
ab87af11
DK
5432. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn:
544
bfc6bb94
W
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
ab87af11
DK
5533. Compile the peertube set:
554
396f224b
HM
555```
556emerge -a @peertube
557```
558
ab87af11
DK
5594. Initialize the PostgreSQL database if you just merged it:
560
396f224b
HM
561```
562emerge --config postgresql
563```
564
ab87af11
DK
5655. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot):
566
396f224b
HM
567```
568rc-update add redis
c1109b45 569rc-update add postgresql-11
396f224b 570rc-service redis start
c1109b45 571rc-service postgresql-11 start
396f224b 572```
f309a156 573
32e06ca4 5746. Create Python version symlink for youtube-dl:
575
576```
a232d3e5 577emerge -1 python-exec
32e06ca4 578```
579
80428d16
G
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
afe81767 611## Other distributions
63bfad7e
C
612
613Feel free to update this file in a pull request!