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 -->
10 - [Debian / Ubuntu and derivatives](#debian--ubuntu-and-derivatives)
11 - [Arch Linux](#arch-linux)
12 - [CentOS 7](#centos-7)
13 - [Centos 8](#centos-8)
14 - [Rocky Linux 8.4](#rocky-linux-84)
16 - [Red Hat Enterprise Linux 8](#red-hat-enterprise-linux-8)
21 - [Other distributions](#other-distributions)
23 <!-- END doctoc generated TOC please keep comment here to allow auto update -->
25 ## Debian / Ubuntu and derivatives
27 1. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation
30 # apt-get install curl sudo unzip vim
33 2. It would be wise to disable root access and to continue this tutorial with a user with sudoers group access
35 3. Install NodeJS 14.x:
36 [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)
37 4. Install yarn, and be sure to have [a recent version](https://github.com/yarnpkg/yarn/releases/latest):
38 [https://yarnpkg.com/en/docs/install#linux-tab](https://yarnpkg.com/en/docs/install#linux-tab)
42 On Ubuntu <= bionic (18.04 LTS) or Debian <= Buster:
46 sudo apt install python-dev
47 python --version # Should be >= 2.x or >= 3.x
50 On Ubuntu >= focal (20.04 LTS) or Debian >= Bullseye:
54 sudo apt install python3-dev python-is-python3 # python-is-python2 should also work
55 python --version # Should be >= 2.x or >= 3.x
58 6. Install common dependencies:
62 sudo apt install certbot nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git cron wget
63 ffmpeg -version # Should be >= 4.1
64 g++ -v # Should be >= 5.x
67 Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
70 sudo systemctl start redis postgresql
78 sudo pacman -S nodejs-lts-fermium yarn ffmpeg postgresql openssl redis git wget unzip python base-devel npm nginx
81 Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
84 sudo systemctl start redis postgresql
89 1. Install NodeJS 12.x:
90 [https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
93 [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
95 3. Install or compile ffmpeg:
97 * Install - [https://linoxide.com/linux-how-to/install-ffmpeg-centos-7/](https://linoxide.com/linux-how-to/install-ffmpeg-centos-7/)
98 * Compile - [https://gist.github.com/mustafaturan/7053900#file-latest-ffmpeg-centos6-sh](https://gist.github.com/mustafaturan/7053900#file-latest-ffmpeg-centos6-sh)
104 sudo yum install epel-release centos-release-scl
106 sudo yum install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git devtoolset-7
109 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.
112 sudo scl enable devtoolset-7 bash
115 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:
118 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
121 6. Initialize the PostgreSQL database:
124 sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
127 Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
130 sudo systemctl enable --now redis
131 sudo systemctl enable --now postgresql
136 1. Install NodeJS 12.x:
137 [https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
140 [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
142 3. Install or compile ffmpeg:
144 * Install - [https://linuxize.com/post/how-to-install-ffmpeg-on-centos-8/](https://linuxize.com/post/how-to-install-ffmpeg-on-centos-8/)
150 sudo dnf install epel-release
152 sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
155 5. You'll need a symlink for python3 to python for youtube-dl to work
158 sudo ln -s /usr/bin/python3 /usr/bin/python
161 6. Initialize the PostgreSQL database:
164 sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
167 Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
170 sudo systemctl enable --now redis
171 sudo systemctl enable --now postgresql
176 1. Pull the latest updates:
181 2. Install NodeJS 12.x (or 14):
183 sudo dnf module install -y nodejs:12
188 sudo npm install --global yarn
191 4. Install or compile ffmpeg (if you want to compile... enjoy):
193 sudo dnf install -y epel-release
194 sudo dnf --enablerepo=powertools install -y SDL2 SDL2-devel
195 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
196 sudo dnf install -y ffmpeg
200 5. Install PostgreSQL and Python3 and other stuff:
202 sudo dnf install -y nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git python3
203 sudo ln -s /usr/bin/python3 /usr/bin/python
204 sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
205 sudo systemctl enable --now redis
206 sudo systemctl enable --now postgresql
209 6. Configure the peertube user:
211 sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
214 7. Unknown missing steps:
215 - Steps missing here... these were adapted from the CentOS 8 steps which abruptly ended.
216 - /var/www/peertube does not exist yet (expected? done in future steps? documentation?).
217 - Nothing about Certbot, NGINX, Firewall settings, and etc.
218 - Hopefully someone can suggest what is missing here with some hints so I can add it?
222 1. Upgrade your packages:
228 2. Add a user with sudoers group access:
231 useradd my-peertube-user
232 passwd my-peertube-user
233 usermod my-peertube-user -a -G wheel # Add my-peertube-user to sudoers
237 3. (Optional) Install certbot (choose instructions for your distribution):
238 [https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
240 4. Install NodeJS 12.x:
241 [https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora](https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora)
244 [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
246 6. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
249 sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
251 This is necessary because `ffmpeg` is not in the Fedora repos.
256 sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git vim
257 ffmpeg -version # Should be >= 4.1
258 g++ -v # Should be >= 5.x
264 sudo mkdir /etc/nginx/sites-available
265 sudo mkdir /etc/nginx/sites-enabled
266 sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
271 _from [PostgreSQL documentation](https://www.postgresql.org/download/linux/redhat/):_
272 > Due to policies for Red Hat family distributions, the PostgreSQL installation will not be enabled for automatic start or have the database initialized automatically.
276 sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
277 sudo systemctl enable postgresql.service
278 sudo systemctl start postgresql.service
280 sudo systemctl enable nginx.service
281 sudo systemctl start nginx.service
283 sudo systemctl enable redis.service
284 sudo systemctl start redis.service
289 By default, you cannot access your server via public IP. To do so, you must configure firewall:
291 - Ports used by peertube dev setup:
293 sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
294 sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
299 sudo firewall-cmd --permanent --zone=public --add-service=http
300 sudo firewall-cmd --permanent --zone=public --add-service=https
306 sudo firewall-cmd --reload
309 11. Configure max ports
311 This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
314 echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
317 [More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
319 ## Red Hat Enterprise Linux 8
321 1. Register system as root user to Red Hat Subscription Management (create a free Red Hat account if you don't have one yet).
324 # subscription-manager register --username <username> --password <password> --auto-attach
332 sudo dnf module install nodejs:12
338 curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
339 sudo dnf install yarn
345 sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-$(arch)-rpms"
346 sudo dnf install --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
347 sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
349 sudo dnf install ffmpeg
355 sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
358 6. You'll need a symlink for python3 to python for youtube-dl to work
361 sudo ln -s /usr/bin/python3 /usr/bin/python
364 7. Initialize the PostgreSQL database:
367 sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
370 Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
373 sudo systemctl enable --now redis
374 sudo systemctl enable --now postgresql
377 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:
382 sudo mkdir /etc/nginx/sites-available
383 sudo mkdir /etc/nginx/sites-enabled
384 sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
385 sudo systemctl enable --now nginx
390 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.
395 sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
398 sudo chmod 755 /var/www/peertube/
403 By default, you cannot access your server via public IP. To do so, you must configure firewall:
405 - Ports used by peertube dev setup:
407 sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
408 sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
413 sudo firewall-cmd --permanent --zone=public --add-service=http
414 sudo firewall-cmd --permanent --zone=public --add-service=https
420 sudo firewall-cmd --reload
423 11. Configure max ports
425 This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
428 echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
431 [More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
436 On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
438 1. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed):
443 pkg install -y sudo bash wget git python nginx pkgconf postgresql13-server postgresql13-contrib redis openssl node npm yarn ffmpeg unzip
446 2. Allow users in the wheel group (hope you don't forgot to add your user on wheel group!) to use sudo.
452 Uncomment the line 90
458 3. Enable nginx, redis, postgresql services and initialize database.
461 sysrc postgresql_enable="YES"
462 sysrc redis_enable="YES"
463 sysrc nginx_enable="YES"
466 Initialize database and start services
469 service postgresql initdb
470 service postgresql start
480 brew install bash ffmpeg nginx postgresql openssl gcc make redis git yarn
483 You may need to update your default version of bash.
485 **How to change your default shell**
488 which -a bash # Check where bash is installed
489 bash --version # You need a version at least as recent as 4.0
490 sudo vim /etc/shells # Add in this file : /usr/local/bin/bash
491 chsh -s /usr/local/bin/bash # To set the brew-installed bash as default bash
494 In a new shell, type `bash --version` to assert your changes took effect and
495 correctly modified your default bash version.
500 brew services run postgresql
501 brew services run redis
504 On macOS, the `postgresql` user can be `_postgres` instead of `postgres`.
505 If `sudo -u postgres createuser -P peertube` gives you an `unknown user: postgres` error, you can try `sudo -u _postgres createuser -U peertube`.
509 1. Add this to ``/etc/portage/sets/peertube``:
514 media-video/ffmpeg[x264] # Optionnally add vorbis,vpx
522 # Optional, client for Let’s Encrypt:
526 2. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn:
529 mkdir -p /etc/portage/package.keywords
530 cat << EOF >> /etc/portage/package.keywords/peertube
531 # required by yarn (argument) for PeerTube
536 3. Compile the peertube set:
542 4. Initialize the PostgreSQL database if you just merged it:
545 emerge --config postgresql
548 5. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot):
552 rc-update add postgresql-11
553 rc-service redis start
554 rc-service postgresql-11 start
562 pkg_add sudo bash wget git python nginx pkgconf postgresql-server postgresql-contrib redis openssl
568 npm install --global yarn
571 3. Allow users in the wheel group to use sudo
585 rcctl enable postgresql redis nginx
588 ## Other distributions
590 Feel free to update this file in a pull request!