Advertisement
load-net

Собственный ЮТУБ

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