Created
April 7, 2026 09:21
-
-
Save heo001997/a7f6dfdd7942781dfc7ab1836a9bb65c to your computer and use it in GitHub Desktop.
Setup openclaw-remote VM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| echo "=== openclaw-remote VM Setup ===" | |
| # 1. Detect network interface | |
| IFACE=$(ip -o link show | awk -F': ' '{print $2}' | grep -v lo | head -1) | |
| echo "[1/4] Detected interface: $IFACE" | |
| # 2. Set static IP via netplan | |
| echo "[2/4] Configuring static IP 192.168.100.82..." | |
| # Remove any existing netplan configs that might conflict | |
| sudo rm -f /etc/netplan/*.yaml 2>/dev/null || true | |
| sudo tee /etc/netplan/01-static.yaml > /dev/null << EOF | |
| network: | |
| version: 2 | |
| ethernets: | |
| $IFACE: | |
| dhcp4: no | |
| addresses: | |
| - 192.168.100.82/24 | |
| routes: | |
| - to: default | |
| via: 192.168.100.1 | |
| nameservers: | |
| addresses: | |
| - 192.168.100.81 | |
| - 8.8.8.8 | |
| EOF | |
| sudo netplan apply | |
| sleep 2 | |
| # 3. Verify connectivity | |
| echo "[3/4] Testing internet..." | |
| if ping -c 2 -W 3 8.8.8.8 > /dev/null 2>&1; then | |
| echo " Internet OK" | |
| else | |
| echo " WARNING: No internet. Check gateway/router." | |
| echo " Continuing anyway (apt may fail)..." | |
| fi | |
| # 4. Install SSH + QEMU guest agent | |
| echo "[4/4] Installing openssh-server and qemu-guest-agent..." | |
| sudo apt update -y | |
| sudo apt install -y openssh-server qemu-guest-agent | |
| sudo systemctl enable --now ssh | |
| sudo systemctl enable --now qemu-guest-agent | |
| echo "" | |
| echo "=== DONE ===" | |
| echo "IP: 192.168.100.82" | |
| echo "SSH: ssh heo001997@192.168.100.82" | |
| echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment