]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - support/doc/dependencies.md
Translated using Weblate (Vietnamese)
[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
154
0a314a99 155## Fedora
156
ab87af11
DK
1571. Upgrade your packages:
158
0a314a99 159```
160dnf upgrade
161```
ab87af11
DK
162
1632. Add a user with sudoers group access:
164
0a314a99 165```
166useradd my-peertube-user
167passwd my-peertube-user
168usermod my-peertube-user -a -G wheel # Add my-peertube-user to sudoers
169su my-peertube-user
170```
ab87af11 171
d8658f0f 1723. (Optional) Install certbot (choose instructions for your distribution):
0a314a99 173[https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
ab87af11 174
9162476f 1754. Install NodeJS 12.x:
0a314a99 176[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
ab87af11 177
f309a156 1785. Install yarn:
0a314a99 179[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
ab87af11
DK
180
1816. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
182
0a314a99 183```
184sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
185```
186This is necessary because `ffmpeg` is not in the Fedora repos.
187
ab87af11
DK
1887. Run:
189
0a314a99 190```
39072b2f 191sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git vim
f309a156 192ffmpeg -version # Should be >= 4.1
0a314a99 193g++ -v # Should be >= 5.x
194```
ab87af11 195
8182a370
FS
1968. Configure nginx
197
198```
199sudo mkdir /etc/nginx/sites-available
200sudo mkdir /etc/nginx/sites-enabled
201sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
202```
203
2049. Post-installation
0a314a99 205
206_from [PostgreSQL documentation](https://www.postgresql.org/download/linux/redhat/):_
207> 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 208
0a314a99 209```
210# PostgreSQL
39072b2f 211sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
0a314a99 212sudo systemctl enable postgresql.service
213sudo systemctl start postgresql.service
214# Nginx
215sudo systemctl enable nginx.service
216sudo systemctl start nginx.service
217# Redis
218sudo systemctl enable redis.service
219sudo systemctl start redis.service
220```
ab87af11 221
8182a370 22210. Firewall
0a314a99 223
51c35447 224By default, you cannot access your server via public IP. To do so, you must configure firewall:
ab87af11 225
0a314a99 226```
227# Ports used by peertube dev setup
228sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
229sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
230# Optional
231sudo firewall-cmd --permanent --zone=public --add-service=http
232sudo firewall-cmd --permanent --zone=public --add-service=https
233# Reload firewall
234sudo firewall-cmd --reload
235```
0a314a99 236
8182a370 23711. Configure max ports
ab87af11 238
f309a156 239This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
ab87af11 240
0a314a99 241```
242echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
243```
ab87af11 244
0a314a99 245[More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
246
4c86a254
GN
247## FreeBSD
248
249On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
250
f309a156 2511. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed):
ab87af11 252
4c86a254 253```
ab87af11
DK
254pkg
255pkg update
f6160062 256pkg install -y sudo bash wget git python nginx pkgconf postgresql13-server postgresql13-contrib redis openssl node npm yarn ffmpeg unzip
4c86a254
GN
257```
258
f309a156 2592. Allow users in the wheel group (hope you don't forgot to add your user on wheel group!) to use sudo.
ab87af11 260
4c86a254
GN
261```
262# visudo
263```
264
ab87af11 265Uncomment the line 90
f309a156 266
4c86a254
GN
267```
268%wheel ALL=(ALL) ALL
269```
270
f309a156 2713. Enable nginx, redis, postgresql services and initialize database.
4c86a254 272
4c86a254 273```
ab87af11
DK
274sysrc postgresql_enable="YES"
275sysrc redis_enable="YES"
276sysrc nginx_enable="YES"
4c86a254
GN
277```
278
ab87af11
DK
279Initialize database and start services
280
4c86a254 281```
ab87af11
DK
282service postgresql initdb
283service postgresql start
284service redis start
285service nginx start
4c86a254
GN
286```
287
2f7ac618 288## macOS
2f7ac618 289
ab87af11
DK
2901. Add the packages:
291
02d6226a
AV
292```sh
293brew install bash ffmpeg nginx postgresql openssl gcc make redis git yarn
ab87af11 294```
02d6226a
AV
295
296You may need to update your default version of bash.
297
298**How to change your default shell**
299
300```sh
301which -a bash # Check where bash is installed
302bash --version # You need a version at least as recent as 4.0
303sudo vim /etc/shells # Add in this file : /usr/local/bin/bash
304chsh -s /usr/local/bin/bash # To set the brew-installed bash as default bash
ab87af11
DK
305```
306
02d6226a
AV
307In a new shell, type `bash --version` to assert your changes took effect and
308correctly modified your default bash version.
309
ab87af11 3102. Run the services:
2f7ac618 311
02d6226a 312```sh
ab87af11
DK
313brew services run postgresql
314brew services run redis
315```
396f224b 316
02d6226a 317On macOS, the `postgresql` user can be `_postgres` instead of `postgres`.
ddc7d3ec 318If `sudo -u postgres createuser -P peertube` gives you an `unknown user: postgres` error, you can try `sudo -u _postgres createuser -U peertube`.
02d6226a 319
396f224b
HM
320## Gentoo
321
ab87af11
DK
3221. Add this to ``/etc/portage/sets/peertube``:
323
396f224b
HM
324```
325net-libs/nodejs
326sys-apps/yarn
327media-video/ffmpeg[x264] # Optionnally add vorbis,vpx
328dev-db/postgresql
329dev-db/redis
330dev-vcs/git
331app-arch/unzip
8182a370 332dev-lang/python
396f224b 333www-servers/nginx
396f224b 334
ab87af11 335# Optional, client for Let’s Encrypt:
396f224b 336# app-crypt/certbot
396f224b
HM
337```
338
ab87af11
DK
3392. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn:
340
bfc6bb94
W
341```
342mkdir -p /etc/portage/package.keywords
343cat << EOF >> /etc/portage/package.keywords/peertube
344# required by yarn (argument) for PeerTube
345sys-apps/yarn ~amd64
346EOF
347```
348
ab87af11
DK
3493. Compile the peertube set:
350
396f224b
HM
351```
352emerge -a @peertube
353```
354
ab87af11
DK
3554. Initialize the PostgreSQL database if you just merged it:
356
396f224b
HM
357```
358emerge --config postgresql
359```
360
ab87af11
DK
3615. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot):
362
396f224b
HM
363```
364rc-update add redis
c1109b45 365rc-update add postgresql-11
396f224b 366rc-service redis start
c1109b45 367rc-service postgresql-11 start
396f224b 368```
f309a156 369
80428d16
G
370## OpenBSD
371
3721. Install Packages:
373
374```
375pkg_add sudo bash wget git python nginx pkgconf postgresql-server postgresql-contrib redis openssl
376```
377
3782. Install yarn:
379
380```
381npm install --global yarn
382```
383
3843. Allow users in the wheel group to use sudo
385
386```
387visudo
388```
389Uncomment line #43:
390
391```
392%wheel ALL=(ALL) ALL
393```
394
3954. Enable services:
396
397```
398rcctl enable postgresql redis nginx
399```
400
afe81767 401## Other distributions
63bfad7e
C
402
403Feel free to update this file in a pull request!