# Dependencies
-## Debian / Ubuntu
+## Debian / Ubuntu and derivatives
1. Install NodeJS 8.x (current LTS):
[https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions](https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions)
4. Run:
```
-$ apt-get update
-$ apt-get install nginx ffmpeg postgresql openssl g++ make
+$ sudo apt update
+$ sudo apt install nginx ffmpeg postgresql openssl g++ make
```
## Arch Linux
1. Run:
```
-$ pacman -S nodejs yarn ffmpeg postgresql openssl
+$ sudo pacman -S nodejs yarn ffmpeg postgresql openssl
```
## Other distributions
```
$ sudo useradd -m -d /home/peertube -s /bin/bash -p peertube peertube
+```
+
+Set its password:
+```
$ sudo passwd peertube
```
### Database
-Create production database and peertube user:
+Create the production database and a peertube user inside PostgreSQL:
```
$ sudo -u postgres createuser -P peertube
### Prepare PeerTube directory
+Fetch the latest tagged version of Peertube
+```
+$ VERSION=$(curl -s https://api.github.com/repos/chocobozzz/peertube/releases/latest | grep tag_name | cut -d '"' -f 4) && echo "Latest Peertube version is $VERSION"
+```
+Open the peertube directory, create a few required directories
+```
+ cd /home/peertube && sudo -u peertube mkdir config storage versions && cd versions
+```
+Download the latest version of the Peertube client, unzip it and remove the zip
```
-$ VERSION=$(curl -s https://api.github.com/repos/chocobozzz/peertube/releases/latest | grep tag_name | cut -d '"' -f 4) && \
- cd /home/peertube && \
- sudo -u peertube mkdir config storage versions && \
- cd versions && \
sudo -u peertube wget -q "https://github.com/Chocobozzz/PeerTube/releases/download/${VERSION}/peertube-${VERSION}.zip" && \
- sudo -u peertube unzip peertube-${VERSION}.zip && sudo -u peertube rm peertube-${VERSION}.zip && \
+ sudo -u peertube unzip peertube-${VERSION}.zip && sudo -u peertube rm peertube-${VERSION}.zip
+```
+Install Peertube
+```
cd ../ && sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest && \
cd ./peertube-latest && sudo -u peertube yarn install --production --pure-lockfile
```