]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - support/doc/dependencies.md
Add info about admin username in doc
[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). You can check them automatically via `sudo npx engineslist`.
6
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
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
12- [Debian / Ubuntu and derivatives](#debian--ubuntu-and-derivatives)
13- [Arch Linux](#arch-linux)
14- [CentOS 7](#centos-7)
15- [Centos 8](#centos-8)
16- [Rocky Linux 8.4](#rocky-linux-84)
17- [Fedora](#fedora)
18- [Red Hat Enterprise Linux 8](#red-hat-enterprise-linux-8)
19- [FreeBSD](#freebsd)
20- [macOS](#macos)
21- [Gentoo](#gentoo)
22- [OpenBSD](#openbsd)
23- [Other distributions](#other-distributions)
24
25<!-- END doctoc generated TOC please keep comment here to allow auto update -->
26
27## Debian / Ubuntu and derivatives
28
291. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation
30
31```
32# apt-get install curl sudo unzip vim
33```
34
352. It would be wise to disable root access and to continue this tutorial with a user with sudoers group access
36
373. Install NodeJS 14.x:
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)
394. Install yarn, and be sure to have [a recent version](https://github.com/yarnpkg/yarn/releases/latest):
40[https://yarnpkg.com/en/docs/install#linux-tab](https://yarnpkg.com/en/docs/install#linux-tab)
41
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:
61
62```
63sudo apt update
64sudo apt install certbot nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git cron wget
65ffmpeg -version # Should be >= 4.1
66g++ -v # Should be >= 5.x
67```
68
69Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
70
71```
72sudo systemctl start redis postgresql
73```
74
75## Arch Linux
76
771. Run:
78
79```
80sudo pacman -S nodejs-lts-fermium yarn ffmpeg postgresql openssl redis git wget unzip python base-devel npm nginx
81```
82
83Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
84
85```
86sudo systemctl start redis postgresql
87```
88
89## CentOS 7
90
911. Install NodeJS 14.x:
92[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
93
942. Install yarn:
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
1024. Install Packages:
103
104```
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
109```
110
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
113```
114sudo scl enable devtoolset-7 bash
115```
116
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```
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
121```
122
1236. Initialize the PostgreSQL database:
124
125```
126sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
127```
128
129Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
130
131```
132sudo systemctl enable --now redis
133sudo systemctl enable --now postgresql
134```
135
136## Centos 8
137
1381. Install NodeJS 14.x:
139[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
140
1412. Install yarn:
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
1484. Install packages:
149
150```
151sudo dnf update
152sudo dnf install epel-release
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
1636. Initialize the PostgreSQL database:
164
165```
166sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
167```
168
169Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
170
171```
172sudo systemctl enable --now redis
173sudo systemctl enable --now postgresql
174```
175
176## Rocky Linux 8.4
177
1781. Pull the latest updates:
179```
180sudo dnf update -y
181```
182
1832. Install NodeJS 14.x:
184```
185sudo dnf module install -y nodejs:14
186```
187
1883. Install yarn:
189```
190sudo npm install --global yarn
191```
192
1934. Install or compile ffmpeg (if you want to compile... enjoy):
194```
195sudo dnf install -y epel-release
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:
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?
221
222## Fedora
223
2241. Upgrade your packages:
225
226```
227dnf upgrade
228```
229
2302. Add a user with sudoers group access:
231
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```
238
2393. (Optional) Install certbot (choose instructions for your distribution):
240[https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
241
2424. Install NodeJS 14.x:
243[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
244
2455. Install yarn:
246[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
247
2486. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
249
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
2557. Run:
256
257```
258sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git vim
259ffmpeg -version # Should be >= 4.1
260g++ -v # Should be >= 5.x
261```
262
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
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.
275
276```
277# PostgreSQL
278sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
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```
288
28910. Firewall
290
291By default, you cannot access your server via public IP. To do so, you must configure firewall:
292
293- Ports used by peertube dev setup:
294```
295sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
296sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
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```
334sudo dnf module install nodejs:14
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```
363sudo alternatives --set python3 /usr/bin/python
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```
415sudo firewall-cmd --permanent --zone=public --add-service=http
416sudo firewall-cmd --permanent --zone=public --add-service=https
417```
418
419- Reload firewall
420
421```
422sudo firewall-cmd --reload
423```
424
42511. Configure max ports
426
427This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
428
429```
430echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
431```
432
433[More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
434
435
436## FreeBSD
437
438On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
439
4401. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed):
441
442```
443pkg
444pkg update
445pkg install -y sudo bash wget git python nginx pkgconf postgresql13-server postgresql13-contrib redis openssl node npm yarn ffmpeg unzip
446```
447
4482. Allow users in the wheel group (hope you don't forgot to add your user on wheel group!) to use sudo.
449
450```
451# visudo
452```
453
454Uncomment the line 90
455
456```
457%wheel ALL=(ALL) ALL
458```
459
4603. Enable nginx, redis, postgresql services and initialize database.
461
462```
463sysrc postgresql_enable="YES"
464sysrc redis_enable="YES"
465sysrc nginx_enable="YES"
466```
467
468Initialize database and start services
469
470```
471service postgresql initdb
472service postgresql start
473service redis start
474service nginx start
475```
476
477## macOS
478
4791. Add the packages:
480
481```sh
482brew install bash ffmpeg nginx postgresql openssl gcc make redis git yarn
483```
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
494```
495
496In a new shell, type `bash --version` to assert your changes took effect and
497correctly modified your default bash version.
498
4992. Run the services:
500
501```sh
502brew services run postgresql
503brew services run redis
504```
505
506On macOS, the `postgresql` user can be `_postgres` instead of `postgres`.
507If `sudo -u postgres createuser -P peertube` gives you an `unknown user: postgres` error, you can try `sudo -u _postgres createuser -U peertube`.
508
509## Gentoo
510
5111. Add this to ``/etc/portage/sets/peertube``:
512
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
521dev-lang/python
522dev-lang/python-exec
523www-servers/nginx
524
525# Optional, client for Let’s Encrypt:
526# app-crypt/certbot
527```
528
5292. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn:
530
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
5393. Compile the peertube set:
540
541```
542emerge -a @peertube
543```
544
5454. Initialize the PostgreSQL database if you just merged it:
546
547```
548emerge --config postgresql
549```
550
5515. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot):
552
553```
554rc-update add redis
555rc-update add postgresql-11
556rc-service redis start
557rc-service postgresql-11 start
558```
559
5606. Create Python version symlink for youtube-dl:
561
562```
563emerge -1 python-exec
564```
565
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
597## Other distributions
598
599Feel free to update this file in a pull request!