Thursday, December 3, 2009

Run Debian Linux in VMware with no desktop

I use Linux a lot and used to run my main Linux machine on an ancient 500MHz Pentium, but I now use VMware on my Windows XP machine. I mostly run the gEDA tools an eclipse on Linux and I find it a nuisance switching between VMware and Windows so I run Xming (good free Xserver for Windows) and start an xterm with the Windows PC as the X display, then run everything from there. That way all my Linux windows are still just normal windows and I can mouse between them easily.
It seemed pointless having the Gnome desktop when I never use it, and I am already logged on to my PC so I have set it up to automatically log me on and start up an xterm.

Note: Some of the commands below need to be run as root.

1. First get rid of nome and gdm.
su
apt-get remove gdm
- reboot
su
apt-get autoremove
exit

2. Set up X to run an xterm automatically.
Create the file ~/.xsession and add the following line to it:
exec xterm -display 10.1.1.3:.0.0
where 10.1.1.3 is the IP address of your Windows PC that you run VMware from.
Note: You can run any GUI program from here, most will take an argument of --display.

3. Set up your login to run X-windows automatically and shutdown linux when you exit.
Edit ~/.bashrc and add the following to the end (see http://it.dennyhalim.com/2008/10/linux-automatic-login-startx-and.html):
if [ $(tty) == "/dev/tty1" ]; then
 startx
 /sbin/halt
fi
4. Set up halt so that anyone can run it.
su chmod +s /sbin/halt

5. Configure your Linux startup to automatically log you on:
suapt-get install mingetty
Edit /etc/inittab, remove the /sbin/getty line for tty1 and add in its place:

exec /sbin/mingetty --autologin replacewithyourusername tty1

Now when you start Linux it will automatically log you on and an xterm will pop up on your Windows desktop.

(Note: I am now using VirtualBox with the guest additions which works
nicely on Windows 7. It won't grab the mouse and you can even cut and
paste between Windows and Linux.)

1 comment:

  1. In the above set up I did not need a window manager because I am using Xming on windows and this provides the window manager.
    To have a similar setup on a real PC (i.e. not using VMware) I have install fluxbox (apt-get install fluxbox) and then add 'exec fluxbox &' as the first line of the .xsession file.
    If you don't use a window manager you get windows with no borders and you cannot resize them or switch between windows.

    ReplyDelete