Clone wiki

public / Home

NetBSD 5 VMWare Fusion Configuration

I find NetBSD to be an excellent OS to use for VMs as it is very clean & lightweight. These are some simple steps I use to quickly get a headless NetBSD VMWare image configured into a reasonably comfortable state for development.

Install NetBSD

Standard install - quickest to just use the minimal boot.iso and install sets over the network

Configure Network

# echo hostname=<host> >> /etc/rc.conf
# echo ifconfig_wm0=dhcp >> /etc/rc.conf
# /etc/rc.d/network restart

Configure SSHD (rc.conf)

# echo sshd=YES >> /etc/rc.conf
# /etc/rc.d/sshd start

Create development user acct

# user add -m -g =uid -G wheel -s /bin/ksh <user>
# paswd <user>

Grab getpkg tool

getpkg is a simple shell script which automates installation of binary packages using pkg_add (it is possible to do this manually however getpkg maintains a simple list of available packages and allows interactive searching/selection which I find this fairly useful)

# ftp
# chmod 755 getpkg

Install useful packages

# ./getpkg -update
# ./getpkg vim-share
# ./getpkg vim
# ./getpkg sudo

Configure sudo

# visudo

Allow users in wheel group

# Uncomment to allow people in group wheel to run all commands
%wheel        ALL=(ALL) ALL

Install mDNSResponder

This is very useful if you are using a system which supports mDNS .local name resolution for development - eg. MacOSX

# ./getpkg mDNSResponder

Add to rc.local in local daemons section (should probably create rc.d script for this but this is a quick fix)

if [ -x /usr/pkg/bin/mDNSResponderPosix ]
        /usr/pkg/bin/mDNSResponderPosix -b -n $(hostname) -t _ssh._tcp -p 22
        echo -n "mDNS "

You should now be able to connect to the host as $(hostname).local

Install vm-restart

vm-restart is a simple utility which for BSD/Linux based VMware guest OSs intended to detect when the guest has been restarted from suspend and take appropriate actions (typically to update the system time).

At the moment this isn't packaged so you will have to grab the source & compile.

This doesn't work if /usr/local/sbin doesn't exist - need to fix Makefile

# ftp
# tar xzf vm-restart-1.0.tgz
# cd vm-restart
# make && make install

Add to rc.local in local daemons section (again should probably create rc.d script for this)

if [ -x /usr/local/sbin/vm-restart ]
        /usr/local/sbin/vm-restart -s -e "/etc/rc.d/dhclient restart" -t 0.2
         echo -n "vmware-restart "

This will now restart DHCP (releasing/renewing leases) and sync clocks when the VM is waken up from suspend.


Reboot and check SSHD/mDNSD start

You should now be able to connect to the host as the development user using ssh to $(hostname).local

As Development User

Add SSH host keys

From development machine

# cat .ssh/

From NetBSD VM

# mkdir .ssh
# vi .ssh/authorized_keys
<paste public key>
# chmod 600 .ssh/authorized_keys

Grab standard config files

# ftp -o .profile
# ftp -o .shrc
# ftp -o .vimrc


You are now ready to go - install any additional development packages using getpkg and enjoy your NetBSD VM.