Basic VPS Setup - 07-20-20

Overview

  • What is a VPS - Virtual Private Server
  • Why we need one
    • More tutorials to come
  • Creating SSH Keys
  • What is Digital Ocean Cloud Service Provider 👍
  • How to create a droplet
  • Basic server setup including creating a sudo user and setting up a ufw firewall

vps tutorial

Create a new ssh keys

Create two, one for root on the server and one for the main user

*make sure to create them in the ./ssh folder

From the home directory on your local computer run:

$ ssh-keygen
./.ssh/vps_demo

Create a droplet

  1. Go to https://www.digitalocean.com/

  2. Create an an account or signin

  3. Create a new droplet

    • Ubuntu 18 is fine
    • basic 5$ a month plan
  4. Add the root ssh key

    Easily copy to the condense of a file to the clipboard with:

    $ pbcopy < ./.ssh/demo_root_key.pub
    
  5. Navigate to the droplet dashboard and wait for it to be created

Basic Server Setup

Great tutorial from digital ocean

  1. Using thee ip address from the droplet dashboard

    $ ssh -i ~/.ssh/demo_root_key root@666.66.66.66
    root@demo_vps:~ $
    
  2. Setup up firewall

    root@demo_vps:~ $ ufw allow 22/tcp
    root@demo_vps:~ $ ufw enable
    root@demo_vps:~ $ ufw status
    
  3. Create a new sudo user

    root@demo_vps:~ $ adduser travis
    root@demo_vps:~ $ usermod -aG sudo travis
    
  4. Add user ssh key to sudo user

    Copy the key to the clipboard on the local machine:

    $ pbcopy < ./.ssh/demo_travis_key.pub
    

    Append the key to the end of the authorized_keys files on the remote machine:

    root@demo_vps:~ $ vim /home/travis/.ssh/authorized_keys
    
  5. Exit root ssh session and test logging in to sudo user

    ssh -i ~/.ssh/demo_travis_key travis@666.66.66.66
    travis@demo_vps:~ $
    
  6. If all went well you now have yourself a server! 🥳

tutorial topics: [vps] [digitalocean] [screencast]