]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - support/doc/dependencies.md
Bumped to version v3.0.1
[github/Chocobozzz/PeerTube.git] / support / doc / dependencies.md
1 # Dependencies
2
3 Follow 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
23 1. 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
29 2. It would be wise to disable root access and to continue this tutorial with a user with sudoers group access
30
31 3. 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)
33 4. 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
36 5. Run:
37
38 ```
39 sudo apt update
40 sudo apt install certbot nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git python-dev
41 ffmpeg -version # Should be >= 4.1
42 g++ -v # Should be >= 5.x
43 ```
44
45 Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
46
47 ```
48 sudo systemctl start redis postgresql
49 ```
50
51 ## Arch Linux
52
53 1. Run:
54
55 ```
56 sudo pacman -S nodejs-lts-dubnium yarn ffmpeg postgresql openssl redis git wget unzip python2 base-devel npm nginx
57 ```
58
59 Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
60
61 ```
62 sudo systemctl start redis postgresql
63 ```
64
65 ## CentOS 7
66
67 1. 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
70 2. Install yarn:
71 [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
72
73 3. 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
78 4. Install Packages:
79
80 ```
81 sudo yum update
82 sudo yum install epel-release centos-release-scl
83 sudo yum update
84 sudo yum install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git devtoolset-7
85 ```
86
87 5. 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 ```
90 sudo scl enable devtoolset-7 bash
91 ```
92
93 Later 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 ```
96 sudo -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
99 6. Initialize the PostgreSQL database:
100
101 ```
102 sudo postgresql-setup initdb
103 ```
104
105 Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
106
107 ```
108 sudo systemctl enable --now redis
109 sudo systemctl enable --now postgresql
110 ```
111
112 ## Centos 8
113
114 1. 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
117 2. Install yarn:
118 [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
119
120 3. 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
124 4. Install packages:
125
126 ```
127 sudo dnf update
128 sudo dnf install epel-release
129 sudo dnf update
130 sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
131 ```
132
133 5. You'll need a symlink for python3 to python for youtube-dl to work
134
135 ```
136 sudo ln -s /usr/bin/python3 /usr/bin/python
137 ```
138
139 6. Initialize the PostgreSQL database:
140
141 ```
142 sudo postgresql-setup initdb
143 ```
144
145 Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
146
147 ```
148 sudo systemctl enable --now redis
149 sudo systemctl enable --now postgresql
150 ```
151
152
153 ## Fedora
154
155 1. Upgrade your packages:
156
157 ```
158 dnf upgrade
159 ```
160
161 2. Add a user with sudoers group access:
162
163 ```
164 useradd my-peertube-user
165 passwd my-peertube-user
166 usermod my-peertube-user -a -G wheel # Add my-peertube-user to sudoers
167 su my-peertube-user
168 ```
169
170 3. (Optional) Install certbot (choose instructions for your distribution):
171 [https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
172
173 4. 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
176 5. Install yarn:
177 [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
178
179 6. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
180
181 ```
182 sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
183 ```
184 This is necessary because `ffmpeg` is not in the Fedora repos.
185
186 7. Run:
187
188 ```
189 sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git
190 ffmpeg -version # Should be >= 4.1
191 g++ -v # Should be >= 5.x
192 ```
193
194 8. 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
201 sudo postgresql-setup initdb
202 sudo systemctl enable postgresql.service
203 sudo systemctl start postgresql.service
204 # Nginx
205 sudo systemctl enable nginx.service
206 sudo systemctl start nginx.service
207 # Redis
208 sudo systemctl enable redis.service
209 sudo systemctl start redis.service
210 ```
211
212 9. Firewall
213
214 By 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
218 sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
219 sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
220 # Optional
221 sudo firewall-cmd --permanent --zone=public --add-service=http
222 sudo firewall-cmd --permanent --zone=public --add-service=https
223 # Reload firewall
224 sudo firewall-cmd --reload
225 ```
226
227 10. Configure max ports
228
229 This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
230
231 ```
232 echo 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
239 On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
240
241 1. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed):
242
243 ```
244 pkg
245 pkg update
246 pkg install -y sudo bash wget git python nginx pkgconf vips postgresql96-server postgresql96-contrib redis openssl node npm yarn ffmpeg unzip
247 ```
248
249 2. 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
255 Uncomment the line 90
256
257 ```
258 %wheel ALL=(ALL) ALL
259 ```
260
261 3. Enable nginx, redis, postgresql services and initialize database.
262
263 ```
264 sysrc postgresql_enable="YES"
265 sysrc redis_enable="YES"
266 sysrc nginx_enable="YES"
267 ```
268
269 Initialize database and start services
270
271 ```
272 service postgresql initdb
273 service postgresql start
274 service redis start
275 service nginx start
276 ```
277
278 ## macOS
279
280 1. Add the packages:
281
282 ```
283 brew install ffmpeg nginx postgresql openssl gcc make redis git yarn
284 ```
285
286 2. Run the services:
287
288 ```
289 brew services run postgresql
290 brew services run redis
291 ```
292
293 ## Gentoo
294
295 1. Add this to ``/etc/portage/sets/peertube``:
296
297 ```
298 net-libs/nodejs
299 sys-apps/yarn
300 media-video/ffmpeg[x264] # Optionnally add vorbis,vpx
301 dev-db/postgresql
302 dev-db/redis
303 dev-vcs/git
304 app-arch/unzip
305 dev-lang/python:2.7
306 www-servers/nginx
307
308 # Optional, client for Let’s Encrypt:
309 # app-crypt/certbot
310 ```
311
312 2. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn:
313
314 ```
315 mkdir -p /etc/portage/package.keywords
316 cat << EOF >> /etc/portage/package.keywords/peertube
317 # required by yarn (argument) for PeerTube
318 sys-apps/yarn ~amd64
319 EOF
320 ```
321
322 3. Compile the peertube set:
323
324 ```
325 emerge -a @peertube
326 ```
327
328 4. Initialize the PostgreSQL database if you just merged it:
329
330 ```
331 emerge --config postgresql
332 ```
333
334 5. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot):
335
336 ```
337 rc-update add redis
338 rc-update add postgresql-11
339 rc-service redis start
340 rc-service postgresql-11 start
341 ```
342
343 ## Other distributions
344
345 Feel free to update this file in a pull request!