Virtual computers

Post Reply
User avatar
spot
Posts: 41336
Joined: Tue Apr 19, 2005 5:19 pm
Location: Brigstowe

Virtual computers

Post by spot »

I'm impressed at the capability of a personal laptop or desktop to run not just the operating system installed on it, but to host additional virtual computers on the same hardware at the same time. The process has become very usable.

The host is the physical computer. It has memory and disk space and an operating system which starts when you power on the machine. The start-up installation might be a Microsoft operating system, or a linux or BSD distribution. Any of those is capable of giving some of its memory and disk space, and use of the real keyboard and mouse and monitor, to as many virtual guest computers as will fit. They can be turned on and off just like a real computer and each behaves, while it has the resources, just like a real machine.

Each guest system takes up some disk space. While it is running it also takes up some memory. If you don't have enough spare disk space or spare memory then you can't do this. At a practical minimum you'd need at least 1GB of spare unused memory and 3GB of unused spare disk space for the simplest virtual computer - that's a very small machine with no GUI, or it's a very old operating system like Windows 98 or DOS. For a modern system like a linux or BSD with a GUI like xfce or KDE you'd need at least 3GB of spare unused memory and 30GB of spare disk space. For a virtual Windows 10 computer that could be 6GB of spare unused memory and 60GB of spare disk space because Windows 10 is just large, it's a parody of hugeness.

So you're not going to get far if your machine only has 4GB of memory. My laptop has 16GB installed, and 500GB of unused disk space. If you have that much memory then you definitely have enough processing power too.
Nullius in verba ... ☎||||||||||| ... To Fate I sue, of other means bereft, the only refuge for the wretched left.
When flower power came along I stood for Human Rights, marched around for peace and freedom, had some nooky every night - we took it serious.
Who has a spare two minutes to play in this month's FG Trivia game! ... My other OS is Slackware.
User avatar
Betty Boop
Posts: 16934
Joined: Sun Mar 27, 2005 1:17 pm
Location: The end of the World

Re: Virtual computers

Post by Betty Boop »

May I ask why?

Why would I want a virtual computer inside my computer?
User avatar
spot
Posts: 41336
Joined: Tue Apr 19, 2005 5:19 pm
Location: Brigstowe

Re: Virtual computers

Post by spot »

If you have one computer, and you want to run a different operating system as well as the installed one you use all the time, you could buy a second computer. But if you have enough spare memory and spare disk space, you can save the cost of that second physical computer by running new virtual computers on the one you already own, without losing the currently installed system you use all the time.

You might want to do it to learn the new operating system, or to run applications your installed operating system can't run, or for privacy. Your one computer can let you use Windows and linux and BSD and MacOS at the same time in different windows with a shared disk drive they can all see. You can cut and paste between all the different windows. Each virtual machine can be set up to do one particular job excellently, with a secure fence preventing your information from spreading to other applications.

Using virtual computers takes up a lot less desk space, it uses less power, it makes less noise and nobody will think you're a geek for having several keyboards and screens in front of you.

But how do I do this thing, I hear you ask. It is a simple matter which I shall now address.
Nullius in verba ... ☎||||||||||| ... To Fate I sue, of other means bereft, the only refuge for the wretched left.
When flower power came along I stood for Human Rights, marched around for peace and freedom, had some nooky every night - we took it serious.
Who has a spare two minutes to play in this month's FG Trivia game! ... My other OS is Slackware.
User avatar
spot
Posts: 41336
Joined: Tue Apr 19, 2005 5:19 pm
Location: Brigstowe

Re: Virtual computers

Post by spot »

A little new vocabulary. Your host computer is the physical machine you type on. You can install guest computers on it. These are virtual, they have no physical existence, they are files on your physical disk which look like entire drives to the virtual machines which run on them.

Your host might be an Apple computer or it might have an Intel or an Arm processor, and it might already run MacOS or Microsoft Windows or Linux. The guest computers can each look like any of those things, they can seem to have Intel or Arm processors which don't exist on the physical computer and they can have operating systems installed which aren't installed outside of the virtual machine. That's a lot of flexibility.

Here's a recipe for running a 4-core 4GB FreeBSD virtual machine from a computer with Linux installed:

Code: Select all

qemu-system-x86_64 -m 4G -smp 4 -net nic -net user,hostfwd=tcp:127.0.0.1:2225-:22 FreeBSD-13.0-RELEASE-amd64.qcow2 --enable-kvm
The virtual computer was downloaded from http://ftp.at.freebsd.org/pub/FreeBSD/r ... 64/Latest/ and didn't need installing at all, it just opens when you start it with qemu. You could run qemu on a Windows 10 computer to provide the same guest system, or any other installable operating system.

And this would let you install and run a 4-core 6GB slackware linux on an Ubuntu host:

Code: Select all

qemu-img create -f qcow2 s.qcow2 40G
wget https://mirrors.slackware.com/slackware/slackware-iso/slackware64-15.0-iso/slackware64-15.0-install-dvd.iso
qemu-system-x86_64 -hda s.qcow2 -cdrom slackware64-15.0-install-dvd.iso -m 6G -smp 4 -net nic -net user,hostfwd=tcp:127.0.0.1:2222-:22 --enable-kvm
And you could, of course, run them both side by side.

Here's a picture I took earlier. Slackware host, three guest systems running Freebsd, Slackware and Debian.

vms.png
vms.png (160.47 KiB) Viewed 274 times
Nullius in verba ... ☎||||||||||| ... To Fate I sue, of other means bereft, the only refuge for the wretched left.
When flower power came along I stood for Human Rights, marched around for peace and freedom, had some nooky every night - we took it serious.
Who has a spare two minutes to play in this month's FG Trivia game! ... My other OS is Slackware.
User avatar
spot
Posts: 41336
Joined: Tue Apr 19, 2005 5:19 pm
Location: Brigstowe

Re: Virtual computers

Post by spot »

Another example - this is a qemu instance of a linux desktop. It's an interesting one, it's a slick Chinese linux release called Deepin. You'll remember the Chinese government ordered that no Chinese public sector computer should be running any Microsoft product by the end of 2022 - I think it was a response to one of America's incessant trade embargoes, or sanctions against using specified Chinese electronic components in US hardware. Several approved Chinese linux distributions came out in consequence. Deepin is well-oiled.

vms1.png
vms1.png (966.47 KiB) Viewed 266 times
Nullius in verba ... ☎||||||||||| ... To Fate I sue, of other means bereft, the only refuge for the wretched left.
When flower power came along I stood for Human Rights, marched around for peace and freedom, had some nooky every night - we took it serious.
Who has a spare two minutes to play in this month's FG Trivia game! ... My other OS is Slackware.
User avatar
spot
Posts: 41336
Joined: Tue Apr 19, 2005 5:19 pm
Location: Brigstowe

Re: Virtual computers

Post by spot »

This photo shows more of what qemu can do. This is a Thinkpad running MacOS 10.15 Catalina. The red dot in System Preferences is an offer to upgrade to MacOS 12.2.1 Monterey but I resisted the temptation.


vm3.jpg
vm3.jpg (3.29 MiB) Viewed 261 times
Nullius in verba ... ☎||||||||||| ... To Fate I sue, of other means bereft, the only refuge for the wretched left.
When flower power came along I stood for Human Rights, marched around for peace and freedom, had some nooky every night - we took it serious.
Who has a spare two minutes to play in this month's FG Trivia game! ... My other OS is Slackware.
Post Reply

Return to “Computers Internet”