Skip to content

ComTamSuonBiCha/vastai_setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

vastai_setup

Vast ai setup bash script. This script is used as a template everytime i rent new gpu from vast ai

Set up ssh key to secure your connection to vastai server

Step 1: Check for Existing SSH Keys

ls -al ~/.ssh

If you see files like id_rsa or id_ed25519, you may already have a key. You can reuse it or create a new one.


Step 2: Generate a New SSH Key

Use the following command (replace with your email):

ssh-keygen -t ed25519 -C "your_email@example.com"
  • Press Enter to save to default path (~/.ssh/id_ed25519) or change it any path you want
  • Optionally enter a passphrase for extra security

Step 3: Start the SSH Agent

eval "$(ssh-agent -s)"

Add your private key to the agent:

ssh-add ~/.ssh/id_ed25519

Step 4: Add the SSH Key to Vast ai

Copy your public key:

cat ~/.ssh/id_ed25519.pub
  1. Go to https://cloud.vast.ai/manage-keys/
  2. Paste the key into the "SSH Keys" field

Script to connect to github via ssh and set up environment, download data, code, etc...

# Update latest ubuntu packages
apt-get update
apt-get install -y curl git-core

# Install and enable git lfs
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && apt-get install -y git-lfs && git lfs install

# Set up ssh key to connect to github
mkdir -p ~/.ssh && chmod 700 ~/.ssh

cat > ~/.ssh/id_ed25519 <<- EOM
-----BEGIN OPENSSH PRIVATE KEY-----
-----END OPENSSH PRIVATE KEY-----
EOM
chmod 400 ~/.ssh/id_ed25519

ssh-keygen -F github.com || ssh-keyscan github.com >> ~/.ssh/known_hosts

git config --global user.email "your_email@gmail.com"
git config --global user.name "your_name"

About

Vast ai setup bash script

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors