Updated Debian Jessie production installation guide (markdown)
[oweals/peertube.wiki.git] / Debian-Jessie-production-installation-guide.md
1 Credit: https://github.com/Chocobozzz/PeerTube/issues/33
2
3 # Dependencies
4 We need to install dependencies:
5
6     # curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
7     # echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
8     # echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/sources.list
9     # apt-get update
10     # apt-get upgrade -y
11     # curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
12     # apt-get install -y nodejs ffmpeg postgresql-9.4 openssl nginx yarn
13
14 # Database
15 We need to create the database:
16
17     # su - postgres
18     $ psql postgres
19
20     CREATE USER peertube WITH PASSWORD 'peertube';
21     CREATE DATABASE peertube_prod OWNER peertube;
22     GRANT ALL PRIVILEGES ON DATABASE peertube_prod to peertube;
23     \q
24
25 # User
26 We need to create the peertube user:
27
28     # useradd -m -d /home/peertube -s /bin/bash -p peertube peertube
29
30 And set its password:
31
32     # passwd peertube
33
34
35 # Build PeerTube application
36 Master branch is for production, develop branch is for... development.
37
38     # su - peertube
39     $ cd /home/peertube
40     $ git clone -b master https://github.com/Chocobozzz/PeerTube
41     $ cd PeerTube
42     $ yarn install
43     $ npm run build
44
45 # Configuration files
46 Copy the production configuration file template:
47
48     # cd /home/peertube/PeerTube
49     # su - peertube
50     $ cp config/production.yaml.example config/production.yaml
51
52 Modify the configuration file:
53
54     $ vim config/production.yaml
55
56 # Webserver
57 Copy the nginx configuration template:
58
59     # cp /home/peertube/PeerTube/support/nginx/peertube-https /etc/nginx/sites-available/peertube
60
61 Modify the configuration file:
62
63     # vim /etc/nginx/sites-available/peertube
64
65 Active the configuration file:
66
67     # ln -s /etc/nginx/sites-available/peertube /etc/nginx/sites-enabled/peertube
68     # systemctl nginx reload
69
70 # Systemd
71 Copy the service file:
72
73     # cp /home/peertube/PeerTube/support/systemd/peertube.service /etc/systemd/system/
74
75 Update the service file:
76
77     # vim /etc/systemd/system/peertube.service
78     # systemd daemon-reload
79
80 # Run PeerTube
81
82     # systemctl start peertube
83     # journalctl -feu peertube