]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - support/doc/dependencies.md
Embed stats only when needed
[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
RK
15- [Fedora](#fedora)
16- [FreeBSD](#freebsd)
17- [macOS](#macos)
18- [Gentoo](#gentoo)
19- [Other distributions](#other-distributions)
20
21<!-- END doctoc generated TOC please keep comment here to allow auto update -->
22
e5203ffa 23## Debian / Ubuntu and derivatives
ab87af11
DK
24
251. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation
955f14a4 26
bc2fc1a7 27```
99402413 28# apt-get install curl sudo unzip vim
bc2fc1a7 29```
955f14a4 30
ab87af11
DK
312. It would be wise to disable root access and to continue this tutorial with a user with sudoers group access
32
1d840011 333. Install NodeJS 14.x:
ab87af11 34[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 354. Install yarn, and be sure to have [a recent version](https://github.com/yarnpkg/yarn/releases/latest):
ab87af11 36[https://yarnpkg.com/en/docs/install#linux-tab](https://yarnpkg.com/en/docs/install#linux-tab)
63bfad7e 37
d8658f0f 385. Run:
63bfad7e 39
afe81767 40```
ab87af11 41sudo apt update
3f8ae0e4 42sudo apt install certbot nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git python-dev cron wget
f309a156 43ffmpeg -version # Should be >= 4.1
ab87af11 44g++ -v # Should be >= 5.x
63bfad7e
C
45```
46
81cdf382 47Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
ab87af11 48
81cdf382 49```
ab87af11 50sudo systemctl start redis postgresql
81cdf382
RK
51```
52
afe81767 53## Arch Linux
63bfad7e 54
ab87af11 551. Run:
63bfad7e 56
afe81767 57```
ab87af11 58sudo pacman -S nodejs-lts-dubnium yarn ffmpeg postgresql openssl redis git wget unzip python2 base-devel npm nginx
63bfad7e
C
59```
60
81cdf382 61Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
ab87af11 62
81cdf382 63```
ab87af11 64sudo systemctl start redis postgresql
81cdf382
RK
65```
66
053ad3a3
EC
67## CentOS 7
68
9162476f 691. Install NodeJS 12.x:
ab87af11
DK
70[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
71
f309a156 722. Install yarn:
ab87af11
DK
73[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
74
753. Install or compile ffmpeg:
76
77* Install - [https://linoxide.com/linux-how-to/install-ffmpeg-centos-7/](https://linoxide.com/linux-how-to/install-ffmpeg-centos-7/)
78* Compile - [https://gist.github.com/mustafaturan/7053900#file-latest-ffmpeg-centos6-sh](https://gist.github.com/mustafaturan/7053900#file-latest-ffmpeg-centos6-sh)
79
f309a156 804. Install Packages:
053ad3a3
EC
81
82```
ab87af11
DK
83sudo yum update
84sudo yum install epel-release centos-release-scl
85sudo yum update
86sudo yum install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git devtoolset-7
0414ed10
O
87```
88
ab87af11
DK
895. 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.
90
4c86a254 91```
ab87af11 92sudo scl enable devtoolset-7 bash
053ad3a3
EC
93```
94
d4557fd3
RK
95Later 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:
96
97```
ab87af11 98sudo -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
99```
100
f309a156 1016. Initialize the PostgreSQL database:
ab87af11 102
f60e85ce 103```
39072b2f 104sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
f60e85ce
W
105```
106
f309a156 107Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
ab87af11 108
81cdf382 109```
a075cd00
CGI
110sudo systemctl enable --now redis
111sudo systemctl enable --now postgresql
81cdf382
RK
112```
113
a075cd00
CGI
114## Centos 8
115
9162476f 1161. Install NodeJS 12.x:
a075cd00
CGI
117[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
118
f309a156 1192. Install yarn:
a075cd00
CGI
120[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
121
1223. Install or compile ffmpeg:
123
124* Install - [https://linuxize.com/post/how-to-install-ffmpeg-on-centos-8/](https://linuxize.com/post/how-to-install-ffmpeg-on-centos-8/)
125
f309a156 1264. Install packages:
a075cd00
CGI
127
128```
129sudo dnf update
f309a156 130sudo dnf install epel-release
a075cd00
CGI
131sudo dnf update
132sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
133```
134
1355. You'll need a symlink for python3 to python for youtube-dl to work
136
137```
138sudo ln -s /usr/bin/python3 /usr/bin/python
139```
140
f309a156 1416. Initialize the PostgreSQL database:
a075cd00
CGI
142
143```
39072b2f 144sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
a075cd00
CGI
145```
146
f309a156 147Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
a075cd00
CGI
148
149```
150sudo systemctl enable --now redis
151sudo systemctl enable --now postgresql
152```
153
f68d1cb6
W
154## Rocky Linux 8.4
155
1561. Pull the latest updates:
157```
158sudo dnf update -y
159```
160
1612. Install NodeJS 12.x (why 12 and not 14? Not sure...):
162```
163sudo dnf module install -y nodejs:12
164```
165
1663. Install yarn:
167```
168sudo npm install --global yarn
169```
170
1714. Install or compile ffmpeg (if you want to compile... enjoy):
172```
173sudo dnf install -y epel-release
174sudo dnf --enablerepo=powertools install -y SDL2 SDL2-devel
175sudo 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
176sudo dnf install -y ffmpeg
177sudo dnf update -y
178```
179
1805. Install PostgreSQL and Python3 and other stuff:
181```
182sudo dnf install -y nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git python3
183sudo ln -s /usr/bin/python3 /usr/bin/python
184sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
185sudo systemctl enable --now redis
186sudo systemctl enable --now postgresql
187```
188
1896. Configure the peertube user:
190```
191sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
192```
193
1947. Unknown missing steps:
195- Steps missing here... these were adapted from the CentOS 8 steps which abruptly ended.
196- /var/www/peertube does not exist yet (expected? done in future steps? documentation?).
197- Nothing about Certbot, NGINX, Firewall settings, and etc.
198- Hopefully someone can suggest what is missing here with some hints so I can add it?
a075cd00 199
0a314a99 200## Fedora
201
ab87af11
DK
2021. Upgrade your packages:
203
0a314a99 204```
205dnf upgrade
206```
ab87af11
DK
207
2082. Add a user with sudoers group access:
209
0a314a99 210```
211useradd my-peertube-user
212passwd my-peertube-user
213usermod my-peertube-user -a -G wheel # Add my-peertube-user to sudoers
214su my-peertube-user
215```
ab87af11 216
d8658f0f 2173. (Optional) Install certbot (choose instructions for your distribution):
0a314a99 218[https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
ab87af11 219
9162476f 2204. Install NodeJS 12.x:
0a314a99 221[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
ab87af11 222
f309a156 2235. Install yarn:
0a314a99 224[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
ab87af11
DK
225
2266. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
227
0a314a99 228```
229sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
230```
231This is necessary because `ffmpeg` is not in the Fedora repos.
232
ab87af11
DK
2337. Run:
234
0a314a99 235```
39072b2f 236sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git vim
f309a156 237ffmpeg -version # Should be >= 4.1
0a314a99 238g++ -v # Should be >= 5.x
239```
ab87af11 240
8182a370
FS
2418. Configure nginx
242
243```
244sudo mkdir /etc/nginx/sites-available
245sudo mkdir /etc/nginx/sites-enabled
246sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
247```
248
2499. Post-installation
0a314a99 250
251_from [PostgreSQL documentation](https://www.postgresql.org/download/linux/redhat/):_
252> 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 253
0a314a99 254```
255# PostgreSQL
39072b2f 256sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
0a314a99 257sudo systemctl enable postgresql.service
258sudo systemctl start postgresql.service
259# Nginx
260sudo systemctl enable nginx.service
261sudo systemctl start nginx.service
262# Redis
263sudo systemctl enable redis.service
264sudo systemctl start redis.service
265```
ab87af11 266
8182a370 26710. Firewall
0a314a99 268
51c35447 269By default, you cannot access your server via public IP. To do so, you must configure firewall:
ab87af11 270
0a314a99 271```
272# Ports used by peertube dev setup
273sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
274sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
275# Optional
276sudo firewall-cmd --permanent --zone=public --add-service=http
277sudo firewall-cmd --permanent --zone=public --add-service=https
278# Reload firewall
279sudo firewall-cmd --reload
280```
0a314a99 281
8182a370 28211. Configure max ports
ab87af11 283
f309a156 284This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
ab87af11 285
0a314a99 286```
287echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
288```
ab87af11 289
0a314a99 290[More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
291
4c86a254
GN
292## FreeBSD
293
294On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
295
f309a156 2961. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed):
ab87af11 297
4c86a254 298```
ab87af11
DK
299pkg
300pkg update
f6160062 301pkg install -y sudo bash wget git python nginx pkgconf postgresql13-server postgresql13-contrib redis openssl node npm yarn ffmpeg unzip
4c86a254
GN
302```
303
f309a156 3042. Allow users in the wheel group (hope you don't forgot to add your user on wheel group!) to use sudo.
ab87af11 305
4c86a254
GN
306```
307# visudo
308```
309
ab87af11 310Uncomment the line 90
f309a156 311
4c86a254
GN
312```
313%wheel ALL=(ALL) ALL
314```
315
f309a156 3163. Enable nginx, redis, postgresql services and initialize database.
4c86a254 317
4c86a254 318```
ab87af11
DK
319sysrc postgresql_enable="YES"
320sysrc redis_enable="YES"
321sysrc nginx_enable="YES"
4c86a254
GN
322```
323
ab87af11
DK
324Initialize database and start services
325
4c86a254 326```
ab87af11
DK
327service postgresql initdb
328service postgresql start
329service redis start
330service nginx start
4c86a254
GN
331```
332
2f7ac618 333## macOS
2f7ac618 334
ab87af11
DK
3351. Add the packages:
336
02d6226a
AV
337```sh
338brew install bash ffmpeg nginx postgresql openssl gcc make redis git yarn
ab87af11 339```
02d6226a
AV
340
341You may need to update your default version of bash.
342
343**How to change your default shell**
344
345```sh
346which -a bash # Check where bash is installed
347bash --version # You need a version at least as recent as 4.0
348sudo vim /etc/shells # Add in this file : /usr/local/bin/bash
349chsh -s /usr/local/bin/bash # To set the brew-installed bash as default bash
ab87af11
DK
350```
351
02d6226a
AV
352In a new shell, type `bash --version` to assert your changes took effect and
353correctly modified your default bash version.
354
ab87af11 3552. Run the services:
2f7ac618 356
02d6226a 357```sh
ab87af11
DK
358brew services run postgresql
359brew services run redis
360```
396f224b 361
02d6226a 362On macOS, the `postgresql` user can be `_postgres` instead of `postgres`.
ddc7d3ec 363If `sudo -u postgres createuser -P peertube` gives you an `unknown user: postgres` error, you can try `sudo -u _postgres createuser -U peertube`.
02d6226a 364
396f224b
HM
365## Gentoo
366
ab87af11
DK
3671. Add this to ``/etc/portage/sets/peertube``:
368
396f224b
HM
369```
370net-libs/nodejs
371sys-apps/yarn
372media-video/ffmpeg[x264] # Optionnally add vorbis,vpx
373dev-db/postgresql
374dev-db/redis
375dev-vcs/git
376app-arch/unzip
8182a370 377dev-lang/python
396f224b 378www-servers/nginx
396f224b 379
ab87af11 380# Optional, client for Let’s Encrypt:
396f224b 381# app-crypt/certbot
396f224b
HM
382```
383
ab87af11
DK
3842. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn:
385
bfc6bb94
W
386```
387mkdir -p /etc/portage/package.keywords
388cat << EOF >> /etc/portage/package.keywords/peertube
389# required by yarn (argument) for PeerTube
390sys-apps/yarn ~amd64
391EOF
392```
393
ab87af11
DK
3943. Compile the peertube set:
395
396f224b
HM
396```
397emerge -a @peertube
398```
399
ab87af11
DK
4004. Initialize the PostgreSQL database if you just merged it:
401
396f224b
HM
402```
403emerge --config postgresql
404```
405
ab87af11
DK
4065. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot):
407
396f224b
HM
408```
409rc-update add redis
c1109b45 410rc-update add postgresql-11
396f224b 411rc-service redis start
c1109b45 412rc-service postgresql-11 start
396f224b 413```
f309a156 414
80428d16
G
415## OpenBSD
416
4171. Install Packages:
418
419```
420pkg_add sudo bash wget git python nginx pkgconf postgresql-server postgresql-contrib redis openssl
421```
422
4232. Install yarn:
424
425```
426npm install --global yarn
427```
428
4293. Allow users in the wheel group to use sudo
430
431```
432visudo
433```
434Uncomment line #43:
435
436```
437%wheel ALL=(ALL) ALL
438```
439
4404. Enable services:
441
442```
443rcctl enable postgresql redis nginx
444```
445
afe81767 446## Other distributions
63bfad7e
C
447
448Feel free to update this file in a pull request!