Customized Linux VM

The goal of this snippet is to produce a reasonably small Linux virtual machine running inside of VMware customized to my liking.

Install the system

  1. Create a new VM in VMWare (Choose Ubuntu 64-bit or other Linux 2.6 64-bit)
  2. Download Debian Lenny 64-bit (or other Debian testing version) netinst ISO (~150MB) (e.g., debian-LennyBeta2-amd64-netinst.iso)
  3. Boot VM with ISO. Install with “Standard System” option when prompted. Do not choose “Desktop Environment”.

Install packages

Upgrade to latest

apt-get dist-upgrade
reboot

Kernel

Install the kernel headers

apt-get install linux-headers-2.6-amd64

Userland

apt-get install zsh git-core vim openssh-server openssh-client sudo build-essential

Userland, xorg

apt-get install xserver-xorg-video-vmware   # this will pull a lot of xorg dependencies
apt-get install xserver-xorg-input-vmmouse  # needed for free mouse roaming between host and guest OS
apt-get install xmonad slim                 # window manager and login manager
apt-get install xorg

Configuration

Edit mouse driver in xorg.conf:

vim /etc/X11/xorg.conf

Change the InputDevice section for the mouse to this:

Section "InputDevice"
  Identifier "Configured Mouse"
  Driver     "vmmouse"
  Option     "CorePointer"
  Option     "Device"  "/dev/input/mice"
EndSection
There was a problem with xserver-xorg-input-vmmouse version 1:12.5.1-4 causing the X server to crash on startup. Discover the installed version with aptitude show xserver-xorg-input-vmmouse. Instead, I downloaded xserver-xorg-input-vmmouse_12.5.1-2_amd64.deb from here, and installed it with dpkg -i <filename>

Cleanup

Remove downloaded package files:

aptitude clean

Login

Reboot and log into X as the normal user.

Install VMware Tools

This part is optional. At a minimum, VMware Tools will allow X to readjust resolution dynamically when the VMware window is resized.

From Virtual Machine menu, select Install VMware Tools. This inserts a mountable image at /dev/cdrom.

mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
cp /mnt/cdrom/VMwareTools*.tar.gz /tmp
cd /tmp
tar zxvf VMwareTools*.tar.gz
cd vmware-tools-distrib
./vmware-install.pl
If the kernel was built with a different version of gcc, the /usr/bin/gcc symlink will have to be changed to the version used to build the kernel.

Other Tips

Shared Home Directory

Create a directory on the host machine to act as the home directory for the Linux VM. This allows you to access your files easily from the host OS. This can be done by:

  1. Create a new directory somewhere on the host
  2. Set up shared folders in the VM's settings. This will mount /mnt/hgfs on the guest (VMware Tools required for this).
  3. Modify /etc/fstab and include options uid=1000,gid=1000 on the mount line to give ownership to the first user account.
  4. umount /mnt/hgfs and mount /mnt/hgfs to make ownership change
  5. move contents of home directory to /mnt/hgfs/<yourshare>
  6. rm /home/<username> to remove the home directory
  7. ln -s /mnt/hgfs/<yourshare> /home/<username> to link the mount to the home directory
 
snippets/linuxvm.txt · Last modified: 2008/11/16 23:08 by f0rked
admin | login | sitemap
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Driven by DokuWiki