E Amazings
  • Home
  • Automotive
  • Business
  • CBD
  • Crypto
  • Education
  • Entertainment
  • Fashion
  • Finance
  • Health
  • Home Improvement
  • Law \ Legal
  • News
  • Shopping
  • Sports
  • Technology
  • Travel
  • Need Help?

Subscribe to Updates

Get the latest creative news from FooBar about art, design and business.

What's Hot

What Closing Costs Do Home Buyers Have?

February 25, 2023

What Is Realtek HD Audio Manager

February 2, 2023

A Basic Guide To Cell Tower Leasing

February 2, 2023
Facebook Twitter Instagram
E Amazings
  • Home
  • Automotive
  • Business
  • CBD
  • Crypto
  • Education
  • Entertainment
  • Fashion
  • Finance
  • Health
  • Home Improvement
  • Law \ Legal
  • News
  • Shopping
  • Sports
  • Technology
  • Travel
  • Need Help?
Facebook Twitter Instagram
E Amazings
You are at:Home»Technology»Linux Fu: Easy VMs | Hackaday
Technology

Linux Fu: Easy VMs | Hackaday

By November 1, 2022No Comments4 Mins Read
Facebook Twitter Pinterest LinkedIn Tumblr Email
Share
Facebook Twitter Pinterest WhatsApp Email

[ad_1]

It wasn’t long ago that we looked at easily creating Docker containers from the command line so you could just easily spin up a virtual environment for development. Wouldn’t it be nice if you could do the same for virtual machines? You can. Using Multipass from Canonical, the makers of Ubuntu, you can easily spin up virtual machines under Linux, Mac, or Windows. Granted, most of the virtual machines in question are variations of Ubuntu, but there are some additional images available, and you can create your own.

Once you have it installed, starting up a new Ubuntu instance is trivial. If you have a set configuration, you can even set up predefined setups using a YAML file.

Installation

The process varies by platform, but on Ubuntu, installing Multipass is as easy as:

sudo snap install multipass

You should be sure that you are on a computer that can support virtual machines. The /proc/cpuinfo file should have a vmx or svm flag (actually, several of them; one for each core).

Catalog

You can see all the images available by running:

multipass find

Naturally, most of the images are Ubuntu versions, although there are a few other appliances like anbox and nextcloud available.

Suppose you want to do some testing in a Ubuntu bionic (18.04) instance. You can launch a default instance by issuing the command:

multipass launch bionic

However, you usually want a little more control since the default is one CPU core, a gigabyte of RAM, and 5G of disk storage. Say you want 4 CPUs, 6G of RAM, and a 10G disk. You can also provide a name for the virtual machine:

multipass launch -c 4 -m 6G -d 10G -n hackaday-vm bionic

On the Run

Once you have a bunch of virtual machines, you might want to see how they are doing:

multipass list

You can control them with start and stop. You can also delete a machine.

multipass stop hackaday-vm
multipass start hackday-vm
multipass stop hackaday-vm
multipass delete hackaday-vm

Access

So what do you do with it? By default, the machine starts up with a private network that you can only access from the host machine. There are ways to route traffic around if you need to do that.

However, many times you just want a shell into the new machine. That’s easy:

multipass shell hackaday-vm

If you want to share data, you can mount a host folder into the virtual machine:

multipass mount ~/hackaday hackaday-vm

If you lose track of everything, you can ask about a particular machine:

multipass info hackaday-vm

Name:           hackaday-vm 
State:          Running 
IPv4:           10.134.147.131 
Release:        Ubuntu 18.04.6 LTS 
Image hash:     5269cad5bc26 (Ubuntu 18.04 LTS) 
Load:           0.78 0.41 0.16 
Disk usage:     1.2G out of 9.5G 
Memory usage:   143.2M out of 5.8G 
Mounts:         /home/alw/hackaday => /home/alw/hackaday 
                   UID map: 0:default 
                   GID map: 0:default


It really is that simple. There are other commands available to run programs in a machine or set up networking. There’s also a GUI that sits in your system tray, but if you aren’t running virtual machines as your own user, that isn’t as useful to you.

Configuration

If you have things you always have to set up, you can automate that. You create a yaml file (known as a cloud init file) and set things up like users, packages, ssh keys, and the like. Note that the standard allows for several formats, but apparently Multipass only supports YAML.

The other thing you can do is use Packer to package a new image of your own. That’s a bit involved, but you can read the documentation to find out how.

Have you ever set up a development environment and then a few years later found out it was all broken because of updates? With virtual machines that never has to happen again. You can archive entire environments. This can be important in production environments when you need to go back to the exact way code was built to resolve a problem. It is also extremely important for safety-critical software where you sometimes have a requirement to be able to produce the exact same executable and prove that you can do it. Virtual machines make that much easier and Multipass is an easy way to create and use at least some kinds of virtual machines. The fact that it runs on multiple platforms itself is also a great feature.

[ad_2]

Source link

Related Posts

What Is Realtek HD Audio Manager

By Corbin BowenFebruary 2, 2023

A Basic Guide To Cell Tower Leasing

By Corbin BowenFebruary 2, 2023

The Flight Of The Dremel

By January 5, 2023

A White-Light Laser, On The Cheap

By January 5, 2023
Add A Comment

Comments are closed.

Our Picks

What Closing Costs Do Home Buyers Have?

By Corbin BowenFebruary 25, 2023

What Is Realtek HD Audio Manager

By Corbin BowenFebruary 2, 2023

A Basic Guide To Cell Tower Leasing

By Corbin BowenFebruary 2, 2023
Recent Posts
  • What Closing Costs Do Home Buyers Have? February 25, 2023
  • What Is Realtek HD Audio Manager February 2, 2023
  • A Basic Guide To Cell Tower Leasing February 2, 2023
  • Air Duct Repair 101: Everything You Need To Know February 2, 2023
  • Rashid Khan: A Nightmare For Every Batsmen January 18, 2023
  • Advantage LIC? How Budget Insurance Amendment Bill may benefit the PSU insurance giant January 5, 2023
  • The Flight Of The Dremel January 5, 2023
Archives
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • September 2021
Facebook Twitter Instagram Pinterest TikTok
© 2022 E Amazings - All Rights Reserved.

Type above and press Enter to search. Press Esc to cancel.