From: Adam Date: Thu, 4 Jan 2018 17:35:25 +0000 (-0700) Subject: First version. Copied from the Debian Jessie instructions. Significant changes are... X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=6d0bd387ae0bc56893c5ff1d938186ab41c886a6;p=oweals%2Fpeertube.wiki.git First version. Copied from the Debian Jessie instructions. Significant changes are switching to Node 8 (Yarn requires 8+), Psql 9.5 (9.4 not available on Ubuntu's repos), and clarifying parts of the configuration that caused me issues when first figuring out how to get it done. --- diff --git a/Ubuntu-16-Production-Installation-Guide.md b/Ubuntu-16-Production-Installation-Guide.md new file mode 100644 index 0000000..6c9720c --- /dev/null +++ b/Ubuntu-16-Production-Installation-Guide.md @@ -0,0 +1,106 @@ +Credit: https://github.com/Chocobozzz/PeerTube/issues/33 + +# Dependencies +We need to install dependencies: + + curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - + echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list + sudo apt-get update + sudo apt-get dist-upgrade + curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - + sudo apt-get install -y nodejs ffmpeg postgresql-9.5 openssl nginx yarn g++ make + +# Database +We need to create the database: + + sudo -u postgres createuser -P peertube + sudo -u postgres createdb -O peertube peertube_prod + +# User +We need to create the peertube user: + + sudo useradd -m -d /home/peertube -s /bin/bash -p peertube peertube + +And set its password: + + sudo passwd peertube + + +# Build PeerTube application +Master branch is for production, develop branch is for... development. + + sudo su - peertube + cd /home/peertube + git clone -b master https://github.com/Chocobozzz/PeerTube + cd PeerTube + yarn install + npm run build + +# Configuration files +Copy the production configuration file template: + + sudo su - peertube + cd /home/peertube/PeerTube/config/ + cp production.yaml.example production.yaml + mv default.yaml default.yaml.bak + ln -s production.yaml default.yaml + vim production.yaml + +# Webserver + +Create the TLS certificate. (TODO: instructions to install using Let's Encrypt. For now, direct them to https://letsencrypt.org/) + +Copy the nginx configuration template: + + sudo cp /home/peertube/PeerTube/support/nginx/peertube-https /etc/nginx/sites-available/peertube + +Modify the configuration file: + + sudo vim /etc/nginx/sites-available/peertube + +Active the configuration file: + + sudo ln -s /etc/nginx/sites-available/peertube /etc/nginx/sites-enabled/peertube + sudo systemctl reload nginx + +# Systemd +Copy the service file: + + sudo cp /home/peertube/PeerTube/support/systemd/peertube.service /etc/systemd/system/ + +Update the service file: + + sudo vim /etc/systemd/system/peertube.service + +It should look like this: (Note what `Working Directory` is set to) + + [Unit] + Description=PeerTube daemon + + [Service] + Type=simple + Environment=NODE_ENV=production + User=peertube + Group=peertube + ExecStart=/usr/bin/npm start + WorkingDirectory=/home/peertube/PeerTube/ + StandardOutput=syslog + StandardError=syslog + SyslogIdentifier=peertube + Restart=always + + [Install] + WantedBy=multi-user.target + +Then tell systemd to reload its config: + + sudo systemctl daemon-reload + +# Run PeerTube + + sudo systemctl start peertube + sudo journalctl -feu peertube + +The output from starting peertube for the first time will include the credentials for your instance's administrative account, and this information will not be repeated. Make note of it. + + sudo systemctl enable peertube \ No newline at end of file