I’ll expound on this as I go on.Â For now this will be an overview with separate articles going into each part.Â Iâ€™ll go into the process of how I created my OS/2 2.0 BBS, bbs.superglobalmegacorp.com .
VPS’s (Virtual Private Servers) are getting cheaper as the days go on, and it only makes more and more sense to take advantage of these great things! Â Almost all of them are geared to running Linux, a few to Windows, and well anything outside of those two is damned near impossible to find (I’ve seen ONE NetBSD VPS service).
So if you want to say run MS-DOS, OS/2, Xenix, or any other crazed OS (why not?!) you are basically SOL as they say, except of course, if you utilize our old friend Qemu.
The first thing you’ll need is a VPS. Â Now there are thousands of providers out there, I can recommend what I use (and I’ve got a few) but as always, pick a plan that you feel comfortable with. Â To get started on something small a budget of under $10 USD a month is perfectly fine. Â Shop around and you can certainly find cheaper in the month to month space, and if you are willing to pay up front, I’ve seen them average down to $2.50 USD a month. Â Yes for less then a Big Mac, you can have your own ‘server’ in the sky (or part of the cloud nonsense if you are into that). Â Hell you can even setup your own globalÂ infrastructure, with servers in Europe, Asia and North America for about $20 a month!
Anyways you can find an overload of reviews, and listings on sites like Â webhostingtalk.com, and lowendbox. Â Again I know it can be overwhelming but googling around you can eventually find what you are looking for.
Now what is important for running Qemu on a VPS? I’d have to say, memory is the #1 thing, bar none. Â Now the joy of running older OS’s is that they didn’t need much back then so any new VPS ought to be ‘extravagant’ to them, but keep in mind Qemu needs a fair bit of memory itself!. Â I generally worked it out to consume with a ‘bare’ CentOS or Debian install with an 8MB VM to consume around 60MB of memory.
Keep that in mind, that with your VM the OS will need memory, as long as disk space is also needed. Â So it all depends on what OS you plan on running. Â I’ve run MS-DOS, OS/2, Windows NT, and 386BSD all on the ‘cloud’.. And 8MB was fine for 386BSD but really the VM was overtaxed for anything outside of serving the VM… This for me was fine. Â Again keep this in mind if you had hopes of serving web pages, hosting a blog (wordpress needs like 512MB of ram++!!!!!) or whatever. Â Another thing is the x86 vs .x86_64 (32bit/64bit) question, and for VPS’s that need to keep small you will want to run 32bit code. Â Esp if your VPS is configured under 2GB of ram, really there is no big ‘deal’ in loading 64bit stuff, epically since the 64bit versions consume more memory.
If in doubt setup a VM at home with the same constraints you are shopping to see if you can even do what you hope to do.Â This is the big advantage of VM software as you can test all of this from home, without any major pain!
Another thing to keep in mind is that with your own VPS you will be the one required to keep it up to date! Â Pick a distro that you are somewhat comfortable with. Â Personally I went with Debian in my VPS’s as that is what I’m the most comfortable with. Â Also I’d HIGHLYÂ recommendÂ NEVER EVER installing a compiler on the VPS. Â If someone does get onto your system, handing them a compiler is like a loaded gun. Â At least make it more…. involved for them. Â Also setup a VM at home with the same OS, same cpu, same flavor *WITH* compiler, so that way you can check updates at home, to make sure things work, and of course compile things like Qemu for your environment without worrying about things that are either incredibly stale in packages, or just not there at all.Â The same goes for things like firewalls.Â Again pick something you are most comfortable with, and try to stick with that. The majority of OSâ€™s available are Debian, various Debian forks (Unbutu?!) and CentOS, the RedHat â€˜freeâ€™ clone.
With a VPS selected and created, and a VM at home loaded up with the same OS you will want to build Qemu.Â Now keep in mind that since youâ€™ll be running this on a server that will *NOT* have any local X11, and to minimize memory consumption & disk space by not loading .. X11, you will need to create a version of Qemu that is VNC display only.Â Itâ€™s not that difficult.Â Itâ€™s covered in the config process.
With a version of Qemu built, and uploaded to your VM (I use scp) you will then need to decide if you are going to encrypt your disk images (can you really, really trust your host?) or if you are fine with the way things are, and you are going to run in the open.Â Naturally â€˜fixed/flatâ€™ disk images will be faster and not as CPU intensive, but of course they consume more disk space.Â If you are going to â€˜overcommitâ€™ your VM or just donâ€™t want to have the empty space right away, Iâ€™d highly recommend making a swap disk for the VM, that way you wonâ€™t blow out your disks with swapfile growth/shrinks and eventual fragmentation and moves.
If you did choose to encrypt your disks, you will need the program â€˜screenâ€™.Â Itâ€™s been around for a long long while, and every Linux distro should have it available.Â You will need to run screen, then launch Qemu from within screen, then itâ€™ll prompt for the password for each disk drive.Â Once Qemu is operational you can disconnect the screen session and itâ€™ll remain operational.Â Doing so in a script would require you to store the password locally, and defeats the whole point of encrypted storage.
Beyond storage, youâ€™ll want to select some kind of method for external communications with the world.Â For an OS/2 BBS I simply take TCP port 23 and forward it to the VMâ€™s port 23.Â SIO & vModem take care of all the logic from there.Â IfÂ you wanted to telnet into a *NIX box, again tcp port 23.Â Maybe you want to run Windows NT 4.0 Terminal server, in that case the default TCP port is 3389.Â While NT 4.0 is limited to Internet Explorer 6.0 and Firefox 1.5, it still can be a handy thing to have a multiuser version of NT (like a windows mainframe) out there somewhere for some things, although its usefulness is dwindling.Â Maybe you want your own Exchange Server, or even SQL 7 instance, again older software performs better in tight disk/memory constraints.
Another thing to keep in mind is CPU consumption. Â You will want a guest OS that can idle. Â Otherwise you will consume 100% of the CPU 100% of the time, and they *WILL* notice this, and kick you out. Â Be mindful of VPS services, and you have to share CPU resources. Â Again watch your task manager or ‘ps’ locally and watch how things behave. Â I know for the BBS stuff, you have to watch what doors you are interested in running as some of them happily gobble 100% of the CPU. Â OS/2 friendly stuff is the way to go (IMHO) as CPU hogging was a big deal back then, and it’s best to ride on the back of how people solved this stuff a while ago. Â Also for MS-DOS people, things like Dbase III applications it’d be a “bad idea” to put them into the cloud. Â Although if you get one with a higher SLA that lets you run 100% then.. have at it!
If Qemu runs â€˜normallyâ€™ you can even set it up into a batch file loop that calls Qemu over and over as needed between reboots.Â You could even do some â€˜house cleaningâ€™ between reboots, say make a backup, email a notice etcâ€¦ Itâ€™s all up to you, and what you are capable of batch script programming wise.
Also you will probably want your VPS to automatically launch your Qemu VM, and the best way I’ve found to do this is via the GNU screen program. Â I just added the following to my /etc/rc.local file:
screen -S qemu -d -m /usr/local/os2bbs/run.sh
screen -S cpulimit -d -m /usr/local/bin/cpulimit -e qemu53 -l 8
This gives me two named instances, and will automatically limit my Qemu to only 8% of the host CPU that way I don’t get kicked for being a CPU hog. Â 8% of a 3Ghz CPU is more than enough for stuff that ran comfortably on a 16Mhz machine back in the day.
Then that would about wrap it up, you would now have a Linux VPS running your own OS, so you could serve up whatever application you want in the cloud.Â The best part is, because Qemu is multiplatform, and will run on various OSâ€™s and CPU combinations, you can jump ship very quickly to other platforms as you see fit, as all you need to do is rebuild your Qemu hosted binary, then copy your disk images & startup scripts and you are good to go!
Not to mention there is nothing to stop you from building the VM on Windows, to upload to Linux, then maybe move to SPARC Solaris!
Screw Java, Qemu is the ultimate VM!