1 Credit: https://github.com/Chocobozzz/PeerTube/issues/33
4 We need to install dependencies:
6 curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
7 sudo add-apt-repository ppa:jonathonf/ffmpeg-3
8 echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
10 sudo apt-get dist-upgrade
11 curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
12 sudo apt-get install -y nodejs ffmpeg postgresql-9.5 openssl nginx yarn g++ make
15 We need to create the database:
17 sudo -u postgres createuser -P peertube
18 sudo -u postgres createdb -O peertube peertube_prod
21 We need to create the peertube user:
23 sudo useradd -m -d /home/peertube -s /bin/bash -p peertube peertube
30 # Build PeerTube application
31 Master branch is for production, develop branch is for... development.
35 git clone -b master https://github.com/Chocobozzz/PeerTube
41 Copy the production configuration file template:
44 cd /home/peertube/PeerTube/config/
45 cp production.yaml.example production.yaml
46 mv default.yaml default.yaml.bak
47 ln -s production.yaml default.yaml
52 Create the TLS certificate. (TODO: instructions to install using Let's Encrypt. For now, direct them to https://letsencrypt.org/)
54 Copy the nginx configuration template:
56 sudo cp /home/peertube/PeerTube/support/nginx/peertube-https /etc/nginx/sites-available/peertube
58 Modify the configuration file:
60 sudo vim /etc/nginx/sites-available/peertube
62 Active the configuration file:
64 sudo ln -s /etc/nginx/sites-available/peertube /etc/nginx/sites-enabled/peertube
65 sudo systemctl reload nginx
68 Copy the service file:
70 sudo cp /home/peertube/PeerTube/support/systemd/peertube.service /etc/systemd/system/
72 Update the service file:
74 sudo vim /etc/systemd/system/peertube.service
76 It should look like this: (Note what `Working Directory` is set to)
79 Description=PeerTube daemon
83 Environment=NODE_ENV=production
86 ExecStart=/usr/bin/npm start
87 WorkingDirectory=/home/peertube/PeerTube/
90 SyslogIdentifier=peertube
94 WantedBy=multi-user.target
96 Then tell systemd to reload its config:
98 sudo systemctl daemon-reload
102 sudo systemctl start peertube
103 sudo journalctl -feu peertube
105 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.
107 sudo systemctl enable peertube