Skip to content

Instantly share code, notes, and snippets.

@nonkronk
Last active June 28, 2024 09:42
Show Gist options
  • Save nonkronk/7f80a771c85ae31400d223bbaaefdc05 to your computer and use it in GitHub Desktop.
Save nonkronk/7f80a771c85ae31400d223bbaaefdc05 to your computer and use it in GitHub Desktop.
Setup an Always-on VSCode Tunnel on Ubuntu Server

Setup an Always-on VSCode Tunnel on Oracle Cloud Always-free Instance

Access Oracle Cloud VM from any browser on any devices

Install VSCode for arm64

wget -O vscode.deb https://code.visualstudio.com/sha/download\?build\=stable\&os\=linux-deb-arm64 && sudo apt install ./vscode.deb --fix-broken -y && rm vscode.deb

Setup tunnel for the first time and exit (Ctrl+C)

# It will ask you to login with github account and setup device login.
# Press Ctrl+C to exit the tunnel
code tunnel --accept-server-license-terms

Create a systemd service

sudo vi /etc/systemd/system/code-tunnel.service
[Unit]
Description=VSCode Tunnel as Daemon

[Service]
Type=simple
ExecStart=/usr/bin/code tunnel
User=your-username
Group=your-group
Restart=on-failure

[Install]
WantedBy=multi-user.target

Enable and start the service

sudo systemctl daemon-reload
sudo systemctl enable code-tunnel
sudo systemctl start code-tunnel

Check the status of the service

sudo systemctl status code-tunnel

Access the tunnel with the given link

https://vscode.dev/tunnel/your-machine-hostname

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment