Home > Delphi, Linux, Object Pascal > Moving to Linux, Part 3, Virtualization

Moving to Linux, Part 3, Virtualization

September 27, 2014 Leave a comment Go to comments

I was going to look at backup services and how to build your own NAS and connect to it with freepascal (and more practical aspects of Linux) in this post, but due to the confusion regarding VMWare and how I work, I decided to dedicate this article to exactly that topic. apparently there are quite a few programmers out there who have little or no experience with VMWare or emulation at large – who quite frankly did not understand what I meant.

I do all my work in VMWare machines

I do all my work in VMWare machines

First, to clear up any misunderstanding regarding “saving” money by moving to Linux. I was asked about this on my Delphi Developers Facebook group (if you havent joined it, then check it out – its probably the most active place online for Delphi developers). Well, it goes like this:

If you want to follow the law then you actually need A license for each operative system you run inside your virtual machines. So if you have Windows XP installed inside a virtual machine, that means you must buy a Windows XP license. The same goes for Windows Vista, Windows 7 and naturally Windows 8. From what I know you can clone as many instances of these as you wish, but you must own a license for each operative system.

Presently I have the following operative systems:

  • Windows XP
  • Windows Vista
  • Windows 7
  • Windows 8

That is in sub total 4 licenses that I have bought and own, meaning that I have the right to install them anywhere I wish.

Cloning

To clone a virtual machine means that you create a duplicate of a the installation disk using the same virtual hardware. When you run such a clone, the running version is called “an instance” in the world of virtualization.

A clone is a duplicate of a machine

A clone is a duplicate of a machine

So why do we clone virtual machines? Well it bakes down to configurations. You start by installing Windows into a virtual machine, at this point it’s completely fresh and without any software at all. Think of it as a base-class. I tend to clone from that point and then add software into the clone. Why? Because if something goes wrong with the clone, I can simply delete it and go back to the fresh. clean installation.

Snapshots

Another aspect of virtual machines is something called a “snapshot”. A snapshot simply makes a clone of your virtual machine state (as opposed to the whole shabam) as it is right now, and should you install more software into a snapshot or state – the virtual machine and other snapshots remains unaffected. You can later revert to that snapshot. The other machine state with the error can be deleted with a single click.

Snapshot delta disks

Snapshot delta disks

It’s actually the exact same thing as a Delphi class actually. You create X instances of a Delphi class, and the object you get is called (drumroll) an instance. So it’s the same old thing but on a grander scale.

Snapshots are extremely flexible and effective. You can create as many snapshots as you like, building up a whole tree-view of different machine states. It’s quite common to make snapshots before you install anything at all. So a lot of developers have 10-20 snapshots of their developer machine, allowing them to revert back to a previous state at any given time. Also, you can go back to a previous snapshot, almost like time travel, without anything happening to the state you left the machine. And should you add changes to a previous snapshot – that is isolated there and only there. Like a branch on a tree.

The snapshot layout in VMWare is easy to use

The snapshot layout in VMWare is easy to use

It is, for instance, common to Install a version of Delphi, then revert back to the root snapshot (remember, the Delphi snapshot is not deleted), then install another version of Delphi, and so on — In effect, your virtual machine will contain every Delphi version you own, isolated in their own reality and with absolutely no knowledge of each other. You simply jump to the snapshot with the version you need to work on and that’s it.

Virtualization is not just clever, it’s bloody awesome!

Cloud services

A lot of developers still havent got the message about cloud computing. The fact is, you don’t just upload html files and rent a database anymore — you upload a complete developer environment (!). Yes you read right, you upload a complete virtual machine, software and all, including whatever applications you want to run (server, webpage written in intraweb, mysql — install whatever you want to run in the cloud) to a cloud computer. And the cloud service provider will run X number of instances on their supercomputers for you. If you need to scale and have 10 instances active at the same time, that can be done in the admin console with a single click (watch you visa card here, you may burn yourself really bad if you do it wrong).

It's not your daddy's Windows anymore

It’s not your daddy’s Windows anymore

