Skip to content

Instantly share code, notes, and snippets.

@RB-Lab
Last active April 28, 2022 04:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RB-Lab/2916f71b840c776ab221c8b8f2bc2c7d to your computer and use it in GitHub Desktop.
Save RB-Lab/2916f71b840c776ab221c8b8f2bc2c7d to your computer and use it in GitHub Desktop.
How To Set Up rblab.net VPS

Initial server set-up

(also see here and here)

  1. create a user (should be logged in a root)
    • adduser btm
    • usermod -aG sudo btm
  2. add an SSH key for btm
    • su - btm
    • mkdir ~/.ssh
    • chmod 700 ~/.ssh
    • vim ~/.ssh/authorized_keys
    • paste your cat cat .ssh/id_rsa.pub there (one key for one line)
  3. disable passwort auth and root login
  • sudo vim /etc/ssh/sshd_config
  • set PasswordAuthentication no
  • set PubkeyAuthentication yes
  • set ChallengeResponseAuthentication no
  • set PermitRootLogin no
  • sudo service ssh restart

Install & configure ZSH

See also here and here

  1. sudo apt-get install zsh
  2. sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Sync content from old server (or backup folder)

rsync -a /home/btm/ host:/home/btm

Git Aliases

git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.hist "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short"

# -------- user ------
git config --global user.email "btm@rblab.net"  
git config --global user.name "Roman Bekkiev"
git config --global user.signingkey=??? # PGP key to use in signing commits 
# @see https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits

# -------- other configs ---- 
git config --global push.default current # To set push to new branch --set-upstream origin.. by default

Set vim defaul editor

  1. sudo update-alternatives --config editor (choose vim.basic)

Install & configure Nginx

  1. sudo apt-get install nginx
  2. (from local machine) scp -r ~/Documents/backup/btm/nginx/ <$VM_IP_ADDRESS>:/home/btm
  3. sudo chown -R root:root nginx
  4. sudo rm -r /etc/nginx
  5. sudo mv nginx /etc Note that you propbably have to remove all sutff about sss (it is managed by letsencrypt bot)

Install & configure Node.js

TODO: use nvm installer

Adding keys for GitHub

see also here

  1. ssh-keygen -t rsa -b 4096 -C "btm@rblab.net"
  2. eval "$(ssh-agent -s)"
  3. ssh-add ~/.ssh/id_rsa

Install docker

see here: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04

Adding HTTPS with LetsEncrypt

see here: https://www.digitalocean.com/community/tutorials/how-to-create-let-s-encrypt-wildcard-certificates-with-certbot

Install OpenVPN server

https://github.com/Nyr/openvpn-install

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