# Linode VM ## Prepair Read first: [Commands for Compute Instances](https://www.linode.com/docs/products/tools/cli/guides/linode-instances/) You can later set the Linode IDs as variables: linode-cli linodes list set "LID_1=38120280" echo %LID_1% Control them by changing a single number: linode-cli linodes boot %LID_1% linode-cli linodes reboot %LID_1% linode-cli linodes shutdown %LID_1% ## Create a new Linode VM Gather some information: linode-cli linodes types linode-cli regions list linode-cli images list Maybe set the credentials as environment variables: > **Note:** Must be done in a seperate CMD session before starting a the `linode-cli` session! setx ROOT_PASS "" setx SSH_KEY "SSH_KEY=ssh-rsa %USERNAME%" echo %ROOT_PASS% refreshenv echo %ROOT_PASS% VM creation command: linode-cli linodes create --type "g6-nanode-1" --region "eu-west" --image "linode/ubuntu22.04" --root_pass "%ROOT_PASS%" --authorized_keys "%SSH_KEY%" --label "" _Now add a Linode Firewall and restrict the HTTP ports to your IP only!_ Log in via SSH and add a user: sudo adduser J2897 --force-badname sudo usermod -aG sudo J2897 su - J2897 > **Note:** Test this in the future if you have difficulty restoring a snapshot: > > --authorized_keys "$(cat ~/.ssh/id_rsa.pub)" Edit the sudoers file: sudo visudo Add this: # Extend the password authentication timer to 5 hours. Defaults:J2897 timestamp_timeout=300 Update everything: sudo apt-get update; sudo apt-get upgrade Shut the VM down and create a snapshot. If paid Backups are enabled, you can create a snapshot simply from the CLI: linode-cli linodes snapshot --label "snapshot-1" "" ## Install Docker: > **Note:** If you're using Debian, simply change all `ubuntu` words to `debian`. sudo apt-get remove docker docker-engine docker.io containerd runc sudo apt-get update sudo apt-get install ca-certificates curl gnupg lsb-release sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin Test: sudo usermod -aG docker J2897 newgrp docker docker run hello-world If something goes wrong, restore `snapshot-1` and then [resize the disk](https://www.linode.com/docs/guides/disks-and-storage/#resizing-a-disk).