Use Cases
Virtual Computing

Linux Virtual Desktop

22min

Guide: Linux Virtual Desktop on Vast.ai

This guide will help you set up and use a Linux Virtual Desktop environment on Vast.ai using the Ubuntu Desktop (VM) template.

Prerequisites

Initial Setup

Creating Your Instance

  1. Navigate to the Templates tab
  2. In the search bar at the top, type "Ubuntu Desktop (VM)" to find the template. Make sure you're searching across all templates and not only recommended templates.
  3. Select the template by clicking the play button
  4. Choose your preferred GPU from the search results. Try to find a GPU close to you if possible
  5. Click "Rent" to create your instance
  6. Go to Instances tab and wait for the blue button on the instance card to say "Open". It can take a good amount of time to load if the docker image isn't cached on the machine.

Accessing Your Instance

After launching your instance, you have several ways to connect:

  • Browser Access (Recommended)
    • Click the 'Open' button on your instance card to launch the Instance Portal
    • Choose between two browser-based viewers:
      • Selkies WebRTC: More responsive, better performance
      • NoVNC: Alternative option if WebRTC isn't working well
  • VNC Client
    • Connect using any VNC client
    • Address: instance_ip:5900
    • Password: Your OPEN_BUTTON_TOKEN
  • SSH Access
    • Connect via SSH using the command provided in the Vast.ai console
    • For non-root access:
Linux


First-Time Setup

  • Change the default password by executing the following command in Linux terminal and go along with rest of the prompts:
Linux


Features and Capabilities

Pre-installed Software

The environment comes with several applications ready to use:

  • Web Browsers
    • Firefox
    • Chrome
  • Development Tools
    • Docker (pre-configured for non-root use)
    • Terminal emulator
    • Common development utilities
  • Creative Software
    • Blender (3D creation suite)
    • Wine (Windows application compatibility layer)
  • Gaming Support
    • Steam (with Proton compatibility for Windows games)
    • Sunshine streaming server

Remote Desktop Options

Selkies WebRTC (Recommended)

  • Access via port 6100
  • Best performance for most users
  • Hardware-accelerated graphics
  • Audio support

NoVNC

  • Access via port 6200
  • Backup option if WebRTC isn't working
  • More compatible with different browsers

VNC Client

  • Traditional VNC connection
  • Use your preferred VNC client
  • Port: 5900

Advanced Features

Tailscale Integration

  1. Install Tailscale on your local device. Password is "password" if you haven't changed it.
  2. On the instance, run:



Linux


Follow rest of the prompts to connect to your tailnet.

Game Streaming with Moonlight

  1. Set up Tailscale (required)
  2. Configure the pre-installed Sunshine server
  3. Connect using the Moonlight client on your local device

Cloudflare Tunnels

  • Create secure tunnels without exposing ports and having to create a new instance
  • Manage via the Instance Portal
  • Perfect for temporary application sharing

Security Considerations

Port Management

The following ports are exposed by default:

  • 22: SSH
  • 1111: Instance Portal
  • 3478: TURN Server
  • 5900: VNC Server
  • 6100: Selkies WebRTC
  • 6200: NoVNC
  • 741641: Tailscale

Consider:

  • Using Tailscale for secure access
  • Creating Cloudflare tunnels for HTTP access
  • Closing unnecessary ports

Authentication

  • Instance Portal
    • username: vastai
    • password: Your OPEN_BUTTON_TOKEN
  • Change the default user password immediately
  • Use SSH keys for remote access

Troubleshooting

  • Connection Issues
    • Try different connection methods (WebRTC, NoVNC, VNC)
    • Check if ports are accessible
    • Verify your authentication credentials
  • Performance Problems
    • Ensure you're using hardware acceleration
    • Try WebRTC for better performance
    • Check your internet connection quality
  • Application Problems
    • Check system logs: /var/log/portal/
    • Restart Caddy if needed: systemctl restart caddy
    • Verify application configurations in /etc/portal.yaml

Best Practices

  • Security
    • Change default passwords immediately
    • Use Tailscale or Cloudflare tunnels when possible
    • Keep unnecessary ports closed
  • Performance
    • Use WebRTC for best desktop performance
    • Enable hardware acceleration when available
    • Close unused applications
  • Data Management
    • Keep important data backed up
    • Use version control for development
    • Monitor instance storage usage

Additional Resources