]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - support/doc/dependencies.md
fix nginx units
[github/Chocobozzz/PeerTube.git] / support / doc / dependencies.md
... / ...
CommitLineData
1# Dependencies
2
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`.
4
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)
12- [CentOS 8](#centos-8)
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
21## Debian / Ubuntu and derivatives
22
231. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation
24
25```
26# apt-get install curl sudo unzip vim
27```
28
292. It would be wise to disable root access and to continue this tutorial with a user with sudoers group access
30
313. Install NodeJS 10.x:
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)
334. Install yarn, and be sure to have [a recent version](https://github.com/yarnpkg/yarn/releases/latest):
34[https://yarnpkg.com/en/docs/install#linux-tab](https://yarnpkg.com/en/docs/install#linux-tab)
35
365. Run:
37
38```
39sudo apt update
40sudo apt install certbot nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git python-dev
41ffmpeg -version # Should be >= 4.1
42g++ -v # Should be >= 5.x
43```
44
45Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
46
47```
48sudo systemctl start redis postgresql
49```
50
51## Arch Linux
52
531. Run:
54
55```
56sudo pacman -S nodejs-lts-dubnium yarn ffmpeg postgresql openssl redis git wget unzip python2 base-devel npm nginx
57```
58
59Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
60
61```
62sudo systemctl start redis postgresql
63```
64
65## CentOS 7
66
671. Install NodeJS 10.x:
68[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
69
702. Install yarn:
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
784. Install Packages:
79
80```
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
85```
86
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
89```
90sudo scl enable devtoolset-7 bash
91```
92
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```
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
97```
98
996. Initialize the PostgreSQL database:
100
101```
102sudo postgresql-setup initdb
103```
104
105Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
106
107```
108sudo systemctl enable --now redis
109sudo systemctl enable --now postgresql
110```
111
112## Centos 8
113
1141. Install NodeJS 10.x:
115[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
116
1172. Install yarn:
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
1244. Install packages:
125
126```
127sudo dnf update
128sudo dnf install epel-release
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
1396. Initialize the PostgreSQL database:
140
141```
142sudo postgresql-setup initdb
143```
144
145Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
146
147```
148sudo systemctl enable --now redis
149sudo systemctl enable --now postgresql
150```
151
152
153## Fedora
154
1551. Upgrade your packages:
156
157```
158dnf upgrade
159```
160
1612. Add a user with sudoers group access:
162
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```
169
1703. (Optional) Install certbot (choose instructions for your distribution):
171[https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
172
1734. Install NodeJS 10.x:
174[https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
175
1765. Install yarn:
177[https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
178
1796. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
180
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
1867. Run:
187
188```
189sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git
190ffmpeg -version # Should be >= 4.1
191g++ -v # Should be >= 5.x
192```
193
1948. Post-installation
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.
198
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```
211
2129. Firewall
213
214By default, you cannot access your server via public IP. To do so, you must configure firewall:
215
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```
226
22710. Configure max ports
228
229This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
230
231```
232echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
233```
234
235[More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
236
237## FreeBSD
238
239On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
240
2411. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed):
242
243```
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
247```
248
2492. Allow users in the wheel group (hope you don't forgot to add your user on wheel group!) to use sudo.
250
251```
252# visudo
253```
254
255Uncomment the line 90
256
257```
258%wheel ALL=(ALL) ALL
259```
260
2613. Enable nginx, redis, postgresql services and initialize database.
262
263```
264sysrc postgresql_enable="YES"
265sysrc redis_enable="YES"
266sysrc nginx_enable="YES"
267```
268
269Initialize database and start services
270
271```
272service postgresql initdb
273service postgresql start
274service redis start
275service nginx start
276```
277
278## macOS
279
2801. Add the packages:
281
282```
283brew install ffmpeg nginx postgresql openssl gcc make redis git yarn
284```
285
2862. Run the services:
287
288```
289brew services run postgresql
290brew services run redis
291```
292
293## Gentoo
294
2951. Add this to ``/etc/portage/sets/peertube``:
296
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
307
308# Optional, client for Let’s Encrypt:
309# app-crypt/certbot
310```
311
3122. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn:
313
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
3223. Compile the peertube set:
323
324```
325emerge -a @peertube
326```
327
3284. Initialize the PostgreSQL database if you just merged it:
329
330```
331emerge --config postgresql
332```
333
3345. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot):
335
336```
337rc-update add redis
338rc-update add postgresql-11
339rc-service redis start
340rc-service postgresql-11 start
341```
342
343## Other distributions
344
345Feel free to update this file in a pull request!