Operation and maintenance: Multipass software makes your virtual machine management easier and more efficient

picture

1. What is Multipass?

Official website: https://multipass.run/

picture

When it comes to virtual machines, people generally think of VMvare and Virtual Box, two virtual machine software. One of the more troublesome parts of these two software is that after installing the virtual machine, you need to download the operating system image. The editor discovered Multipass by accident. This lightweight virtual machine manager can quickly install an Ubuntu environment with just one command.

Multipass is a lightweight virtual machine manager that is an open source project launched by Canonical, the company that runs Ubuntu officially. The runtime environment supports Linux and provides a command line interface to start and manage Linux instances. It takes seconds to download a fresh image and have a VM up and running in minutes.

Features

  • Ease of use: Multipass provides a simple and intuitive command line interface that allows you to easily create, start, stop and delete virtual machine instances.

  • Rapid Deployment: By using pre-configured base images, Multipass can quickly spin up virtual machines in seconds.

  • Lightweight: Multipass VMs are very lightweight and take up less system resources, which allows you to run multiple VM instances simultaneously without slowing down your computer.

  • Integration with cloud platforms: Multipass supports integration with cloud platforms (such as AWS, Azure, and GCP), allowing you to deploy virtual machine instances to the cloud.

  • Highly customizable: Multipass allows you to choose different operating systems and configuration options for virtual machine instances to meet specific needs.

picture

Multipass supports cross-platform, so it can be installed on Linux, Windows and macOS. This article uses the Win10 operating system to introduce Multipass installation and other related knowledge.

Essentially, Multipass is used to manage virtual machine engines on various platforms , such as:

Hyper-V 和 VirtualBox(Windows)KVM(Linux)HyperKit(macOS)

Therefore, you need to install the corresponding virtual machine engine before using it, and then manage it through Multipass.

Second, install the virtual machine Virtual Box

Download the free Virtual Box from the official website and install it.

https://pan.quark.cn/s/4e34a2f09f56

picture

picture

3. Install Multipass

download link:

https://pan.quark.cn/s/4fe07ab88e7e

The installation package is very small, only more than 20 M.

picture

Double-click to install, and then the next step.
 

picture

picture

I have installed Virtual Box, so I chose [Oracle VM Virtual Box]

picture

Add environment variables.

picture

Select the installation path.

picture

picture

Install

picture

picture

After the installation is complete, it can be used.

4. Use Multipass

4.1 Help for using Multipass

Enter multipass on the command line to get help on using Multipass.

C:\Users\Administrator>multipassUsage: multipass [options] <command>Create, control and connect to Ubuntu instances.
This is a command line utility for multipass, aservice that manages Ubuntu instances.
Options:  -?, -h, --help  Displays help on commandline options.  --help-all      Displays help including Qt specific options.  -v, --verbose   Increase logging verbosity. Repeat the 'v' in the short                  option for more detail. Maximum verbosity is obtained with 4                  (or more) v's, i.e. -vvvv.
Available commands:  alias         Create an alias  aliases       List available aliases  authenticate  Authenticate client  delete        Delete instances  exec          Run a command on an instance  find          Display available images to create instances from  get           Get a configuration setting  help          Display help about a command  info          Display information about instances  launch        Create and start an Ubuntu instance  list          List all available instances  mount         Mount a local directory in the instance  networks      List available network interfaces  purge         Purge all deleted instances permanently  recover       Recover deleted instances  restart       Restart instances  set           Set a configuration setting  shell         Open a shell on a running instance  start         Start instances  stop          Stop running instances  suspend       Suspend running instances  transfer      Transfer files between the host and instances  umount        Unmount a directory from an instance  unalias       Remove an alias  version       Show version details
 
 

View the installed Multipass version information

C:\Users\Administrator>multipass versionmultipass   1.9.1+winmultipassd  1.9.1+win

4.2 Create an instance

The multipass launch command is used to create an instance.

You can create an instance with the following command.

multipass launch --name <实例名称>multipass launch -n <实例名称>
 
 

If the name parameter is not specified, multipass will randomly generate an instance name.

View the created instance.

C:\Users\Administrator>multipass listNo instances found.  --》当前没有创建任何实例
 
 

example:

​​​​​​​

--下载镜像C:\Users\Administrator>multipass launchRetrieving image: 5%
--创建实例acceptable-joey C:\Users\Administrator>multipass launchStarting acceptable-joey -
 
 

** When launch creates an instance for the first time, it will take a few minutes to download the image, and then launch will directly create the instance.

4.3 View the instance list

C:\Users\Administrator>multipass listName                    State             IPv4             Imageacceptable-joey         Running           N/A              Ubuntu 20.04 LTS
 
 

View instance information with the following command

multipass info <实例名称>
example:
C:\Users\Administrator>multipass info acceptable-joeyName:           acceptable-joeyState:          RunningIPv4:           N/ARelease:        Ubuntu 20.04.4 LTSImage hash:     75a04c7eed58 (Ubuntu 20.04 LTS)Load:           0.24 0.17 0.07Disk usage:     1.4G out of 4.7GMemory usage:   137.7M out of 976.9MMounts:         --
 
 

Create named instances:

 
 
C:\Users\Administrator>multipass launch -n testLaunched: test
C:\Users\Administrator>multipass launch --name test2Launched: test2
C:\Users\Administrator>multipass listName                    State             IPv4             Imageacceptable-joey         Running           N/A              Ubuntu 20.04 LTStest                    Running           N/A              Ubuntu 20.04 LTStest2                   Running           N/A              Ubuntu 20.04 LTS
delete instance
 
 
multipass delete test2 --purgeC:\Users\Administrator>multipass listName                    State             IPv4             Imageacceptable-joey         Running           N/A              Ubuntu 20.04 LTStest                    Running           N/A              Ubuntu 20.04 LTS

4.4 Shutting down and starting an instance

C:\Users\Administrator>multipass stop acceptable-joey
C:\Users\Administrator>multipass stop test
C:\Users\Administrator>multipass listName                    State             IPv4             Imageacceptable-joey         Stopped           --               Ubuntu 20.04 LTStest                    Stopped           --               Ubuntu 20.04 LTS
C:\Users\Administrator>multipass start test
C:\Users\Administrator>multipass listName                    State             IPv4             Imageacceptable-joey         Stopped           --               Ubuntu 20.04 LTStest                    Running           N/A              Ubuntu 20.04 LTS

4.5 Use cases

Start using the instance's command line through the multipass shell.

multipass shell <实例名称>
example:
C:\Users\Administrator>multipass shell testWelcome to Ubuntu 20.04.4 LTS (GNU/Linux 5.4.0-120-generic x86_64)
 * Documentation:  https://help.ubuntu.com * Management:     https://landscape.canonical.com * Support:        https://ubuntu.com/advantage
  System information as of Wed Jun 22 21:29:00 CST 2022
  System load:  0.0               Processes:               102  Usage of /:   29.1% of 4.67GB   Users logged in:         0  Memory usage: 19%               IPv4 address for enp0s3: 10.0.2.15  Swap usage:   0%

1 update can be applied immediately.To see these additional updates run: apt list --upgradable

To run a command as administrator (user "root"), use "sudo <command>".See "man sudo_root" for details.
ubuntu@test:~$ pwd/home/ubuntuubuntu@test:~$ hostnametestubuntu@test:~$ iduid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),117(netdev),118(lxd)

This is an ubuntu virtual machine, you can use it to your heart's content. Isn't it very convenient!

Guess you like

Origin blog.csdn.net/xishining/article/details/132030865