]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - support/doc/dependencies.md
Update translations
[github/Chocobozzz/PeerTube.git] / support / doc / dependencies.md
... / ...
CommitLineData
1# Dependencies
2
3Follow 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`.
4
5_note_: only **LTS** versions of external dependencies are supported. If no LTS version matching the version constraint is available, only **release** versions are supported.
6
7<!-- START doctoc generated TOC please keep comment here to allow auto update -->
8<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
9
10
11- [Debian / Ubuntu and derivatives](#debian--ubuntu-and-derivatives)
12- [Arch Linux](#arch-linux)
13- [CentOS 7](#centos-7)
14- [CentOS 8](#centos-8)
15- [Fedora](#fedora)
16- [RHEL 8](#red-hat-enterprise-linux-8)
17- [FreeBSD](#freebsd)
18- [macOS](#macos)
19- [Gentoo](#gentoo)
20- [Other distributions](#other-distributions)
21
22<!-- END doctoc generated TOC please keep comment here to allow auto update -->
23
24## Debian / Ubuntu and derivatives
25
261. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation
27
28```
29# apt-get install curl sudo unzip vim
30```
31
322. It would be wise to disable root access and to continue this tutorial with a user with sudoers group access
33
343. Install NodeJS 14.x:
35[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)
364. Install yarn, and be sure to have [a recent version](https://github.com/yarnpkg/yarn/releases/latest):
37[https://yarnpkg.com/en/docs/install#linux-tab](https://yarnpkg.com/en/docs/install#linux-tab)
38
395. Run:
40
41```
42sudo apt update
43sudo apt install certbot nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git python-dev cron wget
44ffmpeg -version # Should be >= 4.1
45g++ -v # Should be >= 5.x
46```
47
48Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
49
50```
51sudo systemctl start redis postgresql
52```
53
54## Arch Linux
55
561. Run:
57
58```
59sudo pacman -S nodejs-lts-fermium yarn ffmpeg postgresql openssl redis git wget unzip python2 base-devel npm nginx
60```
61
62Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
63
64```
65sudo systemctl start redis postgresql
66```
67
68## CentOS 7
69
701. Install NodeJS 12.x:
71[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
72
732. Install yarn:
74[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
75
763. Install or compile ffmpeg:
77
78* Install - [https://linoxide.com/linux-how-to/install-ffmpeg-centos-7/](https://linoxide.com/linux-how-to/install-ffmpeg-centos-7/)
79* Compile - [https://gist.github.com/mustafaturan/7053900#file-latest-ffmpeg-centos6-sh](https://gist.github.com/mustafaturan/7053900#file-latest-ffmpeg-centos6-sh)
80
814. Install Packages:
82
83```
84sudo yum update
85sudo yum install epel-release centos-release-scl
86sudo yum update
87sudo yum install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git devtoolset-7
88```
89
905. 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.
91
92```
93sudo scl enable devtoolset-7 bash
94```
95
96Later 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:
97
98```
99sudo -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
100```
101
1026. Initialize the PostgreSQL database:
103
104```
105sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
106```
107
108Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
109
110```
111sudo systemctl enable --now redis
112sudo systemctl enable --now postgresql
113```
114
115## Centos 8
116
1171. Install NodeJS 12.x:
118[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
119
1202. Install yarn:
121[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
122
1233. Install or compile ffmpeg:
124
125* Install - [https://linuxize.com/post/how-to-install-ffmpeg-on-centos-8/](https://linuxize.com/post/how-to-install-ffmpeg-on-centos-8/)
126
1274. Install packages:
128
129```
130sudo dnf update
131sudo dnf install epel-release
132sudo dnf update
133sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
134```
135
1365. You'll need a symlink for python3 to python for youtube-dl to work
137
138```
139sudo ln -s /usr/bin/python3 /usr/bin/python
140```
141
1426. Initialize the PostgreSQL database:
143
144```
145sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
146```
147
148Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
149
150```
151sudo systemctl enable --now redis
152sudo systemctl enable --now postgresql
153```
154
155## Rocky Linux 8.4
156
1571. Pull the latest updates:
158```
159sudo dnf update -y
160```
161
1622. Install NodeJS 12.x (why 12 and not 14? Not sure...):
163```
164sudo dnf module install -y nodejs:12
165```
166
1673. Install yarn:
168```
169sudo npm install --global yarn
170```
171
1724. Install or compile ffmpeg (if you want to compile... enjoy):
173```
174sudo dnf install -y epel-release
175sudo dnf --enablerepo=powertools install -y SDL2 SDL2-devel
176sudo 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
177sudo dnf install -y ffmpeg
178sudo dnf update -y
179```
180
1815. Install PostgreSQL and Python3 and other stuff:
182```
183sudo dnf install -y nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git python3
184sudo ln -s /usr/bin/python3 /usr/bin/python
185sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
186sudo systemctl enable --now redis
187sudo systemctl enable --now postgresql
188```
189
1906. Configure the peertube user:
191```
192sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
193```
194
1957. Unknown missing steps:
196- Steps missing here... these were adapted from the CentOS 8 steps which abruptly ended.
197- /var/www/peertube does not exist yet (expected? done in future steps? documentation?).
198- Nothing about Certbot, NGINX, Firewall settings, and etc.
199- Hopefully someone can suggest what is missing here with some hints so I can add it?
200
201## Fedora
202
2031. Upgrade your packages:
204
205```
206dnf upgrade
207```
208
2092. Add a user with sudoers group access:
210
211```
212useradd my-peertube-user
213passwd my-peertube-user
214usermod my-peertube-user -a -G wheel # Add my-peertube-user to sudoers
215su my-peertube-user
216```
217
2183. (Optional) Install certbot (choose instructions for your distribution):
219[https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
220
2214. Install NodeJS 12.x:
222[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
223
2245. Install yarn:
225[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
226
2276. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
228
229```
230sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
231```
232This is necessary because `ffmpeg` is not in the Fedora repos.
233
2347. Run:
235
236```
237sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git vim
238ffmpeg -version # Should be >= 4.1
239g++ -v # Should be >= 5.x
240```
241
2428. Configure nginx
243
244```
245sudo mkdir /etc/nginx/sites-available
246sudo mkdir /etc/nginx/sites-enabled
247sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
248```
249
2509. Post-installation
251
252_from [PostgreSQL documentation](https://www.postgresql.org/download/linux/redhat/):_
253> Due to policies for Red Hat family distributions, the PostgreSQL installation will not be enabled for automatic start or have the database initialized automatically.
254
255```
256# PostgreSQL
257sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
258sudo systemctl enable postgresql.service
259sudo systemctl start postgresql.service
260# Nginx
261sudo systemctl enable nginx.service
262sudo systemctl start nginx.service
263# Redis
264sudo systemctl enable redis.service
265sudo systemctl start redis.service
266```
267
26810. Firewall
269
270By default, you cannot access your server via public IP. To do so, you must configure firewall:
271
272- Ports used by peertube dev setup:
273```
274sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
275sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
276```
277- Optional
278
279```
280sudo firewall-cmd --permanent --zone=public --add-service=http
281sudo firewall-cmd --permanent --zone=public --add-service=https
282```
283
284- Reload firewall
285
286```
287sudo firewall-cmd --reload
288```
289
29011. Configure max ports
291
292This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
293
294```
295echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
296```
297
298[More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
299
300## Red Hat Enterprise Linux 8
301
3021. Register system as root user to Red Hat Subscription Management (create a free Red Hat account if you don't have one yet).
303
304```
305# subscription-manager register --username <username> --password <password> --auto-attach
306# dnf upgrade
307# reboot
308```
309
3102. Install Node.JS
311
312```
313sudo dnf module install nodejs:12
314```
315
3163. Install Yarn
317
318```
319curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
320sudo dnf install yarn
321```
322
3234. Install FFmpeg
324
325```
326sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-$(arch)-rpms"
327sudo dnf install --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
328sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
329sudo dnf upgrade
330sudo dnf install ffmpeg
331```
332
3335. Run:
334
335```
336sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
337```
338
3396. You'll need a symlink for python3 to python for youtube-dl to work
340
341```
342sudo ln -s /usr/bin/python3 /usr/bin/python
343```
344
3457. Initialize the PostgreSQL database:
346
347```
348sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
349```
350
351Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
352
353```
354sudo systemctl enable --now redis
355sudo systemctl enable --now postgresql
356```
357
358If 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:
359
3608. Configure nginx
361
362```
363sudo mkdir /etc/nginx/sites-available
364sudo mkdir /etc/nginx/sites-enabled
365sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
366sudo systemctl enable --now nginx
367```
368
3699. Prepare directory
370
371To 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.
372
373```
374sudo mkdir /var/www
375
376sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
377sudo passwd peertube
378
379sudo chmod 755 /var/www/peertube/
380```
381
38210. Firewall
383
384By default, you cannot access your server via public IP. To do so, you must configure firewall:
385
386- Ports used by peertube dev setup:
387```
388sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
389sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
390```
391- Optional
392
393```
394sudo firewall-cmd --permanent --zone=public --add-service=http
395sudo firewall-cmd --permanent --zone=public --add-service=https
396```
397
398- Reload firewall
399
400```
401sudo firewall-cmd --reload
402```
403
40411. Configure max ports
405
406This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
407
408```
409echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
410```
411
412[More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
413
414
415## FreeBSD
416
417On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
418
4191. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed):
420
421```
422pkg
423pkg update
424pkg install -y sudo bash wget git python nginx pkgconf postgresql13-server postgresql13-contrib redis openssl node npm yarn ffmpeg unzip
425```
426
4272. Allow users in the wheel group (hope you don't forgot to add your user on wheel group!) to use sudo.
428
429```
430# visudo
431```
432
433Uncomment the line 90
434
435```
436%wheel ALL=(ALL) ALL
437```
438
4393. Enable nginx, redis, postgresql services and initialize database.
440
441```
442sysrc postgresql_enable="YES"
443sysrc redis_enable="YES"
444sysrc nginx_enable="YES"
445```
446
447Initialize database and start services
448
449```
450service postgresql initdb
451service postgresql start
452service redis start
453service nginx start
454```
455
456## macOS
457
4581. Add the packages:
459
460```sh
461brew install bash ffmpeg nginx postgresql openssl gcc make redis git yarn
462```
463
464You may need to update your default version of bash.
465
466**How to change your default shell**
467
468```sh
469which -a bash # Check where bash is installed
470bash --version # You need a version at least as recent as 4.0
471sudo vim /etc/shells # Add in this file : /usr/local/bin/bash
472chsh -s /usr/local/bin/bash # To set the brew-installed bash as default bash
473```
474
475In a new shell, type `bash --version` to assert your changes took effect and
476correctly modified your default bash version.
477
4782. Run the services:
479
480```sh
481brew services run postgresql
482brew services run redis
483```
484
485On macOS, the `postgresql` user can be `_postgres` instead of `postgres`.
486If `sudo -u postgres createuser -P peertube` gives you an `unknown user: postgres` error, you can try `sudo -u _postgres createuser -U peertube`.
487
488## Gentoo
489
4901. Add this to ``/etc/portage/sets/peertube``:
491
492```
493net-libs/nodejs
494sys-apps/yarn
495media-video/ffmpeg[x264] # Optionnally add vorbis,vpx
496dev-db/postgresql
497dev-db/redis
498dev-vcs/git
499app-arch/unzip
500dev-lang/python
501www-servers/nginx
502
503# Optional, client for Let’s Encrypt:
504# app-crypt/certbot
505```
506
5072. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn:
508
509```
510mkdir -p /etc/portage/package.keywords
511cat << EOF >> /etc/portage/package.keywords/peertube
512# required by yarn (argument) for PeerTube
513sys-apps/yarn ~amd64
514EOF
515```
516
5173. Compile the peertube set:
518
519```
520emerge -a @peertube
521```
522
5234. Initialize the PostgreSQL database if you just merged it:
524
525```
526emerge --config postgresql
527```
528
5295. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot):
530
531```
532rc-update add redis
533rc-update add postgresql-11
534rc-service redis start
535rc-service postgresql-11 start
536```
537
538## OpenBSD
539
5401. Install Packages:
541
542```
543pkg_add sudo bash wget git python nginx pkgconf postgresql-server postgresql-contrib redis openssl
544```
545
5462. Install yarn:
547
548```
549npm install --global yarn
550```
551
5523. Allow users in the wheel group to use sudo
553
554```
555visudo
556```
557Uncomment line #43:
558
559```
560%wheel ALL=(ALL) ALL
561```
562
5634. Enable services:
564
565```
566rcctl enable postgresql redis nginx
567```
568
569## Other distributions
570
571Feel free to update this file in a pull request!