1. Home
  2. VPS
  3. 5 Reasons to Use a VM for Development - Dice Insights

5 Reasons to Use a VM for Development - Dice Insights

Rsdaa 04/02/2022 222

I started using virtual machines (VMs) onmy development PC about six years ago; I was keen to learn Linux, having been aWindows developer since the mid-1990s. At first, I used an old Windows PC andinstalled a Linux distro on it; but I quickly found out that the distro took upa lot of space, and I needed a KVM switch to manage two different PCs. It wasall a bit “fiddly,” which is why I began exploring the potential of VMs.

Discovering VirtualBox was a godsend, and madethings a lot more convenient. Despite all the flak Oracle gets over itsdatabases, MySQL, and Java, Virtual Box remains an excellent and free open-sourcepackage.

After a couple of years, I discovered the joysof Hyper-V.It comes as part of Windows Pro; you just need to enable it in Windows features,and meanwhile you can’t run VirtualBox because Hyper-V uses VT-x, the Intelvirtualization technology on x86 and x64 CPUs. Hyper-V is a native hypervisorthat can create virtual machines on X86-64, and is generally a bit faster atlaunching than VirtualBox.

There’s also VMware Workstation, which is meantfor commercial use and can run VMs. All three (VirtualBox, Hyper-V and VMWare)provide broadly similar capabilities: You can set up a VM and install Windows,Linux or even a Hackintosh. The VM typically uses a couple dozen GBs of diskspace, along with a few GBs of RAM.

Note the terms “Host PC” and “Guest OS.” While“Host PC” means the computer you are running Hyper-V (or its equivalent) on, “GuestOS” is the OS installed in a particular VM.

So why would you use a VM for development? Here are a few reasons I’ve found over the years.

Build a Library of Different Operating Systems

If you’re writing cross-platform software, or you want to test an app on, say, Windows 7, Windows 10, Linux, and maybe on 32-bit as well as 64-bit (whatever you desire, in other words), this is where VMs are really handy. You can create a number of test environments, each with a unique VM. It’s like having a bank of PCs, configured for the different operating systems: Just boot up a test environment, install your software and run tests (all you need is lots of disk space to store all the different VMs).

You can back up VMs, so you might have acopy of a particular OS for each version of your software. I generally reckon about30GB of disk storage is needed for one VM.

Run a Web Server or Other Software

No need for a separate networked web serverwhen you can set up a LAMP system in a VM. You can use something such as UbuntuServer or the full desktop version. But keep in mind how you communicatebetween Host and Guest: I prefer to use SSH and WinSCP to copy files. Otherutilities such as FileZilla and even Dreamweaver can also use SSH.

The alternative is using Samba and settingup shared folders. If you prefer to use Subversion to Git for version control, thenyou can set up a Subversion server on the Guest OS.

Keep Development Software in a VM

For about twelve years, I maintained aDelphi application I had written in 2002. During that time, I changed mydevelopment PC four times. Each time I had to dig out my Delphi install media,install Delphi and the source code for the Delphi components, and recompile andreinstall a dozen components before I could build the software.

It took two to three hours each time andwas a bit of a hassle, so I moved everything into a Windows VM and installedonce. Now I do any bug fixing and recompiles in that VM. It’s the lazy buthassle-free approach!

Keeping older development software in a VMalso avoids problems when you upgrade the host OS and need new versions.

Raspberry-Pi Development

If you’ve developed anything for RaspberryPi, you need it networked to give you full access.I use a Distro on it called DietPi; it’s a slimmed-down version of Debian 9.

Rather than fiddle with the version on thePi, I installed Diet Pi in a VM and use that for development and testing. It’sno good for performance testing, since the VM runs a bit faster than myRaspberry-PI B+, but for general testing, it is easier and faster. With DietPi, there are five versions to download for PC (two native and one each forVMware, VirtualBox and Hyper-V), which is pretty grand!

Without a VM, installing software on aRaspberry-Pi means putting it on a SD card, which takes several minutes toburn.

Learn another OS and/or Programming Language

Occasionally I write about Python, andhaving a clean Ubuntu desktop in a VM means I can make a copy of the VM, run it,and then install any modules I need for testing without worrying about havingto clean up afterwards. VMs make it trivial to install other programming languagesand try them out without worrying about cluttering up your main PC.

Conclusion

With Windows and Hackintoshes running inVMs, keep potential licensing issues in mind. I doubt if Apple approves ofHackintoshes; with Windows, I’ve bought a second Windows 10 Pro licence for theVM and authenticated it. Thispage lists all the various OS versions that you can run in Hyper-V onWindows 10.

Note that, as Windows Subsystem for Linux(WSL) becomes more popular, you can do some of the Linux stuff I’ve mentionedusing it (and it takes up only a GB of RAM, way less than VirtualBox or Hyper-V).

But WSL restricts you to having just oneOS; of course, it’s Linux-only, and limited to the distros in the Windows Store(There are currently 12, are all free except for the last four in the list).WSL won’t replace Hyper-V, but it can prove handy for some uses.

Microsoft suggests that you can run VMsunder Hyper-V with as little as 4 GB RAM, though I’d recommend 8GB (or betterstill, 16 GB). I have 64 GB RAM on my PC, and the most RAM I’ve ever had in useat once was 29 GB. In other words, no matter what your setup, chances are goodthat you’ll be able to experiment with VMs.


PREV: What is a Proxy Server Ps4 | PS4 Proxy Configuration

NEXT: Guide to Assigning Proxy Server for PS4 | Blog | Limeproxies

Popular Articles

Hot Articles
Back to Top