What is Multipass?
Multipass是一款适用于Linux、Windows和macOS的轻量级虚拟机管理器。它是为那些想要一个全新的Ubuntu环境的开发人员设计的,只需一个命令。它在Linux上使用KVM,在Windows上使用Hyper-V,在macOS上使用QEMU,以最小的开销运行虚拟机。它还可以在Windows和macOS上使用VirtualBox。Multipass将为您获取图像并使其保持最新。
由于它支持云初始化的元数据,您可以在笔记本电脑或工作站上模拟小型云部署。
Project Status
Service | Status |
---|---|
CI | |
Snap | |
Codecov |
Install Multipass
On Linux it's available as a snap:
sudo snap install multipass
For macOS, you can download the installers from GitHub or use Homebrew:
# Note, this may require you to enter your password for some sudo operations during install
# Mac OS users may need to disable their firewall to launch a multipass instance successfully
brew install --cask multipass
On Windows, download the installer from GitHub.
Usage
Find available images
$ multipass find
Image Aliases Version Description
core core16 20200213 Ubuntu Core 16
core18 20200210 Ubuntu Core 18
16.04 xenial 20200721 Ubuntu 16.04 LTS
18.04 bionic,lts 20200717 Ubuntu 18.04 LTS
20.04 focal 20200720 Ubuntu 20.04 LTS
daily:20.10 devel,groovy 20200721 Ubuntu 20.10
Launch a fresh instance of the current Ubuntu LTS
$ multipass launch ubuntu
Launching dancing-chipmunk...
Downloading Ubuntu 18.04 LTS..........
Launched: dancing chipmunk
Check out the running instances
$ multipass list
Name State IPv4 Release
dancing-chipmunk RUNNING 10.125.174.247 Ubuntu 18.04 LTS
live-naiad RUNNING 10.125.174.243 Ubuntu 18.04 LTS
snapcraft-asciinema STOPPED -- Ubuntu Snapcraft builder for Core 18
Learn more about the VM instance you just launched
$ multipass info dancing-chipmunk
Name: dancing-chipmunk
State: RUNNING
IPv4: 10.125.174.247
Release: Ubuntu 18.04.1 LTS
Image hash: 19e9853d8267 (Ubuntu 18.04 LTS)
CPU(s): 1
Load: 0.97 0.30 0.10
Disk usage: 1.1G out of 4.7G
Memory usage: 85.1M out of 985.4M
Connect to a running instance
$ multipass shell dancing-chipmunk
Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-42-generic x86_64)
...
Don't forget to logout (or Ctrl-D) or you may find yourself heading all the way down the Inception levels... ;)
Run commands inside an instance from outside
$ multipass exec dancing-chipmunk -- lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
Stop an instance to save resources
$ multipass stop dancing-chipmunk
Delete the instance
$ multipass delete dancing-chipmunk
It will now show up as deleted:
Name State IPv4 Release
snapcraft-asciinema STOPPED -- Ubuntu Snapcraft builder for Core 18
dancing-chipmunk DELETED -- Not Available
And when you want to completely get rid of it:
$ multipass purge
Get help
multipass help
multipass help <command>
Get involved!
Here's a set of steps to build and run your own build of Multipass. Please note that the following instructions are for building Multipass for Linux only. These instructions do not support building packages for macOS or Windows systems.
Build Dependencies
cd <multipass>
apt install devscripts equivs
mk-build-deps -s sudo -i
Building
cd <multipass>
git submodule update --init --recursive
mkdir build
cd build
cmake ../
make
Running Multipass daemon and client
First, install multipass's runtime dependencies. On amd64 architecture, you can achieve that with:
sudo apt update
sudo apt install libgl1 libpng16-16 libqt6core6 libqt6gui6 \
libqt6network6 libqt6widgets6 libxml2 libvirt0 dnsmasq-base \
dnsmasq-utils qemu-system-x86 qemu-utils libslang2 iproute2 \
iptables iputils-ping libatm1 libxtables12 xterm
Then run multipass's daemon:
sudo <multipass>/build/bin/multipassd &
Copy the desktop file multipass clients expect to find in your home:
mkdir -p ~/.local/share/multipass/
cp <multipass>/data/multipass.gui.autostart.desktop ~/.local/share/multipass/
Optionally, enable auto-complete in bash:
source <multipass>/completions/bash/multipass
Finally, use multipass's clients:
<multipass>/build/bin/multipass launch --name foo # CLI client
<multipass>/build/bin/multipass.gui # GUI client
最新内容
- 1 week 1 day ago
- 1 week 1 day ago
- 1 week 1 day ago
- 1 week 1 day ago
- 1 week 1 day ago
- 2 weeks ago
- 2 weeks ago
- 2 weeks 3 days ago
- 2 weeks 3 days ago
- 2 weeks 3 days ago