Tutoriel complet VPS
I'll help you create a VPS using vultr-cli. Here's a comprehensive guide:
1. First, Install vultr-cli¶
macOS:
Linux:
curl -L https://github.com/vultr/vultr-cli/releases/download/v2.0.0/vultr-cli_2.0.0_linux_64-bit.tar.gz | tar xz
sudo mv vultr-cli /usr/local/bin/
Windows (PowerShell):
2. Set Up Authentication¶
Get your API key from Vultr Account
Set API key:
# Set as environment variable
export VULTR_API_KEY="your-api-key-here"
# OR set in config file
vultr-cli config set api-key "your-api-key-here"
Verify it works:
3. Check Available Options¶
Before creating, see what's available:
# List available regions
vultr-cli regions list
# List available plans
vultr-cli plans list
# List available operating systems
vultr-cli os list
# List available SSH keys (if you have any)
vultr-cli ssh-key list
4. Create Your VPS¶
Basic VPS creation:
vultr-cli instance create \
--region ams \ # Amsterdam
--plan vc2-1c-1gb \ # 1 CPU, 1GB RAM plan
--os 387 \ # Ubuntu 22.04 LTS
--label "my-server" \ # Your server label
--hostname "server1.example.com" \ # Hostname
--ipv6 true \ # Enable IPv6
--ddos true # Enable DDOS protection
With SSH key (recommended):
vultr-cli instance create \
--region lax \ # Los Angeles
--plan vc2-2c-2gb \ # 2 CPU, 2GB RAM
--os 387 \ # Ubuntu 22.04
--label "production-server" \
--hostname "prod.example.com" \
--ssh-keys "ssh-key-id-here" \ # From vultr-cli ssh-key list
--backups enabled # Enable backups
Quick simple command:
5. Manage Your VPS¶
After creation:
# List all instances
vultr-cli instance list
# Get specific instance details
vultr-cli instance get <instance-id>
# Start/Stop/Restart
vultr-cli instance start <instance-id>
vultr-cli instance stop <instance-id>
vultr-cli instance restart <instance-id>
# Delete instance
vultr-cli instance delete <instance-id>
6. Complete Example Workflow¶
Here's a typical workflow:
# 1. Set API key
export VULTR_API_KEY="your-actual-api-key"
# 2. Create SSH key first (if you don't have one)
vultr-cli ssh-key create \
--name "my-laptop-key" \
--key "$(cat ~/.ssh/id_rsa.pub)"
# 3. Create VPS
vultr-cli instance create \
--region ams \
--plan vc2-1c-1gb \
--os 387 \
--label "ubuntu-server" \
--hostname "ubuntu.ams.vultr.com" \
--ssh-keys "$(vultr-cli ssh-key list | grep "my-laptop-key" | awk '{print $1}')" \
--ipv6 true
# 4. Check status
vultr-cli instance list
# 5. Get connection info (IP address)
vultr-cli instance get <your-instance-id> | grep "Main IP"
7. Common OS IDs¶
387: Ubuntu 22.04 LTS1743: Debian 12186: CentOS 71947: AlmaLinux 92309: Rocky Linux 91248: Windows Server 2022
8. Tips¶
-
Get instance ID quickly:
-
View all options:
-
Create with startup script:
-
Add tags for organization:
Once created, you'll see the IP address in the output. Connect via SSH:
Note: The password will be emailed to you if you didn't use SSH keys.
Need help with a specific configuration or having issues? Let me know what you're trying to create!