Skip to content

Instantly share code, notes, and snippets.

@hughcodehq
Last active May 6, 2022 07:59
Show Gist options
  • Save hughcodehq/ef4956c004d996539ac8b1e764a7201b to your computer and use it in GitHub Desktop.
Save hughcodehq/ef4956c004d996539ac8b1e764a7201b to your computer and use it in GitHub Desktop.

Tools

SSH setup

On host (your machine)

  • Open PS, create $HOME/.ssh if not there

  • ssh-keygen -t ed25519 no password and name the file sensible, for e.g. vm_dev_ed25519

  • Create a $HOME/.ssh/config file

  • Paste the following content to the file

    Host some_vm # you name it so you know it
    	HostName <YOUR_VM_IP_FROM_BELOW>
    	User firstname.lastname
    	IdentityFile ~/.ssh/vm_dev_ed25519 # from above
  • Open and copy the vm_dev_ed25519.pub file content to the clipboard

On Linux VM

  • Login as the admin account

  • Run sudo ./setup.sh you will need to enter the admin password

  • Enter you name and paste the key above when asked.

    If clipboard not working then follow the below Manual copy SSH key section below

  • Run ip addr | grep en and note the IP down it should be 172.20.1.0/24

Manual copy SSH key

This happens when on the setup.sh script, you cannot paste the key from clipboard for any reason then just enter any random string there and finish the process, then

  • On the host
    • cd ~/.ssh
    • scp vm_dev_ed25519.pub firstname.lastname@ip_address_above:~/.ssh/vm_dev_ed25519.pub it will ask for your new password and the copy should indicate success
  • On the Linux VM
    • exit if it was still logging in with the admin, you should be greeted with a login prompt
    • Login using your new user and password
    • cd ~/.ssh
    • cat vm_dev_ed25519.pub > authorized_keys

Test connect (from Host)

  • Open PS
  • ssh firstname.lastname@ip_address_above ENTER
  • This should let you remote into the VM terminal without entering a password

Test connect (from VSCode)

  • Just use the Remote SSH extension and it should show the some_vm in the list of SSH hosts

Final touches

On Host

Set up the Shared Folders

https://gist.github.com/estorgio/1d679f962e8209f8a9232f7593683265

NOTE: Skip the steps 9, 10, 11, 12, 13 because Alex has already installed the Guest Additions

On Linux VM

  • You can ignore global installed nodejs and install nvm by this command curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
  • Close the terminal and reopen it to apply the nvm settings (or follow the instruction after nvm installation is done)
  • Then nvm install 12, this will install latest version of nodejs 12.x.x
  • Install deps needed for cypress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment