]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - support/doc/dependencies.md
Update translations
[github/Chocobozzz/PeerTube.git] / support / doc / dependencies.md
CommitLineData
afe81767 1# Dependencies
63bfad7e 2
3dd6d6cd 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`.
867ed651 4
c9b36909
RK
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
92340699
RK
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)
59bc5f7d 14- [CentOS 8](#centos-8)
92340699 15- [Fedora](#fedora)
644800ef 16- [RHEL 8](#red-hat-enterprise-linux-8)
92340699
RK
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
e5203ffa 24## Debian / Ubuntu and derivatives
ab87af11
DK
25
261. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation
955f14a4 27
bc2fc1a7 28```
99402413 29# apt-get install curl sudo unzip vim
bc2fc1a7 30```
955f14a4 31
ab87af11
DK
322. It would be wise to disable root access and to continue this tutorial with a user with sudoers group access
33
1d840011 343. Install NodeJS 14.x:
ab87af11 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)
d8658f0f 364. Install yarn, and be sure to have [a recent version](https://github.com/yarnpkg/yarn/releases/latest):
ab87af11 37[https://yarnpkg.com/en/docs/install#linux-tab](https://yarnpkg.com/en/docs/install#linux-tab)
63bfad7e 38
d8658f0f 395. Run:
63bfad7e 40
afe81767 41```
ab87af11 42sudo apt update
3f8ae0e4 43sudo apt install certbot nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git python-dev cron wget
f309a156 44ffmpeg -version # Should be >= 4.1
ab87af11 45g++ -v # Should be >= 5.x
63bfad7e
C
46```
47
81cdf382 48Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
ab87af11 49
81cdf382 50```
ab87af11 51sudo systemctl start redis postgresql
81cdf382
RK
52```
53
afe81767 54## Arch Linux
63bfad7e 55
ab87af11 561. Run:
63bfad7e 57
afe81767 58```
d35f3a86 59sudo pacman -S nodejs-lts-fermium yarn ffmpeg postgresql openssl redis git wget unzip python2 base-devel npm nginx
63bfad7e
C
60```
61
81cdf382 62Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
ab87af11 63
81cdf382 64```
ab87af11 65sudo systemctl start redis postgresql
81cdf382
RK
66```
67
053ad3a3
EC
68## CentOS 7
69
9162476f 701. Install NodeJS 12.x:
ab87af11
DK
71[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
72
f309a156 732. Install yarn:
ab87af11
DK
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
f309a156 814. Install Packages:
053ad3a3
EC
82
83```
ab87af11
DK
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
0414ed10
O
88```
89
ab87af11
DK
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
4c86a254 92```
ab87af11 93sudo scl enable devtoolset-7 bash
053ad3a3
EC
94```
95
d4557fd3
RK
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```
ab87af11 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
d4557fd3
RK
100```
101
f309a156 1026. Initialize the PostgreSQL database:
ab87af11 103
f60e85ce 104```
39072b2f 105sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
f60e85ce
W
106```
107
f309a156 108Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
ab87af11 109
81cdf382 110```
a075cd00
CGI
111sudo systemctl enable --now redis
112sudo systemctl enable --now postgresql
81cdf382
RK
113```
114
a075cd00
CGI
115## Centos 8
116
9162476f 1171. Install NodeJS 12.x:
a075cd00
CGI
118[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
119
f309a156 1202. Install yarn:
a075cd00
CGI
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
f309a156 1274. Install packages:
a075cd00
CGI
128
129```
130sudo dnf update
f309a156 131sudo dnf install epel-release
a075cd00
CGI
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
f309a156 1426. Initialize the PostgreSQL database:
a075cd00
CGI
143
144```
39072b2f 145sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
a075cd00
CGI
146```
147
f309a156 148Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
a075cd00
CGI
149
150```
151sudo systemctl enable --now redis
152sudo systemctl enable --now postgresql
153```
154
d35f3a86 155## Rocky Linux 8.4
f68d1cb6 156
d35f3a86 1571. Pull the latest updates:
f68d1cb6
W
158```
159sudo dnf update -y
160```
161
d35f3a86 1622. Install NodeJS 12.x (why 12 and not 14? Not sure...):
f68d1cb6
W
163```
164sudo dnf module install -y nodejs:12
165```
166
d35f3a86 1673. Install yarn:
f68d1cb6
W
168```
169sudo npm install --global yarn
170```
171
d35f3a86 1724. Install or compile ffmpeg (if you want to compile... enjoy):
f68d1cb6 173```
d35f3a86 174sudo dnf install -y epel-release
f68d1cb6
W
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:
d35f3a86
C
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?
a075cd00 200
0a314a99 201## Fedora
202
ab87af11
DK
2031. Upgrade your packages:
204
0a314a99 205```
206dnf upgrade
207```
ab87af11
DK
208
2092. Add a user with sudoers group access:
210
0a314a99 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```
ab87af11 217
d8658f0f 2183. (Optional) Install certbot (choose instructions for your distribution):
0a314a99 219[https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
ab87af11 220
9162476f 2214. Install NodeJS 12.x:
0a314a99 222[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
ab87af11 223
f309a156 2245. Install yarn:
0a314a99 225[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
ab87af11
DK
226
2276. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
228
0a314a99 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
ab87af11
DK
2347. Run:
235
0a314a99 236```
39072b2f 237sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git vim
f309a156 238ffmpeg -version # Should be >= 4.1
0a314a99 239g++ -v # Should be >= 5.x
240```
ab87af11 241
8182a370
FS
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
0a314a99 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.
ab87af11 254
0a314a99 255```
256# PostgreSQL
39072b2f 257sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
0a314a99 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```
ab87af11 267
8182a370 26810. Firewall
0a314a99 269
51c35447 270By default, you cannot access your server via public IP. To do so, you must configure firewall:
ab87af11 271
644800ef 272- Ports used by peertube dev setup:
0a314a99 273```
0a314a99 274sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
275sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
644800ef
FS
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```
0a314a99 394sudo firewall-cmd --permanent --zone=public --add-service=http
395sudo firewall-cmd --permanent --zone=public --add-service=https
644800ef
FS
396```
397
398- Reload firewall
399
400```
0a314a99 401sudo firewall-cmd --reload
402```
0a314a99 403
8182a370 40411. Configure max ports
ab87af11 405
f309a156 406This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
ab87af11 407
0a314a99 408```
409echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
410```
ab87af11 411
0a314a99 412[More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
413
644800ef 414
4c86a254
GN
415## FreeBSD
416
417On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
418
f309a156 4191. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed):
ab87af11 420
4c86a254 421```
ab87af11
DK
422pkg
423pkg update
f6160062 424pkg install -y sudo bash wget git python nginx pkgconf postgresql13-server postgresql13-contrib redis openssl node npm yarn ffmpeg unzip
4c86a254
GN
425```
426
f309a156 4272. Allow users in the wheel group (hope you don't forgot to add your user on wheel group!) to use sudo.
ab87af11 428
4c86a254
GN
429```
430# visudo
431```
432
ab87af11 433Uncomment the line 90
f309a156 434
4c86a254
GN
435```
436%wheel ALL=(ALL) ALL
437```
438
f309a156 4393. Enable nginx, redis, postgresql services and initialize database.
4c86a254 440
4c86a254 441```
ab87af11
DK
442sysrc postgresql_enable="YES"
443sysrc redis_enable="YES"
444sysrc nginx_enable="YES"
4c86a254
GN
445```
446
ab87af11
DK
447Initialize database and start services
448
4c86a254 449```
ab87af11
DK
450service postgresql initdb
451service postgresql start
452service redis start
453service nginx start
4c86a254
GN
454```
455
2f7ac618 456## macOS
2f7ac618 457
ab87af11
DK
4581. Add the packages:
459
02d6226a
AV
460```sh
461brew install bash ffmpeg nginx postgresql openssl gcc make redis git yarn
ab87af11 462```
02d6226a
AV
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
ab87af11
DK
473```
474
d35f3a86 475In a new shell, type `bash --version` to assert your changes took effect and
02d6226a
AV
476correctly modified your default bash version.
477
ab87af11 4782. Run the services:
2f7ac618 479
02d6226a 480```sh
ab87af11
DK
481brew services run postgresql
482brew services run redis
483```
396f224b 484
02d6226a 485On macOS, the `postgresql` user can be `_postgres` instead of `postgres`.
ddc7d3ec 486If `sudo -u postgres createuser -P peertube` gives you an `unknown user: postgres` error, you can try `sudo -u _postgres createuser -U peertube`.
02d6226a 487
396f224b
HM
488## Gentoo
489
ab87af11
DK
4901. Add this to ``/etc/portage/sets/peertube``:
491
396f224b
HM
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
8182a370 500dev-lang/python
396f224b 501www-servers/nginx
396f224b 502
ab87af11 503# Optional, client for Let’s Encrypt:
396f224b 504# app-crypt/certbot
396f224b
HM
505```
506
ab87af11
DK
5072. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn:
508
bfc6bb94
W
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
ab87af11
DK
5173. Compile the peertube set:
518
396f224b
HM
519```
520emerge -a @peertube
521```
522
ab87af11
DK
5234. Initialize the PostgreSQL database if you just merged it:
524
396f224b
HM
525```
526emerge --config postgresql
527```
528
ab87af11
DK
5295. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot):
530
396f224b
HM
531```
532rc-update add redis
c1109b45 533rc-update add postgresql-11
396f224b 534rc-service redis start
c1109b45 535rc-service postgresql-11 start
396f224b 536```
f309a156 537
80428d16
G
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
afe81767 569## Other distributions
63bfad7e
C
570
571Feel free to update this file in a pull request!