Running Linux scripts on Windows

How to run Linux scripts on Windows.

Running Linux shell scripts on Windows is very useful to me. We may need to tweak some scripts depending on the environment in use.

One of the best ways to run them, is within Cygwin. This is something I have already written about.

If Cygwin is too bulky for you, you can use UnxUtils. This is a small set of widely used Linux Utilities, and includes the zsh shell. If you use this you will need to limit the scripts to those that use the commands available within this set. However, it still packs in a lot of paunch.

You might need to ensure the file path syntax expected by the given script matches the environment. Cygwin supports both forward-slash and backward-slash. However, please check the documentation/test to see what works.

Last option, is to run Linux on Windows using Virtual PC. That’s the best bet if you can invest the time needed to do the setup. Instructions are available here. However, this will not be able to access your Windows file system. If that is important for you (like it is to me in most cases), please stick to Cygwin. On the other side, if you are testing code that will eventually run on a Linux machine, the VPC method is better.

Share

Installing Knoppix within Windows

There are some problems if you try to install Knoppix within MS Virtual PC 2004. This post shows you how to get it right.

Knoppix is a Linux flavour that can run directly off a CD or DVD. All you have to do is boot off the CD and it starts running – it has all the basic applications like Internet Browser, Wordprocessing application etc. If you have FAT partitions, you will also be able to write to the disk.

However, I prefer booting into Windows and then running Knoppix as an application. (Although, I have a separate Debian installation as well for my main Linux needs.)

This can be done through Microsoft Virtual PC. I use the 2004 version dowloadable here. Also you need to have an ISO of the Knoppix CD. If you have a CD, you can make an ISO yourself, or download here.

Start MS VPC 2004, create a virtual harddisk and load the ISO, then reboot the VPC machine. Now follow the instructions below:

  1. Create a new VM with virtual HDD.
  2. Attach the Knoppix ISO to the VM and reboot.
  3. On the Linux prompt type: linux install IGNORE_CHECK=1 sudo knoppix_installer
  4. On the menu that comes, select 3. Partition
  5. When it asks for it, select Template 1
  6. Then back to main menu, select configure installation and accept all defaults
  7. Then back to main menu, select start installation [now it will take time]
  8. When the system boots, mouse wont be working so shut it down (but at least let it open the desktop first). Release the ISO and reboot VPC.
  9. All file edits (required in steps below) will need to be done as root, by doing su first
  10. Now, Grub will come up. On the first line, press e. Then on the next screen select the kernel line and press e. After this, add i8042.noloop at the end and press Enter. Press Esc and Enter.
  11. Select the first option and boot.
  12. After login, edit file /boot/grub/menu.lst and do the following for the first configuration only (one that says Default):
    1. Add i8042.noloop at the end of kernel line
    2. Remove the savedefault line since it causes problems later
  13. Now edit file /etc/sysconfig/desktop and change kdm to xdm
  14. Enter the command ‘reboot’ on the console
  15. Let the system boot, login – mouse will work.
  16. If the user config box comes up fine, else go to Settings->Desktop setting wizard. Now, select India in the first box and English-US in the second and press the first button.
  17. Keep following the wizard. At the end select launch KDE control center.
  18. Go to Regional and accessibility->Keyboard layout and bring up English layout
  19. Done, take backup of the VHD file

Most of the steps should also apply if you want to install Knoppix on a normal HDD. Why we have to go this route – for example why mouse isnt working – beats me. Could be bugs – I have collected all this information from different places on the web, according to the problems I faced. If you know why we have to do this way, please place comments. Also, suggest improvements and let me know if this helped.

Share