]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - support/doc/dependencies.md
Add ability to delete history element
[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
92340699
RK
12- [Debian / Ubuntu and derivatives](#debian--ubuntu-and-derivatives)
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
146* Install - [https://linuxize.com/post/how-to-install-ffmpeg-on-centos-8/](https://linuxize.com/post/how-to-install-ffmpeg-on-centos-8/)
147
f309a156 1484. Install packages:
a075cd00
CGI
149
150```
151sudo dnf update
f309a156 152sudo dnf install epel-release
a075cd00
CGI
153sudo dnf update
154sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
155```
156
1575. You'll need a symlink for python3 to python for youtube-dl to work
158
159```
160sudo ln -s /usr/bin/python3 /usr/bin/python
161```
162
f309a156 1636. Initialize the PostgreSQL database:
a075cd00
CGI
164
165```
39072b2f 166sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
a075cd00
CGI
167```
168
f309a156 169Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
a075cd00
CGI
170
171```
172sudo systemctl enable --now redis
173sudo systemctl enable --now postgresql
174```
175
d35f3a86 176## Rocky Linux 8.4
f68d1cb6 177
d35f3a86 1781. Pull the latest updates:
f68d1cb6
W
179```
180sudo dnf update -y
181```
182
4ff75a3b 1832. Install NodeJS 14.x:
f68d1cb6 184```
4ff75a3b 185sudo dnf module install -y nodejs:14
f68d1cb6
W
186```
187
d35f3a86 1883. Install yarn:
f68d1cb6
W
189```
190sudo npm install --global yarn
191```
192
d35f3a86 1934. Install or compile ffmpeg (if you want to compile... enjoy):
f68d1cb6 194```
d35f3a86 195sudo dnf install -y epel-release
f68d1cb6
W
196sudo dnf --enablerepo=powertools install -y SDL2 SDL2-devel
197sudo 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
198sudo dnf install -y ffmpeg
199sudo dnf update -y
200```
201
2025. Install PostgreSQL and Python3 and other stuff:
203```
204sudo dnf install -y nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git python3
205sudo ln -s /usr/bin/python3 /usr/bin/python
206sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
207sudo systemctl enable --now redis
208sudo systemctl enable --now postgresql
209```
210
2116. Configure the peertube user:
212```
213sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
214```
215
2167. Unknown missing steps:
d35f3a86
C
217- Steps missing here... these were adapted from the CentOS 8 steps which abruptly ended.
218- /var/www/peertube does not exist yet (expected? done in future steps? documentation?).
219- Nothing about Certbot, NGINX, Firewall settings, and etc.
220- Hopefully someone can suggest what is missing here with some hints so I can add it?
a075cd00 221
0a314a99 222## Fedora
223
ab87af11
DK
2241. Upgrade your packages:
225
0a314a99 226```
227dnf upgrade
228```
ab87af11
DK
229
2302. Add a user with sudoers group access:
231
0a314a99 232```
233useradd my-peertube-user
234passwd my-peertube-user
235usermod my-peertube-user -a -G wheel # Add my-peertube-user to sudoers
236su my-peertube-user
237```
ab87af11 238
d8658f0f 2393. (Optional) Install certbot (choose instructions for your distribution):
0a314a99 240[https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
ab87af11 241
4ff75a3b 2424. Install NodeJS 14.x:
0a314a99 243[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
ab87af11 244
f309a156 2455. Install yarn:
0a314a99 246[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
ab87af11
DK
247
2486. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
249
0a314a99 250```
251sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
252```
253This is necessary because `ffmpeg` is not in the Fedora repos.
254
ab87af11
DK
2557. Run:
256
0a314a99 257```
39072b2f 258sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git vim
f309a156 259ffmpeg -version # Should be >= 4.1
0a314a99 260g++ -v # Should be >= 5.x
261```
ab87af11 262
8182a370
FS
2638. Configure nginx
264
265```
266sudo mkdir /etc/nginx/sites-available
267sudo mkdir /etc/nginx/sites-enabled
268sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
269```
270
2719. Post-installation
0a314a99 272
273_from [PostgreSQL documentation](https://www.postgresql.org/download/linux/redhat/):_
274> 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 275
0a314a99 276```
277# PostgreSQL
39072b2f 278sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
0a314a99 279sudo systemctl enable postgresql.service
280sudo systemctl start postgresql.service
281# Nginx
282sudo systemctl enable nginx.service
283sudo systemctl start nginx.service
284# Redis
285sudo systemctl enable redis.service
286sudo systemctl start redis.service
287```
ab87af11 288
8182a370 28910. Firewall
0a314a99 290
51c35447 291By default, you cannot access your server via public IP. To do so, you must configure firewall:
ab87af11 292
644800ef 293- Ports used by peertube dev setup:
0a314a99 294```
0a314a99 295sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
296sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
644800ef
FS
297```
298- Optional
299
300```
301sudo firewall-cmd --permanent --zone=public --add-service=http
302sudo firewall-cmd --permanent --zone=public --add-service=https
303```
304
305- Reload firewall
306
307```
308sudo firewall-cmd --reload
309```
310
31111. Configure max ports
312
313This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
314
315```
316echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
317```
318
319[More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
320
321## Red Hat Enterprise Linux 8
322
3231. Register system as root user to Red Hat Subscription Management (create a free Red Hat account if you don't have one yet).
324
325```
326# subscription-manager register --username <username> --password <password> --auto-attach
327# dnf upgrade
328# reboot
329```
330
3312. Install Node.JS
332
333```
4ff75a3b 334sudo dnf module install nodejs:14
644800ef
FS
335```
336
3373. Install Yarn
338
339```
340curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
341sudo dnf install yarn
342```
343
3444. Install FFmpeg
345
346```
347sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-$(arch)-rpms"
348sudo dnf install --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
349sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
350sudo dnf upgrade
351sudo dnf install ffmpeg
352```
353
3545. Run:
355
356```
357sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
358```
359
3606. You'll need a symlink for python3 to python for youtube-dl to work
361
362```
3a63b110 363sudo alternatives --set python3 /usr/bin/python
644800ef
FS
364```
365
3667. Initialize the PostgreSQL database:
367
368```
369sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
370```
371
372Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
373
374```
375sudo systemctl enable --now redis
376sudo systemctl enable --now postgresql
377```
378
379If 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:
380
3818. Configure nginx
382
383```
384sudo mkdir /etc/nginx/sites-available
385sudo mkdir /etc/nginx/sites-enabled
386sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
387sudo systemctl enable --now nginx
388```
389
3909. Prepare directory
391
392To 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.
393
394```
395sudo mkdir /var/www
396
397sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
398sudo passwd peertube
399
400sudo chmod 755 /var/www/peertube/
401```
402
40310. Firewall
404
405By default, you cannot access your server via public IP. To do so, you must configure firewall:
406
407- Ports used by peertube dev setup:
408```
409sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
410sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
411```
412- Optional
413
414```
0a314a99 415sudo firewall-cmd --permanent --zone=public --add-service=http
416sudo firewall-cmd --permanent --zone=public --add-service=https
644800ef
FS
417```
418
419- Reload firewall
420
421```
0a314a99 422sudo firewall-cmd --reload
423```
0a314a99 424
8182a370 42511. Configure max ports
ab87af11 426
f309a156 427This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
ab87af11 428
0a314a99 429```
430echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
431```
ab87af11 432
0a314a99 433[More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
434
644800ef 435
4c86a254
GN
436## FreeBSD
437
438On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
439
f309a156 4401. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed):
ab87af11 441
4c86a254 442```
ab87af11
DK
443pkg
444pkg update
f6160062 445pkg install -y sudo bash wget git python nginx pkgconf postgresql13-server postgresql13-contrib redis openssl node npm yarn ffmpeg unzip
4c86a254
GN
446```
447
f309a156 4482. Allow users in the wheel group (hope you don't forgot to add your user on wheel group!) to use sudo.
ab87af11 449
4c86a254
GN
450```
451# visudo
452```
453
ab87af11 454Uncomment the line 90
f309a156 455
4c86a254
GN
456```
457%wheel ALL=(ALL) ALL
458```
459
f309a156 4603. Enable nginx, redis, postgresql services and initialize database.
4c86a254 461
4c86a254 462```
ab87af11
DK
463sysrc postgresql_enable="YES"
464sysrc redis_enable="YES"
465sysrc nginx_enable="YES"
4c86a254
GN
466```
467
ab87af11
DK
468Initialize database and start services
469
4c86a254 470```
ab87af11
DK
471service postgresql initdb
472service postgresql start
473service redis start
474service nginx start
4c86a254
GN
475```
476
2f7ac618 477## macOS
2f7ac618 478
ab87af11
DK
4791. Add the packages:
480
02d6226a
AV
481```sh
482brew install bash ffmpeg nginx postgresql openssl gcc make redis git yarn
ab87af11 483```
02d6226a
AV
484
485You may need to update your default version of bash.
486
487**How to change your default shell**
488
489```sh
490which -a bash # Check where bash is installed
491bash --version # You need a version at least as recent as 4.0
492sudo vim /etc/shells # Add in this file : /usr/local/bin/bash
493chsh -s /usr/local/bin/bash # To set the brew-installed bash as default bash
ab87af11
DK
494```
495
d35f3a86 496In a new shell, type `bash --version` to assert your changes took effect and
02d6226a
AV
497correctly modified your default bash version.
498
ab87af11 4992. Run the services:
2f7ac618 500
02d6226a 501```sh
ab87af11
DK
502brew services run postgresql
503brew services run redis
504```
396f224b 505
02d6226a 506On macOS, the `postgresql` user can be `_postgres` instead of `postgres`.
ddc7d3ec 507If `sudo -u postgres createuser -P peertube` gives you an `unknown user: postgres` error, you can try `sudo -u _postgres createuser -U peertube`.
02d6226a 508
396f224b
HM
509## Gentoo
510
ab87af11
DK
5111. Add this to ``/etc/portage/sets/peertube``:
512
396f224b
HM
513```
514net-libs/nodejs
515sys-apps/yarn
516media-video/ffmpeg[x264] # Optionnally add vorbis,vpx
517dev-db/postgresql
518dev-db/redis
519dev-vcs/git
520app-arch/unzip
8182a370 521dev-lang/python
a232d3e5 522dev-lang/python-exec
396f224b 523www-servers/nginx
396f224b 524
ab87af11 525# Optional, client for Let’s Encrypt:
396f224b 526# app-crypt/certbot
396f224b
HM
527```
528
ab87af11
DK
5292. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn:
530
bfc6bb94
W
531```
532mkdir -p /etc/portage/package.keywords
533cat << EOF >> /etc/portage/package.keywords/peertube
534# required by yarn (argument) for PeerTube
535sys-apps/yarn ~amd64
536EOF
537```
538
ab87af11
DK
5393. Compile the peertube set:
540
396f224b
HM
541```
542emerge -a @peertube
543```
544
ab87af11
DK
5454. Initialize the PostgreSQL database if you just merged it:
546
396f224b
HM
547```
548emerge --config postgresql
549```
550
ab87af11
DK
5515. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot):
552
396f224b
HM
553```
554rc-update add redis
c1109b45 555rc-update add postgresql-11
396f224b 556rc-service redis start
c1109b45 557rc-service postgresql-11 start
396f224b 558```
f309a156 559
32e06ca4 5606. Create Python version symlink for youtube-dl:
561
562```
a232d3e5 563emerge -1 python-exec
32e06ca4 564```
565
80428d16
G
566## OpenBSD
567
5681. Install Packages:
569
570```
571pkg_add sudo bash wget git python nginx pkgconf postgresql-server postgresql-contrib redis openssl
572```
573
5742. Install yarn:
575
576```
577npm install --global yarn
578```
579
5803. Allow users in the wheel group to use sudo
581
582```
583visudo
584```
585Uncomment line #43:
586
587```
588%wheel ALL=(ALL) ALL
589```
590
5914. Enable services:
592
593```
594rcctl enable postgresql redis nginx
595```
596
afe81767 597## Other distributions
63bfad7e
C
598
599Feel free to update this file in a pull request!