]>
Commit | Line | Data |
---|---|---|
1 | # Dependencies | |
2 | ||
3 | Follow 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`. | |
4 | ||
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 | ||
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) | |
14 | - [CentOS 8](#centos-8) | |
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 | ||
23 | ## Debian / Ubuntu and derivatives | |
24 | ||
25 | 1. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation | |
26 | ||
27 | ``` | |
28 | # apt-get install curl sudo unzip vim | |
29 | ``` | |
30 | ||
31 | 2. It would be wise to disable root access and to continue this tutorial with a user with sudoers group access | |
32 | ||
33 | 3. Install NodeJS 12.x: | |
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) | |
35 | 4. Install yarn, and be sure to have [a recent version](https://github.com/yarnpkg/yarn/releases/latest): | |
36 | [https://yarnpkg.com/en/docs/install#linux-tab](https://yarnpkg.com/en/docs/install#linux-tab) | |
37 | ||
38 | 5. Run: | |
39 | ||
40 | ``` | |
41 | sudo apt update | |
42 | sudo apt install certbot nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git python-dev cron wget | |
43 | ffmpeg -version # Should be >= 4.1 | |
44 | g++ -v # Should be >= 5.x | |
45 | ``` | |
46 | ||
47 | Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis: | |
48 | ||
49 | ``` | |
50 | sudo systemctl start redis postgresql | |
51 | ``` | |
52 | ||
53 | ## Arch Linux | |
54 | ||
55 | 1. Run: | |
56 | ||
57 | ``` | |
58 | sudo pacman -S nodejs-lts-dubnium yarn ffmpeg postgresql openssl redis git wget unzip python2 base-devel npm nginx | |
59 | ``` | |
60 | ||
61 | Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis: | |
62 | ||
63 | ``` | |
64 | sudo systemctl start redis postgresql | |
65 | ``` | |
66 | ||
67 | ## CentOS 7 | |
68 | ||
69 | 1. Install NodeJS 12.x: | |
70 | [https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora) | |
71 | ||
72 | 2. Install yarn: | |
73 | [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install) | |
74 | ||
75 | 3. 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 | ||
80 | 4. Install Packages: | |
81 | ||
82 | ``` | |
83 | sudo yum update | |
84 | sudo yum install epel-release centos-release-scl | |
85 | sudo yum update | |
86 | sudo yum install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git devtoolset-7 | |
87 | ``` | |
88 | ||
89 | 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. | |
90 | ||
91 | ``` | |
92 | sudo scl enable devtoolset-7 bash | |
93 | ``` | |
94 | ||
95 | 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: | |
96 | ||
97 | ``` | |
98 | 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 | |
99 | ``` | |
100 | ||
101 | 6. Initialize the PostgreSQL database: | |
102 | ||
103 | ``` | |
104 | sudo postgresql-setup initdb | |
105 | ``` | |
106 | ||
107 | Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis: | |
108 | ||
109 | ``` | |
110 | sudo systemctl enable --now redis | |
111 | sudo systemctl enable --now postgresql | |
112 | ``` | |
113 | ||
114 | ## Centos 8 | |
115 | ||
116 | 1. Install NodeJS 12.x: | |
117 | [https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora) | |
118 | ||
119 | 2. Install yarn: | |
120 | [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install) | |
121 | ||
122 | 3. 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 | ||
126 | 4. Install packages: | |
127 | ||
128 | ``` | |
129 | sudo dnf update | |
130 | sudo dnf install epel-release | |
131 | sudo dnf update | |
132 | sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git | |
133 | ``` | |
134 | ||
135 | 5. You'll need a symlink for python3 to python for youtube-dl to work | |
136 | ||
137 | ``` | |
138 | sudo ln -s /usr/bin/python3 /usr/bin/python | |
139 | ``` | |
140 | ||
141 | 6. Initialize the PostgreSQL database: | |
142 | ||
143 | ``` | |
144 | sudo postgresql-setup initdb | |
145 | ``` | |
146 | ||
147 | Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis: | |
148 | ||
149 | ``` | |
150 | sudo systemctl enable --now redis | |
151 | sudo systemctl enable --now postgresql | |
152 | ``` | |
153 | ||
154 | ||
155 | ## Fedora | |
156 | ||
157 | 1. Upgrade your packages: | |
158 | ||
159 | ``` | |
160 | dnf upgrade | |
161 | ``` | |
162 | ||
163 | 2. Add a user with sudoers group access: | |
164 | ||
165 | ``` | |
166 | useradd my-peertube-user | |
167 | passwd my-peertube-user | |
168 | usermod my-peertube-user -a -G wheel # Add my-peertube-user to sudoers | |
169 | su my-peertube-user | |
170 | ``` | |
171 | ||
172 | 3. (Optional) Install certbot (choose instructions for your distribution): | |
173 | [https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions) | |
174 | ||
175 | 4. Install NodeJS 12.x: | |
176 | [https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora) | |
177 | ||
178 | 5. Install yarn: | |
179 | [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install) | |
180 | ||
181 | 6. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp) | |
182 | ||
183 | ``` | |
184 | sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm | |
185 | ``` | |
186 | This is necessary because `ffmpeg` is not in the Fedora repos. | |
187 | ||
188 | 7. Run: | |
189 | ||
190 | ``` | |
191 | sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git vim oidentd | |
192 | ffmpeg -version # Should be >= 4.1 | |
193 | g++ -v # Should be >= 5.x | |
194 | ``` | |
195 | ||
196 | 8. Configure nginx | |
197 | ||
198 | ``` | |
199 | sudo mkdir /etc/nginx/sites-available | |
200 | sudo mkdir /etc/nginx/sites-enabled | |
201 | sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf | |
202 | ``` | |
203 | ||
204 | 9. Post-installation | |
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. | |
208 | ||
209 | ``` | |
210 | # PostgreSQL | |
211 | sudo postgresql-setup initdb | |
212 | sudo systemctl enable postgresql.service | |
213 | sudo systemctl start postgresql.service | |
214 | # Nginx | |
215 | sudo systemctl enable nginx.service | |
216 | sudo systemctl start nginx.service | |
217 | # Redis | |
218 | sudo systemctl enable redis.service | |
219 | sudo systemctl start redis.service | |
220 | # oidentd | |
221 | sudo systemctl enable oidentd.service | |
222 | sudo systemctl start oidentd.service | |
223 | ``` | |
224 | ||
225 | 10. Firewall | |
226 | ||
227 | By default, you cannot access your server via public IP. To do so, you must configure firewall: | |
228 | ||
229 | ``` | |
230 | # Ports used by peertube dev setup | |
231 | sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp | |
232 | sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp | |
233 | # Optional | |
234 | sudo firewall-cmd --permanent --zone=public --add-service=http | |
235 | sudo firewall-cmd --permanent --zone=public --add-service=https | |
236 | # Reload firewall | |
237 | sudo firewall-cmd --reload | |
238 | ``` | |
239 | ||
240 | 11. Configure max ports | |
241 | ||
242 | This is necessary if you are running dev setup, otherwise you will have errors with `nodemon` | |
243 | ||
244 | ``` | |
245 | echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p | |
246 | ``` | |
247 | ||
248 | [More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097) | |
249 | ||
250 | ## FreeBSD | |
251 | ||
252 | On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail: | |
253 | ||
254 | 1. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed): | |
255 | ||
256 | ``` | |
257 | pkg | |
258 | pkg update | |
259 | pkg install -y sudo bash wget git python nginx pkgconf postgresql13-server postgresql13-contrib redis openssl node npm yarn ffmpeg unzip | |
260 | ``` | |
261 | ||
262 | 2. Allow users in the wheel group (hope you don't forgot to add your user on wheel group!) to use sudo. | |
263 | ||
264 | ``` | |
265 | # visudo | |
266 | ``` | |
267 | ||
268 | Uncomment the line 90 | |
269 | ||
270 | ``` | |
271 | %wheel ALL=(ALL) ALL | |
272 | ``` | |
273 | ||
274 | 3. Enable nginx, redis, postgresql services and initialize database. | |
275 | ||
276 | ``` | |
277 | sysrc postgresql_enable="YES" | |
278 | sysrc redis_enable="YES" | |
279 | sysrc nginx_enable="YES" | |
280 | ``` | |
281 | ||
282 | Initialize database and start services | |
283 | ||
284 | ``` | |
285 | service postgresql initdb | |
286 | service postgresql start | |
287 | service redis start | |
288 | service nginx start | |
289 | ``` | |
290 | ||
291 | ## macOS | |
292 | ||
293 | 1. Add the packages: | |
294 | ||
295 | ```sh | |
296 | brew install bash ffmpeg nginx postgresql openssl gcc make redis git yarn | |
297 | ``` | |
298 | ||
299 | You may need to update your default version of bash. | |
300 | ||
301 | **How to change your default shell** | |
302 | ||
303 | ```sh | |
304 | which -a bash # Check where bash is installed | |
305 | bash --version # You need a version at least as recent as 4.0 | |
306 | sudo vim /etc/shells # Add in this file : /usr/local/bin/bash | |
307 | chsh -s /usr/local/bin/bash # To set the brew-installed bash as default bash | |
308 | ``` | |
309 | ||
310 | In a new shell, type `bash --version` to assert your changes took effect and | |
311 | correctly modified your default bash version. | |
312 | ||
313 | 2. Run the services: | |
314 | ||
315 | ```sh | |
316 | brew services run postgresql | |
317 | brew services run redis | |
318 | ``` | |
319 | ||
320 | On macOS, the `postgresql` user can be `_postgres` instead of `postgres`. | |
321 | If `sudo -u postgres createuser -P peertube` gives you an `unknown user: postgres` error, you can try `sudo -u _postgres createuser -U peertube`. | |
322 | ||
323 | ## Gentoo | |
324 | ||
325 | 1. Add this to ``/etc/portage/sets/peertube``: | |
326 | ||
327 | ``` | |
328 | net-libs/nodejs | |
329 | sys-apps/yarn | |
330 | media-video/ffmpeg[x264] # Optionnally add vorbis,vpx | |
331 | dev-db/postgresql | |
332 | dev-db/redis | |
333 | dev-vcs/git | |
334 | app-arch/unzip | |
335 | dev-lang/python | |
336 | www-servers/nginx | |
337 | ||
338 | # Optional, client for Let’s Encrypt: | |
339 | # app-crypt/certbot | |
340 | ``` | |
341 | ||
342 | 2. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn: | |
343 | ||
344 | ``` | |
345 | mkdir -p /etc/portage/package.keywords | |
346 | cat << EOF >> /etc/portage/package.keywords/peertube | |
347 | # required by yarn (argument) for PeerTube | |
348 | sys-apps/yarn ~amd64 | |
349 | EOF | |
350 | ``` | |
351 | ||
352 | 3. Compile the peertube set: | |
353 | ||
354 | ``` | |
355 | emerge -a @peertube | |
356 | ``` | |
357 | ||
358 | 4. Initialize the PostgreSQL database if you just merged it: | |
359 | ||
360 | ``` | |
361 | emerge --config postgresql | |
362 | ``` | |
363 | ||
364 | 5. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot): | |
365 | ||
366 | ``` | |
367 | rc-update add redis | |
368 | rc-update add postgresql-11 | |
369 | rc-service redis start | |
370 | rc-service postgresql-11 start | |
371 | ``` | |
372 | ||
373 | ## OpenBSD | |
374 | ||
375 | 1. Install Packages: | |
376 | ||
377 | ``` | |
378 | pkg_add sudo bash wget git python nginx pkgconf postgresql-server postgresql-contrib redis openssl | |
379 | ``` | |
380 | ||
381 | 2. Install yarn: | |
382 | ||
383 | ``` | |
384 | npm install --global yarn | |
385 | ``` | |
386 | ||
387 | 3. Allow users in the wheel group to use sudo | |
388 | ||
389 | ``` | |
390 | visudo | |
391 | ``` | |
392 | Uncomment line #43: | |
393 | ||
394 | ``` | |
395 | %wheel ALL=(ALL) ALL | |
396 | ``` | |
397 | ||
398 | 4. Enable services: | |
399 | ||
400 | ``` | |
401 | rcctl enable postgresql redis nginx | |
402 | ``` | |
403 | ||
404 | ## Other distributions | |
405 | ||
406 | Feel free to update this file in a pull request! |