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