Linux Dev Tunnel for Remote Dev Environment
Published: November 5, 2025
By popular demand I’m writing this article about setting up a Dev Tunnel that is hosted on a Linux machine. Truth be told, I think I prefer the Linux Dev Tunnel experience to the Windows Dev Tunnels - the Linux tunnels seem more stable. The instructions are very similar to the Windows steps, with obvious adjustments:
If you want, you can read the Windows Instructions
Run all these commands on your Linux/host/remote machine - I did this on a new Ubuntu 25 server:
Install Git: (git was already installed for me)
sudo apt install git
Install the GitHub CLI:
sudo apt install gh
Login to GitHub using the CLI:
gh auth login
Setup git user info:
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
Install the .NET SDK:
wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt-get update && \
sudo apt-get install -y dotnet-sdk-9.0
Documentation from Microsoft about installing the .NET SDK on Ubuntu: https://learn.microsoft.com/en-us/dotnet/core/install/linux-debian?tabs=dotnet9
Install VS Code CLI:
Get CLI files
curl -L "https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64" -o "vscode-cli-linux-x64.tar.gz"
Create new directory for the CLI
mkdir -p ~/.local/bin
Extract the download file to the new directory
tar -xvzf vscode-cli-linux-x64.tar.gz --directory ~/.local/bin
Add the CLI to your PATH. This way you can run ‘code’ commands
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
Apply the changes to your current session. (After reboot ‘code’ will be available)
source ~/.bashrc
Start Tunnel
Running this command will prompt you to sign in to GitHub and allow VS Code access to your GitHub account. Follow the instructions on the terminal to complete the authentication setup. On completing those steps you will be given a URL that you can open on your client machine (my iPad in my case). When you open the URL, you will be prompted to authenticate it GitHub - complete those steps.
code tunnel
Starting the tunnel can be repetitive. I wanted my tunnel to run as a service and always available. Setup Dev Tunnel as a service to start automatically at boot:
code tunnel service install
Lingering
Enable lingering is necessary because it ensures the user’s systemd session (User Manager) persists after they log out from the server (e.g., close the SSH connection).
Without lingering enabled:
- The user’s session is killed upon logout by the systemd-logind service.
- The VS Code tunnel, which is installed as a systemd –user service, is dependent on this user session.
- When the user session dies, the code tunnel process is also killed, and the tunnel stops running.
Enabling lingering tells the system to keep that User Manager instance active, allowing the VS Code tunnel service to run 24/7 in the background without an active login session:
sudo loginctl enable-linger [USERNAME]
Microsoft Documentation on Tunnels: https://code.visualstudio.com/docs/remote/tunnels
Stay awesome!