]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - support/doc/dependencies.md
Update translations
[github/Chocobozzz/PeerTube.git] / support / doc / dependencies.md
1 # Dependencies
2
3 Follow 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
26 1. 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
32 2. It would be wise to disable root access and to continue this tutorial with a user with sudoers group access
33
34 3. 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)
36 4. 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
39 5. Run:
40
41 ```
42 sudo apt update
43 sudo apt install certbot nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git python-dev cron wget
44 ffmpeg -version # Should be >= 4.1
45 g++ -v # Should be >= 5.x
46 ```
47
48 Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
49
50 ```
51 sudo systemctl start redis postgresql
52 ```
53
54 ## Arch Linux
55
56 1. Run:
57
58 ```
59 sudo pacman -S nodejs-lts-fermium yarn ffmpeg postgresql openssl redis git wget unzip python2 base-devel npm nginx
60 ```
61
62 Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
63
64 ```
65 sudo systemctl start redis postgresql
66 ```
67
68 ## CentOS 7
69
70 1. 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
73 2. Install yarn:
74 [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
75
76 3. 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
81 4. Install Packages:
82
83 ```
84 sudo yum update
85 sudo yum install epel-release centos-release-scl
86 sudo yum update
87 sudo yum install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git devtoolset-7
88 ```
89
90 5. 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 ```
93 sudo scl enable devtoolset-7 bash
94 ```
95
96 Later 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 ```
99 sudo -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
102 6. Initialize the PostgreSQL database:
103
104 ```
105 sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
106 ```
107
108 Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
109
110 ```
111 sudo systemctl enable --now redis
112 sudo systemctl enable --now postgresql
113 ```
114
115 ## Centos 8
116
117 1. 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
120 2. Install yarn:
121 [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
122
123 3. 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
127 4. Install packages:
128
129 ```
130 sudo dnf update
131 sudo dnf install epel-release
132 sudo dnf update
133 sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
134 ```
135
136 5. You'll need a symlink for python3 to python for youtube-dl to work
137
138 ```
139 sudo ln -s /usr/bin/python3 /usr/bin/python
140 ```
141
142 6. Initialize the PostgreSQL database:
143
144 ```
145 sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
146 ```
147
148 Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
149
150 ```
151 sudo systemctl enable --now redis
152 sudo systemctl enable --now postgresql
153 ```
154
155 ## Rocky Linux 8.4
156
157 1. Pull the latest updates:
158 ```
159 sudo dnf update -y
160 ```
161
162 2. Install NodeJS 12.x (why 12 and not 14? Not sure...):
163 ```
164 sudo dnf module install -y nodejs:12
165 ```
166
167 3. Install yarn:
168 ```
169 sudo npm install --global yarn
170 ```
171
172 4. Install or compile ffmpeg (if you want to compile... enjoy):
173 ```
174 sudo dnf install -y epel-release
175 sudo dnf --enablerepo=powertools install -y SDL2 SDL2-devel
176 sudo 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
177 sudo dnf install -y ffmpeg
178 sudo dnf update -y
179 ```
180
181 5. Install PostgreSQL and Python3 and other stuff:
182 ```
183 sudo dnf install -y nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git python3
184 sudo ln -s /usr/bin/python3 /usr/bin/python
185 sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
186 sudo systemctl enable --now redis
187 sudo systemctl enable --now postgresql
188 ```
189
190 6. Configure the peertube user:
191 ```
192 sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
193 ```
194
195 7. 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
203 1. Upgrade your packages:
204
205 ```
206 dnf upgrade
207 ```
208
209 2. Add a user with sudoers group access:
210
211 ```
212 useradd my-peertube-user
213 passwd my-peertube-user
214 usermod my-peertube-user -a -G wheel # Add my-peertube-user to sudoers
215 su my-peertube-user
216 ```
217
218 3. (Optional) Install certbot (choose instructions for your distribution):
219 [https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
220
221 4. 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
224 5. Install yarn:
225 [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
226
227 6. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
228
229 ```
230 sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
231 ```
232 This is necessary because `ffmpeg` is not in the Fedora repos.
233
234 7. Run:
235
236 ```
237 sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git vim
238 ffmpeg -version # Should be >= 4.1
239 g++ -v # Should be >= 5.x
240 ```
241
242 8. Configure nginx
243
244 ```
245 sudo mkdir /etc/nginx/sites-available
246 sudo mkdir /etc/nginx/sites-enabled
247 sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
248 ```
249
250 9. 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
257 sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
258 sudo systemctl enable postgresql.service
259 sudo systemctl start postgresql.service
260 # Nginx
261 sudo systemctl enable nginx.service
262 sudo systemctl start nginx.service
263 # Redis
264 sudo systemctl enable redis.service
265 sudo systemctl start redis.service
266 ```
267
268 10. Firewall
269
270 By 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 ```
274 sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
275 sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
276 ```
277 - Optional
278
279 ```
280 sudo firewall-cmd --permanent --zone=public --add-service=http
281 sudo firewall-cmd --permanent --zone=public --add-service=https
282 ```
283
284 - Reload firewall
285
286 ```
287 sudo firewall-cmd --reload
288 ```
289
290 11. Configure max ports
291
292 This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
293
294 ```
295 echo 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
302 1. 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
310 2. Install Node.JS
311
312 ```
313 sudo dnf module install nodejs:12
314 ```
315
316 3. Install Yarn
317
318 ```
319 curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
320 sudo dnf install yarn
321 ```
322
323 4. Install FFmpeg
324
325 ```
326 sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-$(arch)-rpms"
327 sudo dnf install --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
328 sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
329 sudo dnf upgrade
330 sudo dnf install ffmpeg
331 ```
332
333 5. Run:
334
335 ```
336 sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
337 ```
338
339 6. You'll need a symlink for python3 to python for youtube-dl to work
340
341 ```
342 sudo ln -s /usr/bin/python3 /usr/bin/python
343 ```
344
345 7. Initialize the PostgreSQL database:
346
347 ```
348 sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
349 ```
350
351 Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
352
353 ```
354 sudo systemctl enable --now redis
355 sudo systemctl enable --now postgresql
356 ```
357
358 If 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
360 8. Configure nginx
361
362 ```
363 sudo mkdir /etc/nginx/sites-available
364 sudo mkdir /etc/nginx/sites-enabled
365 sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
366 sudo systemctl enable --now nginx
367 ```
368
369 9. Prepare directory
370
371 To 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 ```
374 sudo mkdir /var/www
375
376 sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
377 sudo passwd peertube
378
379 sudo chmod 755 /var/www/peertube/
380 ```
381
382 10. Firewall
383
384 By 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 ```
388 sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
389 sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
390 ```
391 - Optional
392
393 ```
394 sudo firewall-cmd --permanent --zone=public --add-service=http
395 sudo firewall-cmd --permanent --zone=public --add-service=https
396 ```
397
398 - Reload firewall
399
400 ```
401 sudo firewall-cmd --reload
402 ```
403
404 11. Configure max ports
405
406 This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
407
408 ```
409 echo 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
417 On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
418
419 1. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed):
420
421 ```
422 pkg
423 pkg update
424 pkg install -y sudo bash wget git python nginx pkgconf postgresql13-server postgresql13-contrib redis openssl node npm yarn ffmpeg unzip
425 ```
426
427 2. 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
433 Uncomment the line 90
434
435 ```
436 %wheel ALL=(ALL) ALL
437 ```
438
439 3. Enable nginx, redis, postgresql services and initialize database.
440
441 ```
442 sysrc postgresql_enable="YES"
443 sysrc redis_enable="YES"
444 sysrc nginx_enable="YES"
445 ```
446
447 Initialize database and start services
448
449 ```
450 service postgresql initdb
451 service postgresql start
452 service redis start
453 service nginx start
454 ```
455
456 ## macOS
457
458 1. Add the packages:
459
460 ```sh
461 brew install bash ffmpeg nginx postgresql openssl gcc make redis git yarn
462 ```
463
464 You may need to update your default version of bash.
465
466 **How to change your default shell**
467
468 ```sh
469 which -a bash # Check where bash is installed
470 bash --version # You need a version at least as recent as 4.0
471 sudo vim /etc/shells # Add in this file : /usr/local/bin/bash
472 chsh -s /usr/local/bin/bash # To set the brew-installed bash as default bash
473 ```
474
475 In a new shell, type `bash --version` to assert your changes took effect and
476 correctly modified your default bash version.
477
478 2. Run the services:
479
480 ```sh
481 brew services run postgresql
482 brew services run redis
483 ```
484
485 On macOS, the `postgresql` user can be `_postgres` instead of `postgres`.
486 If `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
490 1. Add this to ``/etc/portage/sets/peertube``:
491
492 ```
493 net-libs/nodejs
494 sys-apps/yarn
495 media-video/ffmpeg[x264] # Optionnally add vorbis,vpx
496 dev-db/postgresql
497 dev-db/redis
498 dev-vcs/git
499 app-arch/unzip
500 dev-lang/python
501 www-servers/nginx
502
503 # Optional, client for Let’s Encrypt:
504 # app-crypt/certbot
505 ```
506
507 2. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn:
508
509 ```
510 mkdir -p /etc/portage/package.keywords
511 cat << EOF >> /etc/portage/package.keywords/peertube
512 # required by yarn (argument) for PeerTube
513 sys-apps/yarn ~amd64
514 EOF
515 ```
516
517 3. Compile the peertube set:
518
519 ```
520 emerge -a @peertube
521 ```
522
523 4. Initialize the PostgreSQL database if you just merged it:
524
525 ```
526 emerge --config postgresql
527 ```
528
529 5. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot):
530
531 ```
532 rc-update add redis
533 rc-update add postgresql-11
534 rc-service redis start
535 rc-service postgresql-11 start
536 ```
537
538 ## OpenBSD
539
540 1. Install Packages:
541
542 ```
543 pkg_add sudo bash wget git python nginx pkgconf postgresql-server postgresql-contrib redis openssl
544 ```
545
546 2. Install yarn:
547
548 ```
549 npm install --global yarn
550 ```
551
552 3. Allow users in the wheel group to use sudo
553
554 ```
555 visudo
556 ```
557 Uncomment line #43:
558
559 ```
560 %wheel ALL=(ALL) ALL
561 ```
562
563 4. Enable services:
564
565 ```
566 rcctl enable postgresql redis nginx
567 ```
568
569 ## Other distributions
570
571 Feel free to update this file in a pull request!