Wayan Jimmy's Brain

Multipass

related
Linux
links
Working with multipass Multipass, Virtualbox, Bridged networking Mindmap

Mindmap

See the mindmap in mindomo

What?

Single command, almost no config

Easy to install

Configurable with cloud-init

For prototyping cloud instances locally

Why?

Make your development environment as similar as the production one

Safe place to make mistakes

Isolated development environment

Already familiar with Ubuntu Linux

It’s fun :D, at least for me to learn about VM and container

How?

Launch a vm

Start a vm as easy as

multipass launch <vm_name>

You can also alocate some cpu -c, disk -d and the memory -m

multipass launch -c 2 -d 30G -m 2G --name devbox "21.04"

The commmand above will create a vm with 2 cpu, 30G of storage disk and 2G of memory, name devbox and ubuntu image 21.04

List all vms

multipass list

Stop a vm

multipass stop devbox

Start a vm

multipass start devbox

SSH-ing into the vm

multipass shell devbox

What if you want to use the ordinary ssh command tu ssh to the vm?

yes, could use cloud-init for that, I put the step by step here

Share volume between host and vm

Yes. you can share file easily between host and vm, I use this for example restoring a MySQL database to a vm

multipass mount <path_on_host> <vm_name>:<destination_path_inside_vm>

Example

multipass mount . devbox:~/codes

The command above will share all files inside current directory on host to the ~/codes directory inside the devbox vm.

Troubleshoot

When this message occur “A stop job is running for Snap daemon on Ubuntu…” try this method for temporary solution https://jaylinwu.wordpress.com/2020/12/06/a-stop-job-is-running-for-snap-daemon-on-ubuntu-soulution-and-thinking/

What next?

Installing some apps such as MySQL, Elasticsearch, Docker, could be take a lot of time if you do it over and over again with several vms, so Ansible come to the rescue, this is an example of my personal ansible playbook, and will add more later.