Multipass – Starting and Running Ubuntu Virtual Stations on Linux

Posted on the 15 May 2023 by Top10

Multipass is a cross-platform, lightweight Ubuntu virtual machine manager (VIM) that runs on Linux, Windows, and macOS. It creates cloud-style Ubuntu virtual machines, allowing developers to quickly create a new Ubuntu environment with a single command.

Designed as a development tool, Multipass provides some key benefits:

  • Creating a local development and testing environment can be time consuming, but Multipass simplifies the process by automating all installation and removal.
  • Developers can use Multipass to create fresh, customized Linux development environments on any machine and to prototype cloud installations.
  • Multipass is the fastest way for Mac and Windows users to get the Ubuntu Command Prompt on their PC.
  • New Ubuntu users can use Multipass as a sandbox to experiment with new features without messing up their main machine or having to dual-boot.
  • It is important to highlight that Multipass runs a low overhead virtual machine using KVM on Linux, Hyper-V on Windows, and HyperKit on macOS. VirtualBox can also be used on Windows and macOS. Multipass will automatically fetch and update images for you.

In addition, Multipass has a growing library of images that allow you to run custom-built VMs or VMs that you set up yourself using a robust cloud-based launch interface.

This guide shows you how to install and use Multipass on a Linux operating system.

Installing Multipass on Linux

Multipass is available as a snap package, making it easy to install on the most popular Linux distributions that support snap.

To install Multipass on your computer, you need to have Snap installed on your system, if not, use the correct set of commands for your Linux distribution.

Installing Multipass on Ubuntu

$ sudo apt update
$ sudo apt install snapd
$ sudo snap install multipass

Installing Multipass on Linux Mint

$ sudo rm /etc/apt/preferences.d/nosnap.pref
$ sudo apt update
$ sudo apt install snapd
$ sudo snap install multipass

Installing Multipass on Debian

$ sudo apt update 
$ sudo apt install snapd 
$ sudo snap install core
$ sudo snap install multipass

Installing Multipass on Fedora

$ sudo dnf install snapd
$ sudo ln -s /var/lib/snapd/snap /snap
$ sudo snap install multipass

Install Multipass on RHEL

$ sudo dnf install  [RHEL 9]
$ sudo dnf install  [RHEL 8]
$ sudo dnf install  [RHEL 7]
$ sudo dnf upgrade
$ sudo subscription-manager repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms"
$ sudo yum update
$ sudo yum install snapd
$ sudo systemctl enable --now snapd.socket
$ sudo ln -s /var/lib/snapd/snap /snap
$ sudo snap install multipass

Install Multipass on openSUSE

$ sudo zypper addrepo --refresh  snappy
$ sudo zypper --gpg-auto-import-keys refresh
$ sudo zypper dup --from snappy
$ sudo zypper install snapd
$ sudo systemctl enable --now snapd
$ sudo snap install multipass

Installing Multipass on Arch Linux

$ git clone 
$ cd snapd
$ makepkg -si
$ sudo systemctl enable --now snapd.socket
$ sudo ln -s /var/lib/snapd/snap /snap
$ sudo snap install multipass

Once multipass is installed on your machine, you can use it to run Ubuntu instances locally from the command line, as described in the following sections.

Finding Available Ubuntu Images

Run the following multipass command to see a list of available multipass images that you can download and instantiate from:

$ multipass find

Download the Ubuntu image

Once you have determined which Multipass image to use, use the launch command to download, create, and launch a local Ubuntu instance.

This example shows how to use the Ubuntu 22.04 image:

$ multipass launch 22.04

Note: Multipass will not work if another virtual machine is running, such as VirtualBox. The following error message will appear.

launch failed: Another virtual machine manager is currently running. Please shut it down before starting a Multipass instance.

Shut down the other virtual machine to continue. Then try starting Multipass again.

If the run command was successful, the Ubuntu image was booted, and a local Ubuntu instance was created and started, the instance should have a name randomly generated by Multipass. As shown in the screenshot, in this case the instance name is validating-goat.

By default, a new instance starts with 1 processor, 1 GB of RAM, and 5 GB of disk space.

List of all available instances

The multipass list command lists all created local instances and some of their properties:

$ multipass list

You can use the info command to display information about the instance, such as its status, IP address, release, image hash, number of CPU(s), load, disk usage, memory usage, and mount, as shown in the following screenshot:

$ multipass info validating-goat

Opening a shell in an Ubuntu instance

To start a shell on a running instance (e.g. validating-goat), use the shell command:

$ multipass shell validating-goat

Once a shell has been launched on a running instance, you can execute normal commands on it. For example, you can update the apt package index as shown in the figure.

$ sudo apt update

Starting or stopping instances

To stop or start an instance, use these commands respectively:

$ multipass stop validating-goat
$ multipass start validating-goat

Deleting a local instance

To delete a local instance, whether it is running or stopped, use the delete command, as shown in the figure.

$ multipass list
$ multipass delete exalted-meerkat

Launching an Instance with Custom Settings

You can also launch an instance with custom parameters (such as name, number of CPU(s), RAM size, and disk size, as shown in the figure).

$ multipass launch 22.04 --name tecmint-test --memory 1G --disk 10G --cpus 2
$ multipass info tecmint-test

Starting a Web Server on Your Ubuntu Instance

Let's take a look at how to use your local Ubuntu instance. This example shows how to install and run a basic NGINX web server, as shown in the figure:

$ multipass shell tecmint-test
$ sudo apt update
$ sudo apt install nginx

After installing NGINX, the service should be started automatically (this is a known behavior on Ubuntu and its derivatives). Use the following systemctl command to make sure it's up and running:

$ systemctl status nginx

Now use the IP address of your running instance (which you can get from the list of local instances) to make a request to NGINX and view the standard welcome web page, as shown in the following screenshot.

Removing Multipass on Linux

To remove Multipass from your computer, run the following command:

$ sudo snap remove multipass

For more information about Multipass command line options, run the following command:

$ multipass -h

You have successfully installed Multipass and learned how to use it to quickly, efficiently and reliably launch and manage Ubuntu instances on your computer.

2809900cookie-checkMultipass - Starting and Running Ubuntu Virtual Stations on Linuxno

Similar

Инструкции,Программы,linux,Multipass,ubuntu
#Multipass #Starting #Running #Ubuntu #Virtual #Stations #Linux