]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - support/doc/dependencies.md
Fix peers info width in live
[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
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
13 * `ffmpeg` >=4.3
14
15
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
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
21- [Debian / Ubuntu and derivatives](#debian-ubuntu-and-derivatives)
22- [Arch Linux](#arch-linux)
23- [CentOS 7](#centos-7)
24- [Centos 8](#centos-8)
25- [Rocky Linux 8.4](#rocky-linux-84)
26- [Fedora](#fedora)
27- [Red Hat Enterprise Linux 8](#red-hat-enterprise-linux-8)
28- [FreeBSD](#freebsd)
29- [macOS](#macos)
30- [Gentoo](#gentoo)
31- [OpenBSD](#openbsd)
32- [Other distributions](#other-distributions)
33
34<!-- END doctoc generated TOC please keep comment here to allow auto update -->
35
36## Debian / Ubuntu and derivatives
37
381. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation
39
40```
41# apt-get install curl sudo unzip vim
42```
43
442. It would be wise to disable root access and to continue this tutorial with a user with sudoers group access
45
463. Install NodeJS 16.x:
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)
484. Install yarn, and be sure to have [a recent version](https://github.com/yarnpkg/yarn/releases/latest):
49[https://yarnpkg.com/en/docs/install#linux-tab](https://yarnpkg.com/en/docs/install#linux-tab)
50
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:
70
71```
72sudo apt update
73sudo apt install certbot nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git cron wget
74ffmpeg -version # Should be >= 4.1
75g++ -v # Should be >= 5.x
76redis-server --version # Should be >= 5.x
77```
78
79Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
80
81```
82sudo systemctl start redis postgresql
83```
84
85## Arch Linux
86
871. Run:
88
89```
90sudo pacman -S nodejs-lts-fermium yarn ffmpeg postgresql openssl redis git wget unzip python base-devel npm nginx
91```
92
93Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
94
95```
96sudo systemctl start redis postgresql
97```
98
99## CentOS 7
100
1011. Install NodeJS 16.x:
102[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
103
1042. Install yarn:
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
1124. Install Packages:
113
114```
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
119```
120
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
123```
124sudo scl enable devtoolset-7 bash
125```
126
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```
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
131```
132
1336. Initialize the PostgreSQL database:
134
135```
136sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
137```
138
139Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
140
141```
142sudo systemctl enable --now redis
143sudo systemctl enable --now postgresql
144```
145
146## Centos 8
147
1481. Install NodeJS 16.x:
149[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
150
1512. Install yarn:
152[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
153
1543. Install or compile ffmpeg:
155
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```
162
1634. Install packages:
164
165```
166sudo dnf update
167sudo dnf install epel-release
168sudo dnf update
169sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git unzip
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
1786. Initialize the PostgreSQL database:
179
180```
181sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
182```
183
184Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
185
186```
187sudo systemctl enable --now redis
188sudo systemctl enable --now postgresql
189```
190
191## Rocky Linux 8.4
192
1931. Pull the latest updates:
194```
195sudo dnf update -y
196```
197
1982. Install NodeJS 16.x:
199```
200sudo dnf module install -y nodejs:16
201```
202
2033. Install yarn:
204```
205sudo npm install --global yarn
206```
207
2084. Install or compile ffmpeg (if you want to compile... enjoy):
209```
210sudo dnf install -y epel-release
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:
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?
236
237## Fedora
238
2391. Upgrade your packages:
240
241```
242dnf upgrade
243```
244
2452. Add a user with sudoers group access:
246
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```
253
2543. (Optional) Install certbot (choose instructions for your distribution):
255[https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
256
2574. Install NodeJS 16.x:
258[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
259
2605. Install yarn:
261[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
262
2636. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
264
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
2707. Run:
271
272```
273sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git vim
274ffmpeg -version # Should be >= 4.1
275g++ -v # Should be >= 5.x
276redis-server --version # Should be >= 5.x
277```
278
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
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.
291
292```
293# PostgreSQL
294sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
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```
304
30510. Firewall
306
307By default, you cannot access your server via public IP. To do so, you must configure firewall:
308
309- Ports used by peertube dev setup:
310```
311sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
312sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
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```
350sudo dnf module install nodejs:16
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```
379sudo alternatives --set python3 /usr/bin/python
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```
431sudo firewall-cmd --permanent --zone=public --add-service=http
432sudo firewall-cmd --permanent --zone=public --add-service=https
433```
434
435- Reload firewall
436
437```
438sudo firewall-cmd --reload
439```
440
44111. Configure max ports
442
443This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
444
445```
446echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
447```
448
449[More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
450
451
452## FreeBSD
453
454On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
455
4561. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed):
457
458```
459pkg
460pkg update
461pkg install -y sudo bash wget git python nginx pkgconf postgresql13-server postgresql13-contrib redis openssl node npm yarn ffmpeg unzip
462```
463
4642. Allow users in the wheel group (hope you don't forgot to add your user on wheel group!) to use sudo.
465
466```
467# visudo
468```
469
470Uncomment the line 90
471
472```
473%wheel ALL=(ALL) ALL
474```
475
4763. Enable nginx, redis, postgresql services and initialize database.
477
478```
479sysrc postgresql_enable="YES"
480sysrc redis_enable="YES"
481sysrc nginx_enable="YES"
482```
483
484Initialize database and start services
485
486```
487service postgresql initdb
488service postgresql start
489service redis start
490service nginx start
491```
492
493## macOS
494
4951. Add the packages:
496
497```sh
498brew install bash ffmpeg nginx postgresql openssl gcc make redis git yarn
499```
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
510```
511
512In a new shell, type `bash --version` to assert your changes took effect and
513correctly modified your default bash version.
514
5152. Run the services:
516
517```sh
518brew services run postgresql
519brew services run redis
520```
521
522On macOS, the `postgresql` user can be `_postgres` instead of `postgres`.
523If `sudo -u postgres createuser -P peertube` gives you an `unknown user: postgres` error, you can try `sudo -u _postgres createuser -U peertube`.
524
525## Gentoo
526
5271. Add this to ``/etc/portage/sets/peertube``:
528
529```
530net-libs/nodejs
531sys-apps/yarn
532media-video/ffmpeg[x264] # Optionally add vorbis,vpx
533dev-db/postgresql
534dev-db/redis
535dev-vcs/git
536app-arch/unzip
537dev-lang/python
538dev-lang/python-exec
539www-servers/nginx
540
541# Optional, client for Let’s Encrypt:
542# app-crypt/certbot
543```
544
5452. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn:
546
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
5553. Compile the peertube set:
556
557```
558emerge -a @peertube
559```
560
5614. Initialize the PostgreSQL database if you just merged it:
562
563```
564emerge --config postgresql
565```
566
5675. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot):
568
569```
570rc-update add redis
571rc-update add postgresql-11
572rc-service redis start
573rc-service postgresql-11 start
574```
575
5766. Create Python version symlink for youtube-dl:
577
578```
579emerge -1 python-exec
580```
581
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
613## Other distributions
614
615Feel free to update this file in a pull request!