Download Links:
Verify Download (Optional but Recommended):
# Download SHA256 checksum file # From: https://dl-cdn.alpinelinux.org/alpine/v3.22/releases/x86_64/alpine-standard-3.22.2-x86_64.iso.sha256 # In PowerShell, verify the checksum: Get-FileHash alpine-standard-3.22.2-x86_64.iso -Algorithm SHA256 # Compare the hash with the official SHA256 file
Hyper-V VM Configuration:
Alpine Linux VM boots to login prompt:
localhost login: root
(no password - just press Enter)
setup-alpine
Keyboard Layout:
Select keyboard layout: us Select variant: us
Hostname:
Enter system hostname: node222
Network Interface:
Which one do you want to initialize? eth0 Ip address for eth0? (dhcp/none/manual): dhcp # Use DHCP for Hyper-V compatibility - static IP conversion happens in Step 18
Root Password:
New password: (choose a strong password) Retype password: (same password)
Timezone:
Which timezone are you in? America/Los_Angeles (or your timezone - use Tab to autocomplete)
Proxy:
HTTP/FTP proxy URL? none
NTP Client:
Which NTP client to run? chrony
APK Mirror:
Enter mirror number or URL: 1 (picks fastest mirror automatically)
User Setup:
Setup a user? (press Enter to skip - we'll do this later)
SSH Server:
Which SSH server? openssh Allow root ssh login? no (we'll use your user account with sudo instead)
Disk Setup:
Which disk(s) would you like to use? sda How would you like to use it? sys WARNING: This will erase all data on sda. Continue? y
reboot After reboot: node222 login: root Password: (enter the root password you set during install)
# Check if eth0 is UP ip addr show eth0 # If eth0 is DOWN, run the network setup tool setup-interfaces # When prompted: # Which interface? eth0 # IP address? dhcp # Do you want to do any manual configuration? no # Restart networking rc-service networking restart # Verify eth0 is now UP with DHCP address ip addr show eth0 # Should show: inet 192.168.1.xxx/24 and state UP # Test connectivity ping -c 2 google.com # Should work!
# Now that network is up, update packages apk update apk upgrade
# Install all essential packages apk add bash curl wget nano doas openssh # Note: Use 'doas' instead of 'sudo' - it's Alpine's preferred tool
adduser yourusername # Enter password when prompted # Accept defaults for Full Name, etc. (just press Enter) # Add user to wheel group (doas access) adduser yourusername wheel # Configure doas for wheel group echo "permit persist :wheel" > /etc/doas.d/doas.conf # Test doas works su - yourusername doas apk update # Enter your user password - should work! # Note: 'persist' means password is cached for 5 minutes exit # Back to root
# Make sure SSH is running (it should be from setup-alpine) rc-service sshd status # If not running, start it rc-service sshd start rc-update add sshd # Verify SSH config allows password auth (should be default) grep PasswordAuthentication /etc/ssh/sshd_config # If it says "no", edit the file: # nano /etc/ssh/sshd_config # Change to: PasswordAuthentication yes # Then: rc-service sshd restart
# Get your current DHCP IP ip addr show eth0 | grep "inet " # Look for: inet 192.168.1.xxx/24 # Write down this IP address!
# From your Windows PowerShell: ssh ryanc@192.168.1.xxx # Use the DHCP IP from Step 10 # Enter your user password when prompted # Should connect! Don't exit yet - we'll add SSH keys now
# In your SSH session on node222: # Create .ssh directory mkdir -p ~/.ssh chmod 700 ~/.ssh # Create authorized_keys file nano ~/.ssh/authorized_keys # On Windows (in another PowerShell window), copy your public key: # Get-Content C:\Users\ryanc\.ssh\id_ed25519.pub | Set-Clipboard # OR the shorter version: # cat ~/.ssh/id_ed25519.pub | clip # Back in nano on node222: # Paste your public key (Right-click in terminal, or Ctrl+Shift+V) # Should be one long line starting with: ssh-ed25519 AAAA... or ssh-rsa AAAA... # Save: Ctrl+O, Enter, Ctrl+X # Set correct permissions chmod 600 ~/.ssh/authorized_keys # Verify the key was added cat ~/.ssh/authorized_keys # Should show your public key
# Exit your current SSH session exit # From Windows, SSH in again: ssh ryanc@192.168.1.xxx # Same DHCP IP # Should connect WITHOUT asking for password! # If it asks for password, something's wrong with the key setup
no - you must change it to yes.
# In your SSH session, edit SSH config doas nano /etc/ssh/sshd_config # Find this line (use Ctrl+W to search): # AllowTcpForwarding no # Change it to: AllowTcpForwarding yes # Save: Ctrl+O, Enter, Ctrl+X # Restart SSH to apply changes doas rc-service sshd restart # Verify SSH restarted successfully doas rc-service sshd status
# In your SSH session, install iptables doas apk add iptables iptables-openrc # Create basic firewall rules - paste this entire block: doas sh -c 'cat > /etc/iptables/rules-save << "EOF" *filter :INPUT DROP [0:0] :FORWARD DROP [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -i lo -j ACCEPT -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p tcp --dport 22 -j ACCEPT -A INPUT -p tcp --dport 80 -j ACCEPT -A INPUT -p tcp --dport 443 -j ACCEPT -A INPUT -p tcp --dport 11235 -j ACCEPT -A INPUT -p icmp --icmp-type echo-request -j ACCEPT COMMIT EOF ' # Apply firewall rules doas /etc/init.d/iptables save doas rc-update add iptables doas rc-service iptables start
# In your SSH session, check everything uname -a # Should show: Linux node222 ... Alpine Linux # Check installed packages apk info | grep -E 'bash|curl|wget|nano|doas' # Verify doas works doas apk update # Check SSH is running doas rc-service sshd status
Install Extension:
Configure SSH Connection:
F1 or Ctrl+Shift+Pssh ryanc@192.168.1.xxx (use your current DHCP IP)C:\Users\ryanc\.ssh\config)Connect:
F1 againryanc@192.168.1.xxx)/home/ryancexit in any open SSH sessions before using VS Code Remote-SSH.Install GitHub Copilot (if you have it):
Install GitHub Copilot Chat (separate extension):
Ctrl+Alt+I for inline chatgcompat package (from troubleshooting) enables Copilot's language server to run on Alpine's musl libc.
Other useful extensions to install remotely:
Tip: You can see which extensions are local-only vs remote-capable in the Extensions panel. Look for the "Install in SSH" button.
Open terminal in VS Code (Ctrl+`):
# Check system uname -a # Should show: Linux node222 ... Alpine Linux # Check memory free -h # Should show ~2 GB total # Check disk df -h # Should show ~15 GB for /dev/sda* # Test doas doas apk update # Should work without errors # Test internet and DNS ping -c 2 google.com # Should work
# In VS Code terminal connected to Alpine # Edit network interfaces file doas nano /etc/network/interfaces # Change from DHCP to static - replace the eth0 section with: auto eth0 iface eth0 inet static address 192.168.1.211 netmask 255.255.255.0 gateway 192.168.1.1 # Save (Ctrl+O, Enter, Ctrl+X) # Update DNS configuration (make it persistent) doas sh -c 'echo "nameserver 192.168.1.1" > /etc/resolv.conf' # Restart networking service doas rc-service networking restart # Verify static IP is set ip addr show eth0 # Should show: inet 192.168.1.211/24 # Test connectivity ping -c 2 192.168.1.1 # Gateway ping -c 2 8.8.8.8 # Internet ping -c 2 google.com # DNS resolution
On your Windows laptop, edit SSH config:
# Open: C:\Users\ryanc\.ssh\config # Change the old DHCP IP to the static IP: Host node222 HostName 192.168.1.211 User ryanc IdentityFile ~/.ssh/id_ed25519 # (or your key file)
Reconnect VS Code:
F1node222 (or 192.168.1.211)# In VS Code terminal connected to node222 via static IP # Edit SSH config doas nano /etc/ssh/sshd_config # Find and change this line: PasswordAuthentication no # Save (Ctrl+O, Enter, Ctrl+X) and restart SSH doas rc-service sshd restart # Test one more time from Windows to confirm keys still work: # Exit VS Code, close connection # ssh ryanc@192.168.1.211 # Should connect WITHOUT password!
You now have:
# SSH into node222 from PowerShell ssh ryanc@192.168.1.xxx # Install gcompat (glibc compatibility for Alpine) doas apk add gcompat libstdc++ # Exit SSH session exit # Back in VS Code: # 1. Close the hung VS Code window # 2. Press F1 → "Remote-SSH: Kill VS Code Server on Host" # 3. Select your host (ryanc@192.168.1.xxx) # 4. Try connecting again - should work now!
Alternative: Use SSH terminal instead of VS Code Remote-SSH
If VS Code Remote-SSH continues to have issues, you can still use VS Code to edit files locally and just SSH in for testing. Or use the integrated terminal in VS Code with a regular SSH connection.
# Create the network interfaces file from scratch cat > /etc/network/interfaces << 'EOF' auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp EOF # Verify the file was created correctly cat /etc/network/interfaces # Start networking service rc-service networking start # Enable networking to start on boot rc-update add networking boot # Verify eth0 is now UP ip addr show eth0
Recommendation: Use alpine-standard ISO to avoid this issue entirely.
Why DHCP during installation?
Hyper-V has a known compatibility issue with Alpine Linux when using static IP configuration during the setup-alpine wizard. The network interface initialization timing causes DNS resolution to fail, preventing APK mirror access. Using DHCP allows Hyper-V to properly initialize the network stack, then we safely convert to static IP after installation completes.
Network Configuration Order:
Why setup before static IP?
By doing all configuration while using DHCP, we ensure packages install correctly, SSH works, and VS Code connects successfully. Only after confirming everything works do we convert to static IP. This approach minimizes risk and makes troubleshooting easier.
If SSH Issues Occur:
# Check SSH service status rc-service sshd status # Verify SSH is listening on port 22 netstat -tlnp | grep :22 # Check authorized_keys permissions ls -la ~/.ssh/authorized_keys # Should be: -rw------- (600) # Temporarily enable password auth for testing (if needed) doas nano /etc/ssh/sshd_config # Set: PasswordAuthentication yes doas rc-service sshd restart
| Category | Command | Description |
|---|---|---|
| System | doas apk update |
Update package list |
| System | doas apk upgrade |
Upgrade packages |
| System | doas apk add packagename |
Install package |
| System | doas reboot |
Reboot system |
| Service | doas rc-service sshd restart |
Restart SSH |
| Service | doas rc-service sshd status |
Check SSH status |
| Network | ip addr show |
Show IP addresses |
| Network | ping 8.8.8.8 |
Test internet |
| Firewall | doas iptables -L -n -v |
List firewall rules |
For reference when migrating to node222, here's the complete nginx configuration from node201 (Windows):
/etc/nginx/ instead of C:/node/nginx/)
proxy_passAlpine-specific adaptations needed:
C:/node/nginx/ paths to /etc/nginx/ or /var/www/html//var/log/nginx/logs/ to /var/log/nginx/nginx or www-data)