Exyr.org Subscribe

Setting up Windows 10 for programming (in Rust)

Simon Sapin,

Lately I’ve been working with Windows-specific APIs, so I needed to get a Windows dev environment. I’ve mostly used Linux for many years now, so for me programming on Windows feels very foreign. Getting to a point where I started being productive took a number of steps, so here they are, if only for me to find them next time.

Installing Windows 10

Installing programming tools

Accessing Windows remotely

Even when I’m sitting next to the machine running Windows, I prefer to use my usual keyboard and text editor on my main laptop and accessing other machines through the network. The fundamental component of that is of course SSH.

There are a few different ways to run an OpenSSH server on Windows. I’ve had the most success with Chocolatey:

choco install openssh -params '"/SSHServerFeature /SSHServerPort:2210"'

I don’t understand the nested quotes, but Chocolatey seems to be picky about them. Using an alternative port number is easier because Windows might already be using port 22, and it helps my client not freak out about different server keys when connecting at the same IP address to the other dual-boot operating system.

After connect with a ssh:// URL in Nautilus, through GNOME’s integration of SFTP/SSH I can edit remote files as if they were local. For Linux or macOS remote hosts I also run ssh in a local terminal to get a remote shell and do most of my work there, but on Windows I get a cmd.exe-like shell and haven’t yet figured out how to run bash there.

So I’ll need remote GUI access, and will be using it a lot. Both VNC servers I tried were pretty bad, with video latency above one second on a local network. (The VNC servers on macOS or Linux on the same network from the same client did not have that problem.) Remote Desktop turned out to work much better, and support copy/pasting across machines. As to clients:

xfreerdp is started from the command-line (or a script) and accepts many options. Some notable ones are:

OpenSSH client configuration

This is not specific to Windows, but the usual SSH tricks apply. The interesting parts of my client-side (on the Linux laptop) ~/.ssh/config file are below. See man ssh_config for more stuff.

Host windows
    Port 2210

# When not on the same network, connect through an intermediate SSH server
Match host windows exec "ip addr|grep -qv 'inet 10\.11\.12\.'"
    ProxyCommand ssh -W %h:%p jumphost

Host *
    # When a connection is otherwise inactive ping the server regularly.
    # If it’s unresponsive, drop the connection after ~30 seconds.
    # (ServerAliveCountMax defaults to 3.)
    # This helps when resuming the laptop from sleep with open connections,
    # the server might have dropped them in the meantime without the laptop knowing.
    ServerAliveInterval 10

    # Whenever creating a new connection, keep it running in a background process
    # so that other commands (ssh, rsync, git, …) can reuse it.
    # With far-away servers this can save a couple seconds,
    # since each new connection requires several network round-trips.
    ControlMaster auto
    ControlPath ~/.ssh/mux-%r@%h:%p

    # Close these background connections when they haven’t been used for a while.
    ControlPersist 1h