Boost Your Development Environment With Ubuntu Multipass
Ubuntu Multipass is used to quickly launch and manage Linux virtual machines on any workstation. It's available for Linux, macOS, and Windows. From a developer’s perspective, it is an interesting alternative to Docker or VirtualBox. For me, it feels easier and simpler to use.
Join the DZone community and get the full member experience.Join For Free
Ubuntu Multipass is part of the Ubuntu ecosystem, but it works fine on other platforms and operating systems. It can be found at https://multipass.run. I use it daily during my development work. It has become an indispensable tool for keeping my workstation clean. It helps with the testing and deployment of my software.
Flame Wars Disclaimer
This article is not about cloud, deployment strategies, Kubernetes, helm, swarms, AWS vs Azure and alike. It's about using virtual machines to help software developer and devops engineer with daily work.
How Does Multipass Work?
As simple as this:
# Create and launch new virtual machine named "backend" multipass launch --name backend # Check how it's doing multipass info backend # Run single command on the machine multipass exec backend -- systemctl restart apache # Launch interactive shell session with the machine multipass shell backend # List all instances multipass list # Reboot multipass restart backend # Dispose of the instance multipass delete backend
There are few more commands such as
mount for mounting directories or
transfer for copying files. Detailed documentation is available at https://multipass.run/docs.
What Can I Do With Multipass?
We agree that virtual machines and containers are the most useful tools in a developer's toolbelt. By installing third-party software on isolated environments we keep our workstations clean and healthy. By using clean environments for testing and deployments we're less vulnerable to "It Works on My Machine" syndrome.
We differ on how to best achieve this. We use Docker, VMWare, VirtualBox, cheap VPS, disposable instances in the cloud, and many other solutions.
Multipass virtual machines are fully functional Ubuntu LTS instances. Everything that can be done with the Ubuntu Linux server, can be done with Multipass instances. We can run software in isolation from your workstation. We can safely play with alternative versions. We can launch multiple micro-instances running automated integration tests. We can test deployment scripts locally, before running them on higher environments. Possibilities are endless.
What Are the Benefits of Multipass?
How does Multipass compare to Docker, from a developer's perspective? Your mileage might vary, but for me the following benefits are important:
Multipass Instance Runs Full Uncompromised Ubuntu LTS
Everything is ready out of the box, beginning with
curl. All my familiar Linux tools are either there or one
apt install away. I can start using the newly launched instance right away, using the concepts, tools, and commands I already know.
Here's why this is important. The developer's brain already runs at full capacity. Each time I need to learn another command, another precious childhood memory has to make room and goes down the drain, forever lost. I read that recently on The Oatmeal so it must be true ;-)
Multipass Instance Is Connected
Immediately after launching the instance can access LAN and WAN. It is open for connections, without additional configuration. There is no need to manually configure virtual networks or map ports.
Multipass Instance Is Persistent
Docker containers are disposable by design. Data shouldn't be kept on them. We use shared volumes instead. This comes with limitations. For crucial security reasons, Docker allows mounting volumes only once, when a container is created. But these otherwise important considerations aren't relevant to my development machine.
mount command for mounting host folders into the instance. This can be done at any time: before starting the instance but also while it is already running.
Additionally, the primary instance mounts my home folder as
~/Home by default, so I can access my files instantly.
Multipass Instance Management Is Easy
Command syntax and options are few and easy to memorize. With the ability to execute commands and transfer files, we can easily write scripts to fully automate software installation, integration tests, deployment tasks, etc.
There Is Even UI For That
After installing Multipass on my PopOS! Linux box I saw the following in the top bar:
I Want It, I Want It, Where Can I Get It?!
Multipass can be used on Linux, macOS, and Windows.
On Linux, Multipass is best installed with
snap. On Ubuntu-based distributions chances are
snap is already there, so simply run:
sudo snap install multipass
and Multipass is ready to go. Otherwise install
snap daemon first, using your package manager of choice.
To install it on other platforms download the proper installation package from https://multipass.run/.
Multipass instances might not start if another VM software is running, such as Oracle VirtualBox. Simply stop VirtualBox and try again.
This article is not promoting any of the described products, services, or vendors. We don't have any commercial interest nor associations with them. We're not trying to suggest that these products or services are best for you, nor promising that your experience will be the same.
Opinions expressed by DZone contributors are their own.