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`.
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.
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 -->
11 - [Debian / Ubuntu and derivatives](#debian--ubuntu-and-derivatives)
12 - [Arch Linux](#arch-linux)
13 - [CentOS 7](#centos-7)
14 - [CentOS 8](#centos-8)
16 - [RHEL 8](#red-hat-enterprise-linux-8)
20 - [Other distributions](#other-distributions)
22 <!-- END doctoc generated TOC please keep comment here to allow auto update -->
24 ## Debian / Ubuntu and derivatives
26 1. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation
29 # apt-get install curl sudo unzip vim
32 2. It would be wise to disable root access and to continue this tutorial with a user with sudoers group access
34 3. Install NodeJS 14.x:
35 [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)
36 4. Install yarn, and be sure to have [a recent version](https://github.com/yarnpkg/yarn/releases/latest):
37 [https://yarnpkg.com/en/docs/install#linux-tab](https://yarnpkg.com/en/docs/install#linux-tab)
43 sudo apt install certbot nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git python-dev cron wget
44 ffmpeg -version # Should be >= 4.1
45 g++ -v # Should be >= 5.x
48 Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
51 sudo systemctl start redis postgresql
59 sudo pacman -S nodejs-lts-fermium yarn ffmpeg postgresql openssl redis git wget unzip python2 base-devel npm nginx
62 Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
65 sudo systemctl start redis postgresql
70 1. Install NodeJS 12.x:
71 [https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
74 [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
76 3. Install or compile ffmpeg:
78 * Install - [https://linoxide.com/linux-how-to/install-ffmpeg-centos-7/](https://linoxide.com/linux-how-to/install-ffmpeg-centos-7/)
79 * Compile - [https://gist.github.com/mustafaturan/7053900#file-latest-ffmpeg-centos6-sh](https://gist.github.com/mustafaturan/7053900#file-latest-ffmpeg-centos6-sh)
85 sudo yum install epel-release centos-release-scl
87 sudo yum install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git devtoolset-7
90 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.
93 sudo scl enable devtoolset-7 bash
96 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:
99 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
102 6. Initialize the PostgreSQL database:
105 sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
108 Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
111 sudo systemctl enable --now redis
112 sudo systemctl enable --now postgresql
117 1. Install NodeJS 12.x:
118 [https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
121 [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
123 3. Install or compile ffmpeg:
125 * Install - [https://linuxize.com/post/how-to-install-ffmpeg-on-centos-8/](https://linuxize.com/post/how-to-install-ffmpeg-on-centos-8/)
131 sudo dnf install epel-release
133 sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
136 5. You'll need a symlink for python3 to python for youtube-dl to work
139 sudo ln -s /usr/bin/python3 /usr/bin/python
142 6. Initialize the PostgreSQL database:
145 sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
148 Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
151 sudo systemctl enable --now redis
152 sudo systemctl enable --now postgresql
157 1. Pull the latest updates:
162 2. Install NodeJS 12.x (or 14):
164 sudo dnf module install -y nodejs:12
169 sudo npm install --global yarn
172 4. Install or compile ffmpeg (if you want to compile... enjoy):
174 sudo dnf install -y epel-release
175 sudo dnf --enablerepo=powertools install -y SDL2 SDL2-devel
176 sudo dnf install -y --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm
177 sudo dnf install -y ffmpeg
181 5. Install PostgreSQL and Python3 and other stuff:
183 sudo dnf install -y nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git python3
184 sudo ln -s /usr/bin/python3 /usr/bin/python
185 sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
186 sudo systemctl enable --now redis
187 sudo systemctl enable --now postgresql
190 6. Configure the peertube user:
192 sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
195 7. Unknown missing steps:
196 - Steps missing here... these were adapted from the CentOS 8 steps which abruptly ended.
197 - /var/www/peertube does not exist yet (expected? done in future steps? documentation?).
198 - Nothing about Certbot, NGINX, Firewall settings, and etc.
199 - Hopefully someone can suggest what is missing here with some hints so I can add it?
203 1. Upgrade your packages:
209 2. Add a user with sudoers group access:
212 useradd my-peertube-user
213 passwd my-peertube-user
214 usermod my-peertube-user -a -G wheel # Add my-peertube-user to sudoers
218 3. (Optional) Install certbot (choose instructions for your distribution):
219 [https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
221 4. Install NodeJS 12.x:
222 [https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
225 [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
227 6. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
230 sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
232 This is necessary because `ffmpeg` is not in the Fedora repos.
237 sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git vim
238 ffmpeg -version # Should be >= 4.1
239 g++ -v # Should be >= 5.x
245 sudo mkdir /etc/nginx/sites-available
246 sudo mkdir /etc/nginx/sites-enabled
247 sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
252 _from [PostgreSQL documentation](https://www.postgresql.org/download/linux/redhat/):_
253 > Due to policies for Red Hat family distributions, the PostgreSQL installation will not be enabled for automatic start or have the database initialized automatically.
257 sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
258 sudo systemctl enable postgresql.service
259 sudo systemctl start postgresql.service
261 sudo systemctl enable nginx.service
262 sudo systemctl start nginx.service
264 sudo systemctl enable redis.service
265 sudo systemctl start redis.service
270 By default, you cannot access your server via public IP. To do so, you must configure firewall:
272 - Ports used by peertube dev setup:
274 sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
275 sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
280 sudo firewall-cmd --permanent --zone=public --add-service=http
281 sudo firewall-cmd --permanent --zone=public --add-service=https
287 sudo firewall-cmd --reload
290 11. Configure max ports
292 This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
295 echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
298 [More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
300 ## Red Hat Enterprise Linux 8
302 1. Register system as root user to Red Hat Subscription Management (create a free Red Hat account if you don't have one yet).
305 # subscription-manager register --username <username> --password <password> --auto-attach
313 sudo dnf module install nodejs:12
319 curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
320 sudo dnf install yarn
326 sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-$(arch)-rpms"
327 sudo dnf install --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
328 sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
330 sudo dnf install ffmpeg
336 sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
339 6. You'll need a symlink for python3 to python for youtube-dl to work
342 sudo ln -s /usr/bin/python3 /usr/bin/python
345 7. Initialize the PostgreSQL database:
348 sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
351 Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
354 sudo systemctl enable --now redis
355 sudo systemctl enable --now postgresql
358 If you are running the production guide, you also need to slightly pre-configure nginx, because nginx is packaged differently in the Red Hat family distributions:
363 sudo mkdir /etc/nginx/sites-available
364 sudo mkdir /etc/nginx/sites-enabled
365 sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
366 sudo systemctl enable --now nginx
371 To add the 'peertube' user, you first have to create the 'www' folder and once the 'peertube' user is added, you have to set the access permissions.
376 sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
379 sudo chmod 755 /var/www/peertube/
384 By default, you cannot access your server via public IP. To do so, you must configure firewall:
386 - Ports used by peertube dev setup:
388 sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
389 sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
394 sudo firewall-cmd --permanent --zone=public --add-service=http
395 sudo firewall-cmd --permanent --zone=public --add-service=https
401 sudo firewall-cmd --reload
404 11. Configure max ports
406 This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
409 echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
412 [More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
417 On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
419 1. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed):
424 pkg install -y sudo bash wget git python nginx pkgconf postgresql13-server postgresql13-contrib redis openssl node npm yarn ffmpeg unzip
427 2. Allow users in the wheel group (hope you don't forgot to add your user on wheel group!) to use sudo.
433 Uncomment the line 90
439 3. Enable nginx, redis, postgresql services and initialize database.
442 sysrc postgresql_enable="YES"
443 sysrc redis_enable="YES"
444 sysrc nginx_enable="YES"
447 Initialize database and start services
450 service postgresql initdb
451 service postgresql start
461 brew install bash ffmpeg nginx postgresql openssl gcc make redis git yarn
464 You may need to update your default version of bash.
466 **How to change your default shell**
469 which -a bash # Check where bash is installed
470 bash --version # You need a version at least as recent as 4.0
471 sudo vim /etc/shells # Add in this file : /usr/local/bin/bash
472 chsh -s /usr/local/bin/bash # To set the brew-installed bash as default bash
475 In a new shell, type `bash --version` to assert your changes took effect and
476 correctly modified your default bash version.
481 brew services run postgresql
482 brew services run redis
485 On macOS, the `postgresql` user can be `_postgres` instead of `postgres`.
486 If `sudo -u postgres createuser -P peertube` gives you an `unknown user: postgres` error, you can try `sudo -u _postgres createuser -U peertube`.
490 1. Add this to ``/etc/portage/sets/peertube``:
495 media-video/ffmpeg[x264] # Optionnally add vorbis,vpx
503 # Optional, client for Let’s Encrypt:
507 2. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn:
510 mkdir -p /etc/portage/package.keywords
511 cat << EOF >> /etc/portage/package.keywords/peertube
512 # required by yarn (argument) for PeerTube
517 3. Compile the peertube set:
523 4. Initialize the PostgreSQL database if you just merged it:
526 emerge --config postgresql
529 5. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot):
533 rc-update add postgresql-11
534 rc-service redis start
535 rc-service postgresql-11 start
543 pkg_add sudo bash wget git python nginx pkgconf postgresql-server postgresql-contrib redis openssl
549 npm install --global yarn
552 3. Allow users in the wheel group to use sudo
566 rcctl enable postgresql redis nginx
569 ## Other distributions
571 Feel free to update this file in a pull request!