- 🐧 Как создавать и запускать виртуальные машины Ubuntu с Multipass в Linux
- Как установить Multipass на Linux
- Как создавть и запускать виртуальные машины Ubuntu с Multipass на Linux
- Список виртуальных машин
- Primary instance
- Steering the primary instance
- Automatic home mount
- Changing the primary instance
- Working with Multipass instances
- Launching your first instance
- Executing commands
- Getting more information
- Sharing data with the instance
- Deleting the instance
- And more…
- Multipass linux ��� ���
- Ubuntu VMs on demand for any workstation
- Select OS to get started
- Install Multipass on Linux
- How to launch LTS instances
- Install Multipass on Windows
- How to launch LTS instances
- Install Multipass on MacOS
- How to launch LTS instances
- Get Ubuntu Server pro tips
- Cloud-style VMs on-demand
- VMs for Windows, macOS and Linux
- Optimised VM performance
- Designed for developer convenience
- A curated catalogue of images
- Appliances in VMs
- Join our community
🐧 Как создавать и запускать виртуальные машины Ubuntu с Multipass в Linux
Существует множество программ и инструментов, доступных для развертывания виртуальных машин Ubuntu в целях тестирования и обучения.
Некоторые из них – Docker, LXD, LXC, Proxmox, VirtualBox и Vmware и т. д.
Я часто использую Virtualbox для тестирования различных приложений на нескольких дистрибутивах Linux.
Сегодня мы собираемся узнать еще об одной утилите под названием Multipass.
Являетесь ли вы обычным пользователем, разработчиком или системным администратором, вы можете создавать и запускать виртуальные машины Ubuntu с Multipass за считанные секунды в Linux.
Multipass – это утилита командной строки, разработанная командой Canonical для быстрого развертывания экземпляров Ubuntu на локальном компьютере.
Так как Multipass предоставляет вам новейшие экземпляры, вам не нужно тратить время на обновления при запуске!
Используя Multipass, вы можете запускать виртуальные машины Ubuntu и использовать их для тестирования вашего кода или приложения.
Вы можете запускать команды в виртуальных машинах непосредственно с локального хоста или входить в оболочку виртуальной машины и запускаться оттуда.
Также возможно монтировать каталог вашей хост-системы в экземпляры и обмениваться файлами и папками между хост-системой и виртуальными машинами.
Multipass поддерживает GNU / Linux, Mac OS и Windows.
Как установить Multipass на Linux
Multipass доступен в виде пакета Snap, поэтому его можно установить в любой операционной системе Linux, которая поддерживает Snapd.
Snap поставляется предварительно установленным во всех выпусках Ubuntu, начиная с версии 16.04 LTS, версий Ubuntu, Solus 3 и выше, ОС Zorin и т. д.
В других системах Linux вы можете установить Snapd, как описано в этой ссылке.
После установки Snapd установите Multipass с помощью команды:
После успешной установки Multipass вы увидите следующий вывод:
Как создавть и запускать виртуальные машины Ubuntu с Multipass на Linux
Запускать виртуальные машины Ubuntu с Multipass невероятно легко и просто.
Запустим виртуальную машину Ubuntu
Здесь itisgood-instance – это имя моей Ubuntu VM.
Вы можете называть виртуальные машины как хотите.
Приведенная выше команда загрузит свежий и минимальный экземпляр Ubuntu и запустит его автоматически.
Список виртуальных машин
Чтобы просмотреть список загруженных в данный момент виртуальных машин в вашей системе, выполните:
Источник
Primary instance
Multipass offers a quick Ubuntu instance with a simple multipass shell command, or a click on the Open Shell button in the GUI. This is achieved with a special primary instance that is automatically created when it does not exist and the user tries to start or shell into it.
When automatically created, the primary instance gets the same properties as if launch was used with no arguments, except for the name ( primary by default). In particular, this means that the instance is derived from the latest Ubuntu LTS image and configured with the default CPU, disk, and memory.
The instance can also be launched normally, like any other. This provides one way to fine-tune its properties (e.g. multipass launch —name primary —cpus 4 eoan ). Alternatively, another instance can be set as primary (see below).
There can be only one primary instance at any moment. If it exists, it is always listed first in the output of list and info .
Steering the primary instance
The primary instance can be controlled in a dedicated area in the GUI. Buttons to start, stop, and open a shell into it are available.
On the command line, it is used as the default when no instance name is specified in shell , start , stop , restart , and suspend . When issuing one of these commands with no positional arguments, the primary instance is targeted. Its name can still be given explicitly wherever an instance name is expected (e.g. multipass start primary ).
Automatic home mount
When launching the primary instance, whether implicitly or explicitly, Multipass automatically mounts the calling user’s home inside it, in the folder Home . As with any other mount, it can be unmounted with multipass umount . For instance, multipass umount primary will unmount all mounts made by Multipass inside primary , including the auto-mounted Home .
Changing the primary instance
The primary instance is identified as such by its name. The name that designates an instance as the primary one is determined by a configuration entry with the key client.primary-name . In other words, while primary is the default name of the primary instance, it can be changed with multipass set client.primary-name= .
This setting allows transferring primary status among instances. The primary name can be configured independently of whether instances with the old and new names exist. If they do, they lose and gain primary status accordingly.
This provides a means of (de)selecting an existing instance as primary. For example, after multipass set client.primary-name=chopin , the primary instance would be called chopin . A subsequent multipass start would start chopin if it existed, and launch it otherwise.
Here is a little demo of how Multipass handles the primary instance:
Источник
Working with Multipass instances
This page is a quick primer on how to use Multipass.
Launching your first instance
After having installed it, the multipass command line utility is your main entry point.
The launch command creates a new Ubuntu instance using the default, at this point in time, image. It’s most likely going to be the latest cloud image of the newest Ubuntu LTS (Long Term Support) release. You can also choose another image, use find to see what’s available.
It will use a catchy name for you, but you can use the —name option to give it a name of your own. As is usual, you can pass —help to see all the available options.
Executing commands
There are a couple ways you can access the instance: exec and shell (or sh for short), which will execute the given command directly, or open a shell inside the instance, respectively:
Note the — passed to the exec command — use it to separate the options passed to multipass from those passed to the command being executed.
From there you can work inside your instance as with any other Ubuntu installation. To install software, use snap or apt , both are available.
Getting more information
To get some information about your instances, you can list them ( ls for short):
Or you can ask for an extended status report:
Sharing data with the instance
The recommended way to share data between your host and the instance is the mount command:
From this point on /home/ubuntu will be available inside the instance. Use umount to unmount it again and you can change the target by passing it after the instance name:
You can also use transfer to just copy files around — prefix the path with : if it’s inside an instance:
Deleting the instance
When you’re done with it, you can delete the instance:
You will see in list that it’s actually just marked for deletion (or to put it in other words, put in the Recycle bin):
You can then recover it, or purge to remove all deleted instances completely:
And more…
See our Command-line reference for a complete listing of the available commands and their options.
Источник
Multipass linux ��� ���
What is Multipass?
Multipass is a lightweight VM manager for Linux, Windows and macOS. It’s designed for developers who want a fresh Ubuntu environment with a single command. It uses KVM on Linux, Hyper-V on Windows and HyperKit on macOS to run the VM with minimal overhead. It can also use VirtualBox on Windows and macOS. Multipass will fetch images for you and keep them up to date.
Since it supports metadata for cloud-init, you can simulate a small cloud deployment on your laptop or workstation.
On Linux it’s available as a snap:
For macOS, you can download the installers from GitHub or use Homebrew:
On Windows, download the installer from GitHub.
Find available images
Launch a fresh instance of the current Ubuntu LTS
Check out the running instances
Learn more about the VM instance you just launched
Connect to a running instance
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
Stop an instance to save resources
Delete the instance
It will now show up as deleted:
And when you want to completely get rid of it:
Here’s a set of steps to build and run your own build of Multipass:
Running Multipass daemon and client
First, install multipass’s runtime dependencies. On amd64 architecture, you can achieve that with:
Then run multipass’s daemon:
Copy the desktop file multipass clients expect to find in your home:
Источник
Ubuntu VMs on demand for any workstation
Get an instant Ubuntu VM with a single command. Multipass can launch and run virtual machines and configure them with cloud-init like a public cloud. Prototype your cloud launches locally for free.
Select OS to get started
Install Multipass on Linux
Don’t have the snap command? Get set up for snaps
How to launch LTS instances
The first five minutes with Multipass let you know how easy it is to have a lightweight cloud handy. Let’s launch a few LTS instances, list them, exec a command, use cloud-init and clean up old instances to start.
Launch an instance (by default you get the current Ubuntu LTS)
Run commands in that instance, try running bash (logout or ctrl-d to quit)
Pass a cloud-init metadata file to an instance on launch. See using cloud-init with multipass for more details
See your instances
Stop and start instances
Clean up what you don’t need
Find alternate images to launch with multipass
Now don’t forget you still have ‘foo’ running. To learn more about Multipass keep reading, go to the docs, or join the discussion and get involved.
Install Multipass on Windows
Note: You need Windows 10 Pro/Enterprise/Education v 1803 or later, or any Windows 10 with VirtualBox
Make sure your network is private or Windows prevents Multipass from starting.
Run the installer. You need to allow the installer to gain Administrator privileges.
How to launch LTS instances
The first five minutes with Multipass let you know how easy it is to have a lightweight cloud handy. Let’s launch a few LTS instances, list them, exec a command, use cloud-init and clean up old instances to start.
Launch an instance (by default you get the current Ubuntu LTS)
Run commands in that instance, try running bash (logout or ctrl-d to quit)
Pass a cloud-init metadata file to an instance on launch. See using cloud-init with multipass for more details
See your instances
Stop and start instances
Clean up what you don’t need
Find alternate images to launch with multipass
Now don’t forget you still have ‘foo’ running. To learn more about Multipass keep reading, go to the docs, or join the discussion and get involved.
Install Multipass on MacOS
Run the installer in an account with Administrator privileges.
If you’d like to use Multipass with VirtualBox use this terminal command:
How to launch LTS instances
The first five minutes with Multipass let you know how easy it is to have a lightweight cloud handy. Let’s launch a few LTS instances, list them, exec a command, use cloud-init and clean up old instances to start.
Launch an instance (by default you get the current Ubuntu LTS)
Run commands in that instance, try running bash (logout or ctrl-d to quit)
Pass a cloud-init metadata file to an instance on launch. See using cloud-init with multipass for more details
See your instances
Stop and start instances
Clean up what you don’t need
Find alternate images to launch with multipass
Now don’t forget you still have ‘foo’ running. To learn more about Multipass keep reading, go to the docs, or join the discussion and get involved.
The ”Ubuntu Server CLI cheat sheet“ is your fast path to learning the Linux command line — from basic file management to deploying Kubernetes and OpenStack.
Get Ubuntu Server pro tips
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.
Cloud-style VMs on-demand
Spin up cloud instances with a single command
Launch instances of Ubuntu and initialise them with cloud-init metadata like AWS, Azure, Google, IBM and Oracle clouds. Simulate your own cloud deployment on your workstation.
VMs for Windows, macOS and Linux
Start Ubuntu VMs with each platform’s native hypervisor
Multipass uses Hyper-V on Windows, HyperKit on macOS and KVM on Linux for minimal overhead and the fastest possible start time.
Optimised VM performance
VMs tuned for out-of-the-box performance
Multipass VMs use images tuned for cloud usage. Software baked in with all the tools to deploy a cloud.
Most notably cloud-init, a tool with utilities to initialise cloud instances. Pass multipass a custom cloud-init definition and turn a generic Ubuntu image into a custom-configured server in seconds.
Designed for developer convenience
VMs you can trust with access to what you need
Share files and folders between your host and your instances.
Your ‘primary’ instance gets special treatment with integration to your native filesystem and dedicated hot-key access.
Multipass automatically fetches the latest Ubuntu images from Canonical, minimising initial update time.
A curated catalogue of images
Images with apps built-in one command away
Multipass is growing a catalogue of images to initialise pre-installed applications to get started with a single command.
Appliances in VMs
Ubuntu Appliance images to try before you Pi
Run a Virtual Ubuntu Appliance on your workstation without affecting your existing system. No need for spare hardware, just follow the steps and you’ll be up and running in minutes.
Join our community
Multipass is built by a team of engineers at Canonical and a community of contributors. We appreciate your interest in Multipass, and if you want to join the discussion or contribute, come and say hi. We don’t bite.
Источник