Black and White.

Friday, July 13, 2007

Run Linux and Windows at the same time

A quick search on Google for tutorials regarding Linux and Windows interoperability, will reveal a lot of guides on how to install (emulate) Windows on a virtual machine inside Linux or how to migrate from Windows to Linux or how to dual boot Windows and Linux, but what I was really looking for was a way to run Windows and Linux at the same time, on the same machine; sharing the same desktop, working with the applications from both operating systems at the same time, without having a virtual machine window open or God knows what else.

So, does your business require for you to work on both operating systems? Why having two monitors, two computers when you can have Windows and Linux running on a single computer like they were born together? Imagine you can open Microsoft Word, write some text and then copy/paste this text in a Linux application, or you can share files between the two OSes or probably you're a web designer and you have to test your websites on both operating systems: wouldn't this be a life saver? Well, today I am happy to announce you that all this is possible and it will take about 30 minutes to setup everything in order to have Windows and Linux running at the same time on your computer and to share all the applications from these operating systems without hassle.

I've tested this guide on a Ubuntu machine with KDE as the default desktop environment and with Windows XP SP2. I am sure that this tutorial will work flawlessly on any other Linux system out there. Take a look at some screenshots:


Install necessary software:

You have to install two applications:

· VMware Server
· rdesktop

But before you install these application, it's a very good idea to get a serial number for VMware Server software. The serial number is FREE of charge and it will not expire. To get yours, click on the following link:

http://register.vmware.com/content/registration.html

Fill up the form and you'll receive a serial number immediately after you click on the submit button. Note the serial number somewhere because you'll need it later.

· If you are a Debian/Ubuntu user open up Synaptic Package manager (System -> Administration -> Synaptic Package Manager for GNOME users and KMenu -> System -> Synaptic Package Manager for KDE users), search for vmware-server and rdesktop and install them.

· If you are a Fedora/openSuse/Mandriva user, open the default package manager, search for vmware-server and rdesktop and install them.

IMPORTANT: The VMware Server installation will ask you for the serial number, so paste the 20 digit code you have received earlier, otherwise the installation will fail.

Prepare VMware Server to run Windows

The VMware Server application will be installed in the System Tools category, so open it from Applications -> System Tools -> VMware Server Console if you are a GNOME user or from KMenu -> System -> More applications -> VMware Server Console if you are a KDE user. When it starts, it will ask you to select the host that you want to connect to. So:

1. Select Local host and click the 'Connect' button.
2. Click the 'Create a new virtual machine' button.
3. On the new window, click Next.
4. Select Typical and click Next.
5. Then select Windows XP Professional from the drop down list and click Next.
6. Give your virtual machine a name and click Next
7. Select "Use network address translation (NAT)" and click Next
8. And on the last step, click Finish.

It will take a few minutes until the virtual machine is created. When it's done, insert the Windows XP Professional CD in your optical drive and power on the virtual machine. The CD will be detected and the Windows installation will start. I guess I don't have to explain you how to install Windows.

Setup Windows

When the Windows installation is over you must do a few little tricks:

1. Go to Start -> Control Panel, click the "Switch to Classic View" on the left side and then double click on the System icon. Go to the Remote tab and check the second box, where it says "Allow users to connect remotely to this computer". Click Apply and close the window.
2. Go to Start -> Run, type regedit and hit enter. The Registry Editor will open, navigate to HKEY_CURRENT_USER -> Software -> Microsoft -> Windows -> CurrentVersion -> Policies -> Explorer, right click on the right side, select New -> DWORD Value, name it NoDesktop, double click on it and set the Value data to 1 instead of 0. Click OK and restart Windows.
3. Go to Start -> Control Panel, double click the "User Accounts" icon, click on your username and then on "Create a password" link. Create the password and close the "User Accounts" window.
4. Still in Control Panel, double click the "Network Connections" icon, click the "Local Area Connection" icon and in the left side you will see on the Details area the IP address of this virtual machine. Note the IP address somewhere because you'll need it later.
5. Download SeamlessRDP software from here and extract it in C: (make sure it creates a folder called seamlessrdp).
6. Release the mouse from the virtual machine by pressing CTRL+ALT keys at the same time, go to VM -> Install VMware Tools. An installer window will appear in your Windows machine, follow the steps to install VMware tools application. When finished, a reboot will be required.

When you get back to Windows, log off and close the VMware Server Console window.

Final arrangements

Create a shortcut on your desktop in order to easily start Windows every time you need it. So, right click on the desktop, go to Create New -> Link to Application if you are a KDE user or Create Launcher if you are a GNOME user, name the shortcut, select a nice icon for it and paste the following code on the "Application/Command" field:

rdesktop -A -s 'c:seamlessrdpseamlessrdpshell.exe c:windowsexplorer.exe' Windows' IP address -u your Windows username -p your Windows password

IMPORTANT: replace Windows' IP address with the Windows IP address that you've noted earlier and the your Windows username and your Windows password with the username and password you've created in Windows (e.g. rdesktop -A -s 'c:seamlessrdpseamlessrdpshell.exe c:windowsexplorer.exe' 172.192.56.123 -u marius -p nestor).

IMPORTANT: Make sure you disable any running firewall on your Linux machine.

Now double click the shortcut you've just created and the Windows taskbar should appear on your Linux desktop. Right click on it, uncheck 'Lock the Taskbar' option and drag it where you want. Now you can use Linux and Windows at the same time without hassle.

Share files between Windows and Linux

To share files between the two operating systems make sure you install Samba (server and client) on the Linux machine and on Windows all you have to do is to right click on a folder that you want to share with the Linux OS, go to Properties, Sharing tab and check the "Share this folder on the network" and "Allow network users to change my files" options. Now open Konqueror and type in the address bar:

smb://the Windows IP (replace 'the Windows IP' with the IP address from the Windows machine. e.g. smb://128.56.123.25)

Take a look at some videos that demonstrate the Windows/Linux interoperability:

This example demonstrates that I can copy/paste a text between Windows and Linux applications:



This example shows that I can run Compiz Fusion, Windows and Linux at the same time:



IMPORTANT: Remember that every time you restart your computer, the virtual machine that runs in background will close, so you'll have to open VMware Server Console and start the Windows machine before you can connect to it through the desktop shortcut.

No comments: