Friday, 3 June 2011

Installing FreeBSD 9 in VMWare

Install FreeBSD 9

Create a new VM machine with
  • 1 CPU
  • 512M DRAM
  • 50 G Disk with can be allocate as we go along

Download the a FreeBSD Boot ISO and boot off this image. Then select the following

  • Standard Install (others don't fully install unless you pick all the options manually)
  • All distributions
  • Yes to the mouse
  • No packages (will build them from the ports)
  • Use the full disk for FreeBSD
  • Accept all the default mount sizes and options


cd /usr/ports/net/cvsup (or /usr/ports/net/cvsup-without-gui)
make install

Put the following into a text file (to get updates to 8.0 and all src, ports,docs)

*default base=/usr
*default prefix=/usr
*default release=cvs tag=RELENG_9
*default delete use-rel-suffix
*default compress
ports-all tag=.
doc-all tag=.
Update the sources using

cvsup -g cvsupfile.txt

Building your own kernel (64bit)

Follow this:

Alternatively, from /usr/src/Makefile (my current favored method)

#  0.  cp /usr/src/sys/amd64/conf/GENERIC /usr/src/sys/amd64/conf/ZZZ
# 0a. vi /usr/src/sys/amd64/conf/ZZZ
Find this line
ident               GENERIC
Replace “GENERIC” with the name you want to use (ie your hostname)
ident               ZZZ

#  1.  `cd /usr/src'       (or to the directory containing your source tree).
#  2.  `make buildworld'
#  3.  `make buildkernel KERNCONF=YOUR_KERNEL_HERE'     (default is GENERIC).
#  4.  `make installkernel KERNCONF=YOUR_KERNEL_HERE'   (default is GENERIC).
#       [steps 3. & 4. can be combined by using the "kernel" target]
#  5.  `reboot'        (in single user mode: boot -s from the loader prompt or select the singer user mode option).
# 5a. 'mount -a -t ufs' (mount all partitions as RW)
#  6.  `mergemaster -p' (Check only the most critical files and ask what needs to be done. Read /usr/sys/UPDATING for what changes may have happened)
#  7.  `make installworld'
#  8.  `make delete-old'       (I don't delete the old.... you may want to)
#  9.  `mergemaster'            (you may wish to use -i, along with -U or -F. This does all the rest of the configs. I tend to use -Ui rather than -F).
# 10.  `reboot'
# 11.  `make delete-old-libs' (in case no 3rd party program uses them anymore) (I don't delete the old.... you may want to)

Installing X11

The -DBATCH command makes the build accept all default options (ie no need to watch)

cd /usr/ports/x11/xorg
make -DBATCH install clean

Add the following to rc.conf to make keyboard/mouse work under xdm

#Starting with version 7.4, Xorg can use HAL to autodetect keyboards and mice. The sysutils/hal and devel/dbus ports are installed as dependencies of x11/xorg, but must be enabled by the following entries in the /etc/rc.conf file:


Installing XDM

cd /usr/ports/x11/xdm
make -DBATCH install

edit /etc/ttys
and change the following from

ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure


ttyv8 "/usr/local/bin/xdm -nodaemon" xterm on secure

You can also confirgure XDM to allow remote connections via XDMCP:

edit /usr/local/lib/X11/xdm/xdm-config
and comment OUT the following line: DisplayManager.requestPort: 0

edit /usr/local/lib/X11/xdm/Xaccess
and add the following lines
* #any host can get a login window

NOTE the LISTEN * command doesn't work

Install Open-vm-tools

cd /usr/ports/emulators/open-vm-tools
make -DBATCH install

add the following to RC.conf

#vmware open-vm-tools

reboot and ensure vmware-guest process is running, otherwise start it up

Install VM-tools

1) Install Compat6x

cd /usr/ports/misc/compat6x
make -DBATCH install


If necessary, mount the VMware Tools virtual CD-ROM image by entering a command similar to the following:
mount /cdrom
Change to a working directory (for example, /tmp):
cd /tmp
tar zxpf /cdrom/vmware-freebsd-tools.tar.gz
umount /cdrom
Run the VMware Tools installer:
cd vmware-tools-distrib

[[Accept all defaults]]

Renewing a DHCP lease using FreeBSD

In this case the active interface is sis0, so here is the command to run.
/sbin/dhclient sis0

Now occasionally that may not work as quickly as you might like. If you want to force it, you can restart the networking components by hand.

# /etc/netstart

Technically /etc/netstart has been obseleted by /etc/, although both seem to work just fine.



or in the crontab

0 * * * * /usr/libexec/locate.updatedb


Add the following to /etc/rc.conf

#this adds the -g option to the default flags which are located in /etc/defaults/rc.conf
#-g option removes sanity checking. IE regardless of how different the machine time is from the
#polled time change the machine time to match.
#VMs tend to run out of sync as they are a simulated environment
ntpd_flags="${ntpd_flags} -g"

No comments:

Post a Comment