ニジカ投稿局 https://tv.nizika.tv
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dependencies.md 16 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. # Dependencies
  2. :warning: **Warning**: dependencies guide is maintained by the community. Some parts may be outdated! :warning:
  3. Main dependencies supported by PeerTube:
  4. * `node` >=18.x
  5. * `yarn` 1.x (**must not be >=2.x**)
  6. * `postgres` >=10.x
  7. * `redis-server` >=6.x
  8. * `ffmpeg` >=4.3 (using a ffmpeg static build [is not recommended](https://github.com/Chocobozzz/PeerTube/issues/6308))
  9. * `python` >=3.x
  10. * `pip`
  11. _note_: only **LTS** versions of external dependencies are supported. If no LTS version matching the version constraint is available, only **release** versions are supported.
  12. <!-- START doctoc generated TOC please keep comment here to allow auto update -->
  13. <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
  14. - [Debian / Ubuntu and derivatives](#debian-ubuntu-and-derivatives)
  15. - [Arch Linux](#arch-linux)
  16. - [CentOS 7](#centos-7)
  17. - [Centos 8](#centos-8)
  18. - [Rocky Linux 8.4](#rocky-linux-84)
  19. - [Fedora](#fedora)
  20. - [Red Hat Enterprise Linux 8](#red-hat-enterprise-linux-8)
  21. - [FreeBSD](#freebsd)
  22. - [macOS](#macos)
  23. - [Gentoo](#gentoo)
  24. - [OpenBSD](#openbsd)
  25. - [Other distributions](#other-distributions)
  26. <!-- END doctoc generated TOC please keep comment here to allow auto update -->
  27. ## Debian / Ubuntu and derivatives
  28. 1. On a fresh Debian/Ubuntu, as root user, install basic utility programs needed for the installation
  29. ```
  30. # apt-get install curl sudo unzip vim
  31. ```
  32. 2. It would be wise to disable root access and to continue this tutorial with a user with sudoers group access. You can see a guide for how to do this in Debian/Ubuntu [here](https://www.digitalocean.com/community/tutorials/how-to-add-and-delete-users-on-ubuntu-20-04).
  33. 3. Install NodeJS 18.x:
  34. [https://nodejs.org/en/download/package-manager/all#debian-and-ubuntu-based-linux-distributions](https://nodejs.org/en/download/package-manager/all#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. 5. Install Python:
  38. On Ubuntu >= focal (20.04 LTS) or Debian >= Bullseye:
  39. ```
  40. sudo apt update
  41. sudo apt install python3-dev python3-pip python-is-python3
  42. python --version # Should be >= 3.x
  43. ```
  44. 6. Install common dependencies:
  45. ```
  46. sudo apt update
  47. sudo apt install certbot nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git cron wget
  48. ffmpeg -version # Should be >= 4.1
  49. g++ -v # Should be >= 5.x
  50. redis-server --version # Should be >= 6.x
  51. ```
  52. Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
  53. ```
  54. sudo systemctl start redis postgresql
  55. ```
  56. ## Arch Linux
  57. 1. Run:
  58. ```
  59. sudo pacman -S nodejs-lts-fermium yarn ffmpeg postgresql openssl redis git wget unzip python python-pip base-devel npm nginx
  60. ```
  61. Now that dependencies are installed, before running PeerTube you should start PostgreSQL and Redis:
  62. ```
  63. sudo systemctl start redis postgresql
  64. ```
  65. ## CentOS 7
  66. 1. Install NodeJS 18.x:
  67. [https://nodejs.org/en/download/package-manager/all#centos-fedora-and-red-hat-enterprise-linux](https://nodejs.org/en/download/package-manager/all#centos-fedora-and-red-hat-enterprise-linux)
  68. 2. Install yarn:
  69. [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
  70. 3. Install or compile ffmpeg:
  71. * Install - [https://linoxide.com/linux-how-to/install-ffmpeg-centos-7/](https://linoxide.com/linux-how-to/install-ffmpeg-centos-7/)
  72. * Compile - [https://gist.github.com/mustafaturan/7053900#file-latest-ffmpeg-centos6-sh](https://gist.github.com/mustafaturan/7053900#file-latest-ffmpeg-centos6-sh)
  73. 4. Install Packages:
  74. ```
  75. sudo yum update
  76. sudo yum install epel-release centos-release-scl
  77. sudo yum update
  78. sudo yum install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git devtoolset-7
  79. ```
  80. 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.
  81. ```
  82. sudo scl enable devtoolset-7 bash
  83. ```
  84. 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:
  85. ```
  86. 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
  87. ```
  88. 6. Initialize the PostgreSQL database:
  89. ```
  90. sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
  91. ```
  92. Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
  93. ```
  94. sudo systemctl enable --now redis
  95. sudo systemctl enable --now postgresql
  96. ```
  97. ## Centos 8
  98. 1. Install NodeJS 18.x:
  99. [https://nodejs.org/en/download/package-manager/all#centos-fedora-and-red-hat-enterprise-linux](https://nodejs.org/en/download/package-manager/all#centos-fedora-and-red-hat-enterprise-linux)
  100. 2. Install yarn:
  101. [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
  102. 3. Install or compile ffmpeg:
  103. ```
  104. sudo dnf install epel-release dnf-utils
  105. sudo yum-config-manager --set-enabled powertools
  106. sudo yum-config-manager --add-repo=https://negativo17.org/repos/epel-multimedia.repo
  107. sudo dnf install ffmpeg
  108. ```
  109. 4. Install packages:
  110. ```
  111. sudo dnf update
  112. sudo dnf install epel-release
  113. sudo dnf update
  114. sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git unzip
  115. ```
  116. 5. You'll need a symlink for python3 to python for youtube-dl to work
  117. ```
  118. sudo ln -s /usr/bin/python3 /usr/bin/python
  119. ```
  120. 6. Initialize the PostgreSQL database:
  121. ```
  122. sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
  123. ```
  124. Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
  125. ```
  126. sudo systemctl enable --now redis
  127. sudo systemctl enable --now postgresql
  128. ```
  129. ## Rocky Linux 8.4
  130. 1. Pull the latest updates:
  131. ```
  132. sudo dnf update -y
  133. ```
  134. 2. Install NodeJS 18.x:
  135. ```
  136. sudo dnf module install -y nodejs:18
  137. ```
  138. 3. Install yarn:
  139. ```
  140. sudo npm install --global yarn
  141. ```
  142. 4. Install or compile ffmpeg (if you want to compile... enjoy):
  143. ```
  144. sudo dnf install -y epel-release
  145. sudo dnf --enablerepo=powertools install -y SDL2 SDL2-devel
  146. 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
  147. sudo dnf install -y ffmpeg
  148. sudo dnf update -y
  149. ```
  150. 5. Install PostgreSQL and Python3 and other stuff:
  151. ```
  152. sudo dnf install -y nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git python3 python3-pip
  153. sudo ln -s /usr/bin/python3 /usr/bin/python
  154. sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
  155. sudo systemctl enable --now redis
  156. sudo systemctl enable --now postgresql
  157. ```
  158. 6. Configure the peertube user:
  159. ```
  160. sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
  161. ```
  162. 7. Unknown missing steps:
  163. - Steps missing here... these were adapted from the CentOS 8 steps which abruptly ended.
  164. - /var/www/peertube does not exist yet (expected? done in future steps? documentation?).
  165. - Nothing about Certbot, NGINX, Firewall settings, and etc.
  166. - Hopefully someone can suggest what is missing here with some hints so I can add it?
  167. ## Fedora
  168. 1. Upgrade your packages:
  169. ```
  170. dnf upgrade
  171. ```
  172. 2. Add a user with sudoers group access:
  173. ```
  174. useradd my-peertube-user
  175. passwd my-peertube-user
  176. usermod my-peertube-user -a -G wheel # Add my-peertube-user to sudoers
  177. su my-peertube-user
  178. ```
  179. 3. (Optional) Install certbot (choose instructions for your distribution):
  180. [https://certbot.eff.org/all-instructions](https://certbot.eff.org/all-instructions)
  181. 4. Install NodeJS 18.x:
  182. [https://nodejs.org/en/download/package-manager/all#centos-fedora-and-red-hat-enterprise-linux](https://nodejs.org/en/download/package-manager/all#centos-fedora-and-red-hat-enterprise-linux)
  183. 5. Install yarn:
  184. [https://yarnpkg.com/en/docs/install](https://yarnpkg.com/en/docs/install)
  185. 6. Enable [RPM Fusion](https://rpmfusion.org) for Fedora (available for x86, x86_64, armhfp)
  186. ```
  187. sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
  188. ```
  189. This is necessary because `ffmpeg` is not in the Fedora repos.
  190. 7. Run:
  191. ```
  192. sudo dnf install nginx ffmpeg postgresql-server postgresql-contrib openssl gcc-c++ make redis git vim
  193. ffmpeg -version # Should be >= 4.1
  194. g++ -v # Should be >= 5.x
  195. redis-server --version # Should be >= 6.x
  196. ```
  197. 8. Configure nginx
  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. 9. Post-installation
  204. _from [PostgreSQL documentation](https://www.postgresql.org/download/linux/redhat/):_
  205. > Due to policies for Red Hat family distributions, the PostgreSQL installation will not be enabled for automatic start or have the database initialized automatically.
  206. ```
  207. # PostgreSQL
  208. sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
  209. sudo systemctl enable postgresql.service
  210. sudo systemctl start postgresql.service
  211. # Nginx
  212. sudo systemctl enable nginx.service
  213. sudo systemctl start nginx.service
  214. # Redis
  215. sudo systemctl enable redis.service
  216. sudo systemctl start redis.service
  217. ```
  218. 10. Firewall
  219. By default, you cannot access your server via public IP. To do so, you must configure firewall:
  220. - Ports used by peertube dev setup:
  221. ```
  222. sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
  223. sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
  224. ```
  225. - Optional
  226. ```
  227. sudo firewall-cmd --permanent --zone=public --add-service=http
  228. sudo firewall-cmd --permanent --zone=public --add-service=https
  229. ```
  230. - Reload firewall
  231. ```
  232. sudo firewall-cmd --reload
  233. ```
  234. 11. Configure max ports
  235. This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
  236. ```
  237. echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
  238. ```
  239. [More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
  240. ## Red Hat Enterprise Linux 8
  241. 1. Register system as root user to Red Hat Subscription Management (create a free Red Hat account if you don't have one yet).
  242. ```
  243. # subscription-manager register --username <username> --password <password> --auto-attach
  244. # dnf upgrade
  245. # reboot
  246. ```
  247. 2. Install Node.JS
  248. ```
  249. sudo dnf module install nodejs:18
  250. ```
  251. 3. Install Yarn
  252. ```
  253. curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
  254. sudo dnf install yarn
  255. ```
  256. 4. Install FFmpeg
  257. ```
  258. sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-$(arch)-rpms"
  259. sudo dnf install --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
  260. sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
  261. sudo dnf upgrade
  262. sudo dnf install ffmpeg
  263. ```
  264. 5. Run:
  265. ```
  266. sudo dnf install nginx postgresql postgresql-server postgresql-contrib openssl gcc-c++ make wget redis git
  267. ```
  268. 6. You'll need a symlink for python3 to python for youtube-dl to work
  269. ```
  270. sudo alternatives --set python3 /usr/bin/python
  271. ```
  272. 7. Initialize the PostgreSQL database:
  273. ```
  274. sudo PGSETUP_INITDB_OPTIONS='--auth-host=md5' postgresql-setup --initdb --unit postgresql
  275. ```
  276. Now that dependencies are installed, before running PeerTube you should enable and start PostgreSQL and Redis:
  277. ```
  278. sudo systemctl enable --now redis
  279. sudo systemctl enable --now postgresql
  280. ```
  281. 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:
  282. 8. Configure nginx
  283. ```
  284. sudo mkdir /etc/nginx/sites-available
  285. sudo mkdir /etc/nginx/sites-enabled
  286. sudo ln -s /etc/nginx/sites-enabled/peertube /etc/nginx/conf.d/peertube.conf
  287. sudo systemctl enable --now nginx
  288. ```
  289. 9. Prepare directory
  290. 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.
  291. ```
  292. sudo mkdir /var/www
  293. sudo useradd -m -d /var/www/peertube -s /bin/bash -p peertube peertube
  294. sudo passwd peertube
  295. sudo chmod 755 /var/www/peertube/
  296. ```
  297. 10. Firewall
  298. By default, you cannot access your server via public IP. To do so, you must configure firewall:
  299. - Ports used by peertube dev setup:
  300. ```
  301. sudo firewall-cmd --permanent --zone=public --add-port=3000/tcp
  302. sudo firewall-cmd --permanent --zone=public --add-port=9000/tcp
  303. ```
  304. - Optional
  305. ```
  306. sudo firewall-cmd --permanent --zone=public --add-service=http
  307. sudo firewall-cmd --permanent --zone=public --add-service=https
  308. ```
  309. - Reload firewall
  310. ```
  311. sudo firewall-cmd --reload
  312. ```
  313. 11. Configure max ports
  314. This is necessary if you are running dev setup, otherwise you will have errors with `nodemon`
  315. ```
  316. echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
  317. ```
  318. [More info](https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc#34664097)
  319. ## FreeBSD
  320. On a fresh install of [FreeBSD](https://www.freebsd.org), new system or new jail:
  321. 1. bootstrap pkg, initialize db and install peertube's dependencies, always as root (sudo not yet installed):
  322. ```
  323. pkg
  324. pkg update
  325. pkg install -y sudo bash wget git python nginx pkgconf postgresql13-server postgresql13-contrib redis openssl node npm yarn ffmpeg unzip
  326. ```
  327. 2. Allow users in the wheel group (hope you don't forgot to add your user on wheel group!) to use sudo.
  328. ```
  329. # visudo
  330. ```
  331. Uncomment the line 90
  332. ```
  333. %wheel ALL=(ALL) ALL
  334. ```
  335. 3. Enable nginx, redis, postgresql services and initialize database.
  336. ```
  337. sysrc postgresql_enable="YES"
  338. sysrc redis_enable="YES"
  339. sysrc nginx_enable="YES"
  340. ```
  341. Initialize database and start services
  342. ```
  343. service postgresql initdb
  344. service postgresql start
  345. service redis start
  346. service nginx start
  347. ```
  348. ## macOS
  349. 1. Add the packages:
  350. ```sh
  351. brew install bash ffmpeg nginx postgresql openssl gcc make redis git yarn
  352. ```
  353. You may need to update your default version of bash.
  354. **How to change your default shell**
  355. ```sh
  356. which -a bash # Check where bash is installed
  357. bash --version # You need a version at least as recent as 4.0
  358. sudo vim /etc/shells # Add in this file : /usr/local/bin/bash
  359. chsh -s /usr/local/bin/bash # To set the brew-installed bash as default bash
  360. ```
  361. In a new shell, type `bash --version` to assert your changes took effect and
  362. correctly modified your default bash version.
  363. 2. Run the services:
  364. ```sh
  365. brew services run postgresql
  366. brew services run redis
  367. ```
  368. On macOS, the `postgresql` user can be `_postgres` instead of `postgres`.
  369. If `sudo -u postgres createuser -P peertube` gives you an `unknown user: postgres` error, you can try `sudo -u _postgres createuser -U peertube`.
  370. ## Gentoo
  371. 1. Add this to ``/etc/portage/sets/peertube``:
  372. ```
  373. net-libs/nodejs
  374. sys-apps/yarn
  375. media-video/ffmpeg[x264] # Optionally add vorbis,vpx
  376. dev-db/postgresql
  377. dev-db/redis
  378. dev-vcs/git
  379. app-arch/unzip
  380. dev-lang/python
  381. dev-lang/python-exec
  382. www-servers/nginx
  383. # Optional, client for Let’s Encrypt:
  384. # app-crypt/certbot
  385. ```
  386. 2. If you are on a "stable" Gentoo you need to accept the testing keyword ~amd64 yarn:
  387. ```
  388. mkdir -p /etc/portage/package.keywords
  389. cat << EOF >> /etc/portage/package.keywords/peertube
  390. # required by yarn (argument) for PeerTube
  391. sys-apps/yarn ~amd64
  392. EOF
  393. ```
  394. 3. Compile the peertube set:
  395. ```
  396. emerge -a @peertube
  397. ```
  398. 4. Initialize the PostgreSQL database if you just merged it:
  399. ```
  400. emerge --config postgresql
  401. ```
  402. 5. (For OpenRC) Enable and then start the services (replace with the correct PostgreSQL slot):
  403. ```
  404. rc-update add redis
  405. rc-update add postgresql-11
  406. rc-service redis start
  407. rc-service postgresql-11 start
  408. ```
  409. 6. Create Python version symlink for youtube-dl:
  410. ```
  411. emerge -1 python-exec
  412. ```
  413. ## OpenBSD
  414. 1. Install Packages:
  415. ```
  416. pkg_add sudo bash wget git python nginx pkgconf postgresql-server postgresql-contrib redis openssl
  417. ```
  418. 2. Install yarn:
  419. ```
  420. npm install --global yarn
  421. ```
  422. 3. Allow users in the wheel group to use sudo
  423. ```
  424. visudo
  425. ```
  426. Uncomment line #43:
  427. ```
  428. %wheel ALL=(ALL) ALL
  429. ```
  430. 4. Enable services:
  431. ```
  432. rcctl enable postgresql redis nginx
  433. ```
  434. ## Other distributions
  435. Feel free to update this file in a pull request!