DEV Community

loading...
Cover image for Multipass & VsCode in Windows

Multipass & VsCode in Windows

dialguiba profile image Diego ・3 min read

Multipass provides a command line interface to launch, manage and generally fiddle about with instances of Linux. The downloading of a minty-fresh image takes a matter of seconds, and within minutes a VM can be up and running. [multipass.run]

(...) This is a project run by Canonical. It is a cross-platform tool for running light-weight Linux virtual machines, and it is available for Windows, macOS, and Linux.
Being from Canonical - Linux, in this case, means Ubuntu, since that is the only flavor of Linux available out of the box. They seem to have allowed for 3rd parties to create images for other Linux flavors that can work with Multipass.
With Multipass you get a full-fledged Ubuntu instance that supports background processes and everything else. It is light-weight enough to leave running in the background without any impact on your computer. For example, I recently set up a pair of Multipass instances to experiment with launching a Docker Swarm - I wrote the blog posts - and it seems that I forgot to shut down the instances. So these instances have been active in the background, and I didn’t notice it. (...)" [David Herron, https://www.quora.com/Should-I-use-Linux-on-VM-or-in-Windows-Subsystem]

  • Serial for upgrading to Windows 10 pro:
Lic Generica: 
FB4WR-32NVD-4RW79-XQFWH-CYQG3

Alternativa:
 VK7JG-NPHTM-C97JM-9MPGT-3V66T

Alternativa 2
NRG8B-VKK3Q-CXVCJ-9G2XF-6Q84J
Enter fullscreen mode Exit fullscreen mode
  • Activator of Windows 10 (Any Edition)

Activacion Windows 10 por MT.rar

  • Activate Hypervisor Feature

Alt Text

  • Install Multipass (When installing select "Use Hypervisor")

    https://multipass.run/

  • Change Storage of Multipass (Optional if you want to have your files in another route)

Stop-Service Multipass
Set-ItemProperty -Path "HKLM:System\CurrentControlSet\Control\Session Manager\Environment" -Name MULTIPASS_STORAGE -Value "D:\Hyper-V"
Start-Service Multipass
Enter fullscreen mode Exit fullscreen mode

SOME COMMANDS

  • Start the primary instance
multipass start
Enter fullscreen mode Exit fullscreen mode
  • Create another instances:
multipass launch --name ubuntu-lts
Enter fullscreen mode Exit fullscreen mode
  • Listar instancias
multipass list
Enter fullscreen mode Exit fullscreen mode
  • Ingresar al shell
multipass shell primary
Enter fullscreen mode Exit fullscreen mode

https://www.techrepublic.com/article/how-to-share-data-between-host-and-vm-with-multipass/

Connect using ssh

  • Activate SSH Pass Require (If you want that it asks for a pass when you initiate ssh connection)

you have to modify sshd_config file.

  1. Log as root to your Ubuntu server
  2. Use vim or nano to edit the contents of /etc/ssh/sshd_configEg. vi /etc/ssh/sshd_config or nano /etc/ssh/sshd_config
  3. Now go to the very bottom of the file (to the line with PasswordAuthentication) - Change the value next to PasswordAuthentication from no to yes.It should now look like this:

    # Change to no to disable tunnelled clear text passwords
    PasswordAuthentication yes
    
    
  4. Save the file and then run the following command to reload the SSH config:sudo service sshd reload

Ref. intalix , https://www.digitalocean.com/community/questions/error-permission-denied-publickey-when-i-try-to-ssh

  • If you don't want that it asks you for a pass just copy the public key (id_rsa) located in the folder of hyper v virtual machines ((...)/hyper-v/data/ssh-keys) into folder c:/users/youruser/.ssh

Once you could connect to your ubuntu machine with ssh let's configure vscode

  • Install the extension remote development

Alt Text

Alt Text

After that is going to ask you for the command that you execute when connect using ssh

For example: ssh ubuntu@172.19.104.11

Discussion

pic
Editor guide