首页
wjlink
投稿
视频
直播
壁纸
更多
留言
统计
LINK
Search
1
宝塔面板绑定域名套上cloudflare – 实现cdn访问拯救你的IP
110 阅读
2
Python 爬取YouTube某个频道下的所有视频信息
110 阅读
3
为你的 WordPress 站点配置 Telegram Instant View
63 阅读
4
苹果CMS(MACCMS)如何在标题中随机插入关键词
60 阅读
5
windows 使用 FFmpeg 按大小或时间来批量分割视频
59 阅读
技術類
自媒体
調查
问卷调查
美國站
英國站
注册丨登录
Search
标签搜索
wordpress
V2Ray
vps
苹果cms
面板
php
宝塔
ipfs
DD
脚本
语言
上传
判断
Youtube
cdn
ip
AI
HTML
1
2
Gengre
累计撰写
67
篇文章
累计收到
0
条评论
今日撰写
0
篇文章
️
首页
分类
技術類
自媒体
調查
问卷调查
美國站
英國站
页面
wjlink
投稿
视频
直播
壁纸
留言
统计
LINK
登录丨注册
搜索到
1
篇与
的结果
2023-10-21
如何使用Peertube托管自己的Youtube
Peertube is a federated and open source video hosting platform that you can run from your own computer. Iit allows you to completely control all the content that you host and share from your website. This tutorial shows you how to install and host Peertube on Ubuntu.CONTENT Why Host and Use Peertube Installing Peertube Configuring Nginx and SSL Configuring and Running Peertube Using Peertube Frequently Asked Questions Tip: if you just want to watch YouTube offline, there is no need to install Peertube. Check out all the ways to watch YouTube offline.Why Host and Use PeertubeOne of the most attractive features of Peertube is its ability to load videos from other instances, making it possible to view content from outside your website but still retain the control over your data.Another advantage of Peertube over Youtube is that it is entirely open source. (Learn all about open source licenses here.) This makes it easy for anyone to scrutinize the program’s codebase, which can be helpful for users that are concerned about their data security.Good to know: learn more about protecting your data online by installing privacy and security extensions in Chrome.Installing PeertubeBefore you can install Peertube, you need to make sure that you have a server ready. This could be your personal PC or a rented server from a web host. This tutorial is done on an Ubuntu VPS from Digitalocean. Set up a new user account for Peertube. This will allow you to easily control what the program can do inside your system: sudo useradd -b /bin/bash -m -d /var/www/peertube -G sudo peertube sudo passwd peertubeCreating a new user account also allows you to set the $HOME variable under “/var/www/.” This is important, as the Web backend for Peertube will not be able to traverse the default “/home” heirarchy. Switch to your new user account with the command: su peertube Install the dependencies for Peertube: sudo apt install cron wget curl unzip python3-dev python-is-python3 certbot nginx python3-certbot-nginx ffmpeg postgresql postgresql-contrib openssl g++ make redis-server git Install NodeJS in your machine: curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - sudo apt update sudo apt install nodejs Install Yarn. This is a powerful yet lightweight package manage for NodeJS: curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list sudo apt update sudo apt install yarn Once you have installed all of the dependencies for Peertube, configure your system to install the program. First, enable the program’s database backend: sudo systemctl enable postgresql sudo systemctl start postgresql sudo systemctl enable redis-server sudo systemctl start redis-server Add your Peertube user to PostgreSQL by running the following commands: cd $HOME sudo usermod -aG peertube postgres sudo -u postgres createuser -P peertube Create the database for the program by running the following commands: sudo -u postgres createdb -O peertube -E UTF8 -T template0 peertube_run sudo -u postgres psql -c "CREATE EXTENSION pg_trgm;" peertube_run sudo -u postgres psql -c "CREATE EXTENSION unaccent;" peertube_run Create the directory structure of the program in your home directory: mkdir config storage versions chmod 750 ./config Download the Peertube binary files: cd ./versions wget https://github.com/Chocobozzz/PeerTube/releases/download/v5.0.1/peertube-v5.0.1.zip unzip peertube-v5.0.1.zip cd ./.. Create a symbolic link between your install and your home directory: ln -s /var/www/peertube/versions/peertube-v5.0.1 /var/www/peertube/peertube-latest Install Peertube using the following Yarn command: cd ./peertube-latest yarn install --production --pure-lockfileConfiguring Nginx and SSLBy default, Peertube opens its Internet service on port 9000. While you can access the program from that, it is good practice to create a reverse proxy between the program and a well-known port.The program’s developers have made a template file that you can use to create your own reverse proxy by running the following command:sudo cp /var/www/peertube/peertube-latest/support/nginx/peertube /etc/nginx/sites-available/peertube sudo rm /etc/nginx/sites-enabled/defaultConfigure your new template file by opening it using a text editor:sudo nano /etc/nginx/sites-available/peertubeInside, change every instance of these two variables: ${WEBSERVER_HOST} and ${PEERTUBE_HOST}. For the ${WEBSERVER_HOST}, replace it with your machine’s FQDN. Meanwhile, replace ${PEERTUBE_HOST} with “127.0.0.1:9000.” Press Ctrl + O, then Ctrl + X to save your file to disk and exit the text editor.Enable the Peertube Nginx config file and restart Nginx.sudo ln -s /etc/nginx/sites-available/peertube /etc/nginx/sites-enabled/ sudo systemctl reload nginxCreating Your SSL CertificateWe are obtaining a new SSL certificate using the free Certbot utility from Let’s Encrypt. (You can also create a wildcard SSL certificate if you intend to use it on multiple (sub)domains.)sudo certbotCertbot will scan your Nginx configuration and bring up the list of domains hosted on your server. Enter the number beside the domain for which you want to obtain a new SSL certificate.Once the SSL certificate is issued, certbot will auto-update your Nginx config file with the correct entry. You just need to reload your Nginx configuration to make sure all is running well.sudo systemctl reload nginxTip: enabling SSL will encrypt all TCP connections to your instance; however, it is better practice to secure your Linux server from the get go.Configuring and Running Peertube With both your Nginx server and SSL certificate done, you can now configure your Peertube instance. You can use a template that the developers have made to streamline this process. Run the following commands: cd $HOME cp /var/www/peertube/peertube-latest/config/default.yaml /var/www/peertube/config/default.yaml cp /var/www/peertube/peertube-latest/config/production.yaml.example /var/www/peertube/config/production.yaml Open the “production.yaml” file in a text editor: nano /var/www/peertube/config/production.yaml Change the hostname: variable to your machine’s FQDN: Generate a random secret for your instance with the following command: openssl rand -hex 32Go back to your “production.yaml” file and paste your random secret beside the peertube: variable. Look for the database: block. Change the suffix: block to “_run.” Change the password: variable to your database account’s password. Go to the smtp: block and find the hostname: variable. Change that to the hostname of your mail server. Also, change both the username: and password: variables to the credentials of your email account. Replace the from_address: variable with the email address of your email account. Once you are done making the changes, press Ctrl + o to save the file and Ctrl + x to exit the file.Creating a Peertube Service FileTo make Peertube run automatically at startup, we are creating a systemd service file for Peertube. Run the following command to copy the template systemd file to the system: sudo cp /var/www/peertube/peertube-latest/support/systemd/peertube.service /etc/systemd/system/ Reload systemd to apply your new service file. sudo systemctl daemon-reload sudo systemctl enable peertube sudo systemctl start peertubeUsing PeertubeIf everything is configured properly, you should be able to access Peertube from your own domain name.By default, every new Peertube instance creates a root account that you can use as the site’s administrator. To use this, run the following command:sudo journalctl -u peertube | grep "User password:"Go back to your Peertube website and press the “Login” button on the page’s upper-left corner. Write “root” as your username and paste its password.Peertube will greet you with a brief message that contains links to the program’s documentation.Once you have reviewed the content of the message, press X on the window’s upper- right corner to start using your Peertube website.Frequently Asked QuestionsIs it possible to use Peertube without a domain name?No. Peertube requires you to have a valid SSL certificate in your instance. While it is possible to create your own SSL certificate without a domain name, doing this will make your site insecure for other users.Can I copy the default.yaml file while configuring Peertube?Peertube depends on the “default.yaml” file for some of its core settings. Without the “default.yaml” file, your instance will most likely render it inaccessible.Why am I getting a blank page when I open my Peertube website?This issue is most likely due to a permissions issue with your root peertube directory. By default, Nginx requires every Web folder, as well as its root, to be world readable.You can fix this issue by running the following command: sudo chmod 755 /var/www/peertube.Image credit: Unsplash. All alterations and screenshots by Ramces Red.GitHub – Chocobozzz/PeerTube: ActivityPub-federated video streaming platform using P2P directly in your web browser
2023年10月21日
17 阅读
0 评论
0 点赞