Partition and Format a Disk with Ext4

Get disk information

sudo fdisk -l

Partition the disk

parted /dev/sdX mklabel gpt
parted /dev/sdX mkpart primary 0% 100%
parted /dev/sdX print
parted /dev/sdX name 1 CoolName

Format the partition

mkfs -t ext4 -E lazy_itable_init=1 /dev/sdX1

Source #1, #2

Reverse SSH Tunnel


ssh -i ~/.ssh/id_rsa -f -N -R 9999:localhost:22


ssh -i ~/.ssh/id_rsa -p 9999 local.user@localhost

AutoSSH Local

autossh -- -i ~/.ssh/id_rsa -o ControlPath none -R 9999:localhost:22 -N

Generate SSH Key


ssh-keygen -t rsa -b 4096


ssh-copy-id user@host


cat ~/.ssh/ | ssh user@host "mkdir -p ~/.ssh && cat >>  ~/.ssh/authorized_keys"

See also the GitHub help page and the Digital Ocean help page.

Listing active connections

sudo netstat -taupen

Running Node.js behind Apache


Install Node.js

sudo apt-get install nodejs nodejs-legacy

Install NPM - Node Package Manager

curl | sudo sh

Install PM2 - To manage and daemonize Node.js apps

sudo npm install pm2 -g

Start PM2 with the OS

sudo pm2 startup debian

Install proxy mod (might already be installed)

sudo apt-get install libapache2-mod-proxy-html

Setting up the Node.js app

Create example app

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(8080, '');
console.log('Server running at');

Test app

node hello.js

Setup app with PM2

pm2 start hello.js

Additional PM2 commands

pm2 restart <app name>
pm2 info <app name>
pm2 stop <app name>
pm2 list
pm2 monit

Configure Apache

Activate proxy mod

sudo a2enmod proxy proxy_html
sudo service apache2 restart

Adjust virtualhost

<VirtualHost *:80>
    ServerAdmin admin@domain.tld
    ServerName domain.tld
    ServerAlias www.domain.tld
    ProxyRequests off
    <Proxy *>
        Order deny,allow
        Allow from all
    <Location />

Reload apache configuration

sudo service apache2 reload