Tired of VMware, try a lighter virtual machine

Posted by utahcon on Sat, 18 Dec 2021 02:54:53 +0100

When it comes to virtual machine tools, VMware is naturally the most familiar. It has many powerful functions. What I recognize most is that it is very convenient to modify the configuration of the virtual machine to make the virtual machine achieve its desired performance ~ ~

But VMware is really easy to use, but you have to pay! It's not cheap. I feel a little distressed every time I renew the fee

Multipass

Recently, a reader recommended me a virtual machine tool: Multipass, a very lightweight virtual machine command management tool. The operating environment supports Linux, Windows and macOS.

Start using

First, we need to download and install Multipass on the official website and select our corresponding operating system. I choose Windows.

After installation, check the version you installed

$ multipass version

Creating an Ubuntu virtual machine

First, check the Ubuntu image you can download and use,

$ multipass find

After running successfully, you can see the following list of images, including various versions of.

Image                       Aliases           Version          Description                                              
snapcraft:core18                              20201111         Snapcraft builder for Core 18                            
snapcraft:core20                              20201111         Snapcraft builder for Core 20                            
core                        core16            20200818         Ubuntu Core 16                                           
core18                                        20200812         Ubuntu Core 18                                           
16.04                       xenial            20210128         Ubuntu 16.04 LTS                                         
18.04                       bionic            20210129         Ubuntu 18.04 LTS                                         
20.04                       focal,lts         20210223         Ubuntu 20.04 LTS                                         
20.10                       groovy            20210209         Ubuntu 20.10                                             
appliance:adguard-home                        20200812         Ubuntu AdGuard Home Appliance                            
appliance:mosquitto                           20200812         Ubuntu Mosquitto Appliance                               
appliance:nextcloud                           20200812         Ubuntu Nextcloud Appliance                               
appliance:openhab                             20200812         Ubuntu openHAB Home Appliance                            
appliance:plexmediaserver                     20200812         Ubuntu Plex Media Server Appliance

Create a new container

$ multipass launch --name dg
Launched: dg

Then download the latest version of Ubuntu image, and then we can use it directly.

$ multipass exec dg -- lsb_release -d
Description:    Ubuntu 18.04.4 LTS

Operating virtual machines

View the list of virtual machines

After the virtual machine is created, view the list of virtual machines.

Name                 State             IPv4             Image
dg                   Running           192.168.24.5     Ubuntu 18.04 LTS

Now there is a Ubuntu 18.04 virtual machine running, and the corresponding IP address is 192.168 24.5 .

View virtual machine information

You can view the specific information of the currently running virtual machine through the command.

$ multipass info --all

Name:           dg
State:          Running
IPv4:           192.168.24.5
Release:        Ubuntu 18.04.4 LTS
Image hash:     fe3030933742 (Ubuntu 18.04 LTS)
Load:           0.00 0.00 0.00
Disk usage:     1.5G out of 4.7G
Memory usage:   112.1M out of 985.7M

Enter virtual machine

Use the following command to view the system configuration information, memory, disk, etc. of the virtual machine.

$ multipass shell dg

If you don't want to enter the system, you can also operate the Ubuntu system through the multipass exit command mentioned above.

Pause / restart virtual machine

# suspend
$ multipass stop dg
# start-up
$ multipass start dg

Delete / release virtual machine

After deleting a virtual machine with the delete command, the virtual machine actually exists. If you want to delete it completely, you need to release the virtual machine.

# delete
$ multipass delete dg
# release
$ multipass purge dg

Configuration automation

We should not only keep the development environment consistent with the online environment, but also save deployment time. We can use -- cloud init to initialize and configure the container:

$ multipass launch --name ubuntu --cloud-init config.yaml

config.yaml is the initialization configuration file, which is as follows:

#cloud-config

runcmd:
  - curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
  - sudo apt-get install -y nodejs  
  - wget https://releases.leanapp.cn/leancloud/lean-cli/releases/download/v0.21.0/lean-cli-x64.deb  
  - sudo dpkg -i lean-cli-x64.deb

runcmd can specify the command to run when the container is first started

summary

After a period of use, I think this tool is really good! For example, I want to do some small experiments on linux. I can set up the system to test through Multipass in a few minutes. To test small database clusters, you can also quickly build virtual machine clusters locally through Multipass, which is very good!

The only drawback is that Multipass can only use Ubuntu image, because this tool is developed and open-source by Canonical company behind Ubuntu.

Related links

Official website: Multipass orchestrates virtual Ubuntu instances

file: Multipass Documentation | Multipass documentation

Topics: Programming Linux Docker Ubuntu Programmer