If you want to work these days with Linux, you don’t really need a full-blown Linux system. In my case, I have installed a few additional tools like gcc, nasm, and gdb to be able to do the interesting stuff □ Then you can use the command Remote-SSH: Connect to Host within Visual Studio Code to connect to your remote development environment.Īs soon as you have the remote connection established, you will land on the Windows terminal.Īnd from there you must run the wsl.exe command, which connects to your default installed WSL Linux distribution:Īnd from there you are in a full-blown Linux environment without ever directly installing a Linux virtual machine. Install the extension Remote – SSH in the first step. To be able to connect from Visual Studio Code to your remote development environment, you must Have also changed here the startup type to Automatic, so that the SSH services is started when Windows starts up.Īfter these steps you can try to connect through SSH to Windows on the MacOS terminal. To install the OpenSSH client and server on Windows Server 2022, you can use the following commands on a PowerShell prompt:Īdd-WindowsCapability -Online -Name OpenSSH.ClientĪdd-WindowsCapability -Online -Name OpenSSH.ServerĪfter the installation of the OpenSSH components, you must make sure that the port 22 is notīlocked on the Windows Firewall, and that the SSH service is up and running. Windows supports already for a few years SSH, so this is not a big deal for us. One of the prerequisites of the remote development feature of Visual Studio Code is the presence of a SSH server on your remote machine. I want to show you now the necessary steps how to configure your WSL-based Linux installation for remote access with Visual Studio Code. Then you can use the local Visual Studio Code installation to connect to your remote development environment. In addition, Visual Studio Code also supports a Remote Development feature, where you use a Docker Container, a remote machine, or the Windows Subsystem for Linux for your development environment. The cool thing about Visual Studio Code is that is available on all major OS platforms (Windows, Linux, Mac OS), and it is a very lightweight installation. In the past when I worked directly within a Ubuntu virtual machine, I have used Visual Studio Code as my development environment. Configuring WSL for Remote Accessīy now we have a running Linux distribution running within WSL. The bash shell is the same as under a traditional Linux installation, so you also have access to the apt package manager and install additional tools like ifconfig. And finally, you are landing on the traditional Linux bash shell – on a Windows system. In the case of Ubuntu, you must provide a username and a password. After the reboot, the configuration of the chosen Linux distribution happens. To make the installation complete, you need a reboot of your machine. You can install it with the following command:Īs you can see from the picture, the command creates a lightweight Hyper-V VM, downloads the customized Linux Kernel, and installs it into the VM. I have decided for the Ubuntu 20.04 distribution, because I’m quite familiar with it, and it is one of the most well-known ones. I ran this command on a fresh Windows Server 2022 installation, and it returns you the following available distributions to install: Windows offers you a lot of different Linux distributions that you can install for WSL. For that reason, Microsoft offers you a modified version of the Linux Kernel which is optimized for running on top of Windows. WSL runs on top of a traditional Linux Kernel that runs on a very lightweight utility Hyper-V virtual machine. With WSL – the Windows Subsystem for Linux – you can run Linux based applications directly on Windows. In today’s blog posting I want to show you how you can install WSL on Windows Server 2022, and how to configure it for a remote access through Visual Studio Code – which runs on my Mac Book Pro/ M1/M2 Air – it doesn’t really matter. Therefore, I have tried to reproduce my research efforts directly in WSL – the Windows Subsystem for Linux, which is available on the most recent Windows builds – including Windows Server 2022. But a dedicated virtual machine for this purpose is a quite huge overhead. For that reason, I had initially built a dedicated Ubuntu virtual machine to perform my research and my experiments. Over the last few weeks and months, I have spent a lot of time researching and experimenting with Linux on a very low level – mostly directly on the C and assembly level in combination with the official source code.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |