Skip to content

Instantly share code, notes, and snippets.

@joshxyzhimself
Last active Sep 20, 2022
Embed
What would you like to do?
Development Environment

Ubuntu Desktop 22.04 Jammy Jellyfish

uBlock Origin

Snap

sudo snap refresh core snapd

FFmpeg

sudo snap install ffmpeg --classic

Telegram

sudo snap install telegram-desktop

VSCode

sudo snap install code --classic

Node

sudo snap install node --channel=18/stable --classic

Beekeeper Studio

sudo snap install beekeeper-studio

Git

sudo apt install git -y
ssh-keygen
cat ~/.ssh/id_rsa.pub
git config --global user.name "joshxyzhimself"
git config --global user.email "joshxyzhimself@gmail.com"

PostgreSQL

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt update
sudo apt install postgresql -y
sudo -u postgres psql
\password
exit

TypeSense

curl -O https://dl.typesense.org/releases/0.23.1/typesense-server-0.23.1-amd64.deb
sudo apt install ./typesense-server-0.23.1-amd64.deb
sudo systemctl status typesense-server
cat /etc/typesense/typesense-server.ini

Redis

curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
sudo apt-get update
sudo apt-get install redis

Tailscale

curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailscale.list
sudo apt update
sudo apt install tailscale
sudo tailscale up
tailscale ip -4

Zero Tier

curl -s https://install.zerotier.com | sudo bash

Ubuntu Server

Node.js

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
node --version
npm --version

PostgreSQL

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install postgresql
sudo systemctl status postgresql
sudo -u postgres psql
\password
\quit

Caddy

sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy
sudo systemctl status caddy
nano /etc/caddy/Caddyfile
{
  log {
    output file /var/log/access.log
    format json
  }
}

legacy.jxyz.me {
  handle {
    header {
      Cache-Control "no-cache"
      Strict-Transport-Security "max-age=63072000"
      defer
    }
    encode gzip
    reverse_proxy 0.0.0.0:8080
  }
  tls joshxyzhimself@gmail.com {
    protocols tls1.2 tls1.3
    ciphers TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
  }
}

jxyz.me {
  handle {
    header {
      Cache-Control "no-cache"
      Strict-Transport-Security "max-age=63072000"
      defer
    }
    encode gzip
    reverse_proxy 0.0.0.0:8080
  }
  tls joshxyzhimself@gmail.com {
    protocols tls1.3
  }
}
sudo systemctl stop caddy
sudo systemctl start caddy

TypeSense

curl -O https://dl.typesense.org/releases/0.23.1/typesense-server-0.23.1-amd64.deb
sudo apt install ./typesense-server-0.23.1-amd64.deb
sudo systemctl status typesense-server
cat /etc/typesense/typesense-server.ini

Redis

curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
sudo apt-get update
sudo apt-get install redis
sudo systemctl status redis-server

Uncomplicated Firewall

sudo ufw status
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
sudo ufw enable
sudo ufw status

SSH Keep-alive

nano /etc/ssh/sshd_config
  • Uncomment "ClientAliveInterval", set it to "60"
  • Uncomment "ClientAliveCountMax", set it to "60"
  • Use "CTRL + x", then "Y", then "Enter" to save the file.
service ssh restart

SSH Keys

ssh-keygen
cat ~/.ssh/id_rsa.pub

PM2

npm install pm2 --global
pm2 startup
pm2 start ./index.mjs --name=example -- --production
pm2 save

Git Repository

git clone git@github.com:joshxyzhimself/example.git

config.json

nano ./config.json
{
  "http_hostname": "jxyz.me",
  "http_port": 8080
}

Ubuntu

# restart
sudo shutdown -r now
@joshxyzhimself
Copy link
Author

Needs update:

  • Install from NodeSource instead of Snapcraft to avoid problems with puppeteer and isolated-vm

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment