]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - support/doc/dependencies.md
fix nginx units
[github/Chocobozzz/PeerTube.git] / support / doc / dependencies.md
CommitLineData
afe81767 1# Dependencies
63bfad7e 2
8e98e612 3Follow the below guides, and check their versions match [required external dependencies versions](https://github.com/Chocobozzz/PeerTube/blob/master/package.json#7). You can check them automatically via `sudo npx engineslist`.
867ed651 4
92340699
RK
5<!-- START doctoc generated TOC please keep comment here to allow auto update -->
6<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
7
8
9- [Debian / Ubuntu and derivatives](#debian--ubuntu-and-derivatives)
10- [Arch Linux](#arch-linux)
11- [CentOS 7](#centos-7)
59bc5f7d 12- [CentOS 8](#centos-8)
92340699
RK
13- [Fedora](#fedora)
14- [FreeBSD](#freebsd)
15- [macOS](#macos)
16- [Gentoo](#gentoo)
17- [Other distributions](#other-distributions)
18
19<!-- END doctoc generated TOC please keep comment here to allow auto update -->
20
e5203ffa 21## Debian / Ubuntu and derivatives
ab87af11
DK
22
231. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation
955f14a4 24
bc2fc1a7 25```
99402413 26# apt-get install curl sudo unzip vim
bc2fc1a7 27```
955f14a4 28
ab87af11
DK
292. It would be wise to disable root access and to continue this tutorial with a user with sudoers group access
30
d8658f0f 313. Install NodeJS 10.x:
ab87af11 32[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 334. Install yarn, and be sure to have [a recent version](https://github.com/yarnpkg/yarn/releases/latest):
ab87af11 34[https://yarnpkg.com/en/docs/install#linux-tab](https://yarnpkg.com/en/docs/install#linux-tab)
63bfad7e 35
d8658f0f 365. Run:
63bfad7e 37
afe81767 38```
ab87af11 39sudo apt update
d8658f0f 40sudo apt install certbot nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git python-dev
f309a156 41ffmpeg -version # Should be >= 4.1
ab87af11 42g++ -v # Should be >= 5.x
63bfad7e
C
43```
44
81cdf382 45Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
ab87af11 46
81cdf382 47```
ab87af11 48sudo systemctl start redis postgresql
81cdf382
RK
49```
50
afe81767 51## Arch Linux
63bfad7e 52
ab87af11 531. Run:
63bfad7e 54
afe81767 55```
ab87af11 56sudo pacman -S nodejs-lts-dubnium yarn ffmpeg postgresql openssl redis git wget unzip python2 base-devel npm nginx
63bfad7e
C
57```
58
81cdf382 59Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
ab87af11 60
81cdf382 61```
ab87af11 62sudo systemctl start redis postgresql
81cdf382
RK
63```
64
053ad3a3
EC
65## CentOS 7
66
f309a156 671. Install NodeJS 10.x:
ab87af11
DK
68[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
69
f309a156 702. Install yarn:
ab87af11
DK
71[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
72
733. Install or compile ffmpeg:
74
75* Install - [https://linoxide.com/linux-how-to/install-ffmpeg-centos-7/](https://linoxide.com/linux-how-to/install-ffmpeg-centos-7/)
76* Compile - [https://gist.github.com/mustafaturan/7053900#file-latest-ffmpeg-centos6-sh](https://gist.github.com/mustafaturan/7053900#file-latest-ffmpeg-centos6-sh)
77
f309a156 784. Install Packages:
053ad3a3
EC
79
80```
ab87af11
DK
81sudo yum update
82sudo yum install epel-release centos-release-scl
83sudo yum update
84sudo yum install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git devtoolset-7
0414ed10
O
85```
86
ab87af11
DK
875. 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.
88
4c86a254 89```
ab87af11 90sudo scl enable devtoolset-7 bash
053ad3a3
EC
91```
92
d4557fd3
RK
93Later 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:
94
95```
ab87af11 96sudo -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
97```
98
f309a156 996. Initialize the PostgreSQL database:
ab87af11 100
f60e85ce 101```
ab87af11 102sudo postgresql-setup initdb
f60e85ce
W
103```
104
f309a156 105Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
ab87af11 106
81cdf382 107```
a075cd00
CGI
108sudo systemctl enable --now redis
109sudo systemctl enable --now postgresql
81cdf382
RK
110```
111
a075cd00
CGI
112## Centos 8
113
f309a156 1141. Install NodeJS 10.x:
a075cd00
CGI
115[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
116
f309a156 1172. Install yarn:
a075cd00
CGI
118[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
119
1203. Install or compile ffmpeg:
121
122* Install - [https://linuxize.com/post/how-to-install-ffmpeg-on-centos-8/](https://linuxize.com/post/how-to-install-ffmpeg-on-centos-8/)
123
f309a156 1244. Install packages:
a075cd00
CGI
125
126```
127sudo dnf update
f309a156 128sudo dnf install epel-release
a075cd00
CGI
129sudo dnf update
130sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
131```
132
1335. You'll need a symlink for python3 to python for youtube-dl to work
134
135```
136sudo ln -s /usr/bin/python3 /usr/bin/python
137```
138
f309a156 1396. Initialize the PostgreSQL database:
a075cd00
CGI
140
141```
142sudo postgresql-setup initdb
143```
144
f309a156 145Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
a075cd00
CGI
146
147```
148sudo systemctl enable --now redis
149sudo systemctl enable --now postgresql
150```
151
152
0a314a99 153## Fedora
154
ab87af11
DK
1551. Upgrade your packages:
156
0a314a99 157```
158dnf upgrade
159```
ab87af11
DK
160
1612. Add a user with sudoers group access:
162
0a314a99 163```
164useradd my-peertube-user
165passwd my-peertube-user
166usermod my-peertube-user -a -G wheel # Add my-peertube-user to sudoers
167su my-peertube-user
168```
ab87af11 169
d8658f0f 1703. (Optional) Install certbot (choose instructions for your distribution):
0a314a99 171[https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
ab87af11 172
f309a156 1734. Install NodeJS 10.x:
0a314a99 174[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
ab87af11 175
f309a156 1765. Install yarn:
0a314a99 177[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
ab87af11
DK
178
1796. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
180
0a314a99 181```
182sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
183```
184This is necessary because `ffmpeg` is not in the Fedora repos.
185
ab87af11
DK
1867. Run:
187
0a314a99 188```
189sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git
f309a156 190ffmpeg -version # Should be >= 4.1
0a314a99 191g++ -v # Should be >= 5.x
192```
ab87af11
DK
193
1948. Post-installation
0a314a99 195
196_from [PostgreSQL documentation](https://www.postgresql.org/download/linux/redhat/):_
197> 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 198
0a314a99 199```
200# PostgreSQL
201sudo postgresql-setup initdb
202sudo systemctl enable postgresql.service
203sudo systemctl start postgresql.service
204# Nginx
205sudo systemctl enable nginx.service
206sudo systemctl start nginx.service
207# Redis
208sudo systemctl enable redis.service
209sudo systemctl start redis.service
210```
ab87af11
DK
211
2129. Firewall
0a314a99 213
51c35447 214By default, you cannot access your server via public IP. To do so, you must configure firewall:
ab87af11 215
0a314a99 216```
217# Ports used by peertube dev setup
218sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
219sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
220# Optional
221sudo firewall-cmd --permanent --zone=public --add-service=http
222sudo firewall-cmd --permanent --zone=public --add-service=https
223# Reload firewall
224sudo firewall-cmd --reload
225```
0a314a99 226
ab87af11
DK
22710. Configure max ports
228
f309a156 229This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
ab87af11 230
0a314a99 231```
232echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
233```
ab87af11 234
0a314a99 235[More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
236
4c86a254
GN
237## FreeBSD
238
239On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
240
f309a156 2411. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed):
ab87af11 242
4c86a254 243```
ab87af11
DK
244pkg
245pkg update
246pkg install -y sudo bash wget git python nginx pkgconf vips postgresql96-server postgresql96-contrib redis openssl node npm yarn ffmpeg unzip
4c86a254
GN
247```
248
f309a156 2492. Allow users in the wheel group (hope you don't forgot to add your user on wheel group!) to use sudo.
ab87af11 250
4c86a254
GN
251```
252# visudo
253```
254
ab87af11 255Uncomment the line 90
f309a156 256
4c86a254
GN
257```
258%wheel ALL=(ALL) ALL
259```
260
f309a156 2613. Enable nginx, redis, postgresql services and initialize database.
4c86a254 262
4c86a254 263```
ab87af11
DK
264sysrc postgresql_enable="YES"
265sysrc redis_enable="YES"
266sysrc nginx_enable="YES"
4c86a254
GN
267```
268
ab87af11
DK
269Initialize database and start services
270
4c86a254 271```
ab87af11
DK
272service postgresql initdb
273service postgresql start
274service redis start
275service nginx start
4c86a254
GN
276```
277
2f7ac618 278## macOS
2f7ac618 279
ab87af11
DK
2801. Add the packages:
281
282```
283brew install ffmpeg nginx postgresql openssl gcc make redis git yarn
284```
285
2862. Run the services:
2f7ac618 287
ab87af11
DK
288```
289brew services run postgresql
290brew services run redis
291```
396f224b
HM
292
293## Gentoo
294
ab87af11
DK
2951. Add this to ``/etc/portage/sets/peertube``:
296
396f224b
HM
297```
298net-libs/nodejs
299sys-apps/yarn
300media-video/ffmpeg[x264] # Optionnally add vorbis,vpx
301dev-db/postgresql
302dev-db/redis
303dev-vcs/git
304app-arch/unzip
305dev-lang/python:2.7
306www-servers/nginx
396f224b 307
ab87af11 308# Optional, client for Let’s Encrypt:
396f224b 309# app-crypt/certbot
396f224b
HM
310```
311
ab87af11
DK
3122. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn:
313
bfc6bb94
W
314```
315mkdir -p /etc/portage/package.keywords
316cat << EOF >> /etc/portage/package.keywords/peertube
317# required by yarn (argument) for PeerTube
318sys-apps/yarn ~amd64
319EOF
320```
321
ab87af11
DK
3223. Compile the peertube set:
323
396f224b
HM
324```
325emerge -a @peertube
326```
327
ab87af11
DK
3284. Initialize the PostgreSQL database if you just merged it:
329
396f224b
HM
330```
331emerge --config postgresql
332```
333
ab87af11
DK
3345. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot):
335
396f224b
HM
336```
337rc-update add redis
c1109b45 338rc-update add postgresql-11
396f224b 339rc-service redis start
c1109b45 340rc-service postgresql-11 start
396f224b 341```
f309a156 342
afe81767 343## Other distributions
63bfad7e
C
344
345Feel free to update this file in a pull request!