So if you got the cash to do so, you can actually upload your VMWare clones and execute them in the cloud. You would log into your Windows instances using a normal terminal-server interface, and have your entire Delphi programming career online 24/7.

It may take some time to fully grasp the potential and delicacies of this.

Programming on VMWare

The VMWare desktop program (as opposed to the server, cloud based engine) is a piece of magic. Like mentioned in the beginning of this post, it allows you to create as many virtual machines as you like, and then install whatever operative system you desire into them. You can also clone machines, either in full or extended clones (only differences are stored) – and you can also do snapshots.

Do your work in a virtual machine

Do your work in a virtual machine

As you can probably imagine, moving all your Delphi installations into virtual machines opens up a whole world of benefits. First of all you dont have to carry a huge machine with you – because naturally you keep your virtual machines on en external USB drive (remember to back this up often!). All you really need is the virtual machine “player”, the VMWare program that executes your virtual machines, allowing you to do your work.

Testing also becomes easier with VMWare, because even if you don’t have a Windows XP box, you can still use it via a virtual machine. You just take a snapshot, install your software, test it, then revert back to the snapshot. Voila, whatever changes you made to the virtual machine is deleted and gone! And Windows XP is pristine clean like ever before.

Saving money

This was a topic people asked about quite a lot. How could I propose to save money by moving to Linux. Well that’s quite easy! In the beginning of this post I explained that you need to buy and own a license of each version of Windows you create virtual machines from. That is fair to do since Microsoft is the company making our programming lives possible – and i think it’s fair to actually buy the software you use. And by law you actually have to own Windows to use it, so there is no point running cracks in my view.

But what about the real computers that we run our virtual machines on? In my case I have a Macbook pro laptop and also a modern iMac. I also own a ton of PC’s. What about the license for Windows to dual-boot on my Mac’s?

So when I sum up the licenses I need I get the following:

  • 4 virtual machine root installations of Windows
  • 2 physical machine installations of Windows 7

Since all I really need to do my work in Windows are the virtual machines and the VMWare player, I can actually get rid of having to buy the two licenses for my “real” computers – and install Linux instead, thus saving the price of two Windows 7 licenses (ca. 1500 NKR a piece), saving in total $466.

As long as the VMWare player exists on a platform, be it Unix, Linux or whatever – I can use that platform to launch my virtual machines and get to work!

Getting rid of the laptop

Dragging your office to the office?

Dragging your office to the office?

Now having to drag along a huge Powerbook laptop (i got the big screen dinosaur) and my external disks to work for a client is a drag. In most cases the client has a PC allocated for me, usually networked with a bunch of rules and also some restrictions on what you can install. I usually end up coding on my own laptop and then transferring the binaries to the host computer. Which is a giant waste of time and effort.

Since all I need is Linux and the VMWare player, it makes more sense that I create a bootable USB version of Linux and carry that with me instead. That way, I don’t need to carry my heavy laptop with me every time. I just need to plug the USB pen into the clients computer, restart and boot from that – and I’m ready to go!

I hope this post has made it more clear how I work and the benefits of using a virtual-machine for Delphi.

Using Linux with Delphi

In my previous article I explained in detail how to install Ubuntu Linux and get VMWare to work on it. I must confess that my earlier experiences with Linux were negative, but with Ubuntu that has changed. I moved from Windows many years ago to Mac’s and OS X, perhaps that is what has made Linux so attractive for me (OS X is actually Unix beneath, other older brother of Linux) but either way — Ubuntu is so user friendly and easy to operate that I cannot lie about that.

But I carry no i’ll will towards Windows. In fact, Windows is what I do. I know extremely little about Linux programming, but that is about to change 🙂 I have only good things to say about Windows. Stable. Secure. A solid workhorse (those tiles screwed up everything in Windows 8, let Windows be Windows and bring back the start-button and desktop).

I sinceryly hope I have helped someone to finding new technology and inspired us “old timers” to try something new.

Have a great day and god bless!

Advertisements
  1. June 4, 2015 at 7:55 am
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: