Hello guys, it’s been a while since I last posted up a tutorial so here we go. I hope you have a downloaded FreeBSD 9.1 Release ISO and Virtual Box up and running. If you haven’t installed Virtual Box yet, do install it now, and install ALL components (networking, USB support, etc).
Create a new Virtual Machine in Virtual Box. I recommend 10 GB of a FIXED storage volume and 512 MB RAM.
Before we start, open the settings for this machine, and check Enable IO APIC option. Basically, what we need to enable is HPEC (high precision event timers). Without those, FreeBSD would not boot. Enabling this option will enable HPEC.
Start the machine. You will be asked to locate the drive to boot from
Locate the FreeBSD ISO.
Boot (make sure ACPI is enabled, other wise enable it using the ‘4’ or ‘A’ key.
When the kernel has booted, start the “Install”.
The steps are self explanatory. In the following, select ALL distributions. You will need src (the system source code) because in FreeBSD 9.1, there are no packages unfortunately. All has to be pulled off the online repository or compiled from source
In the partitioning, use GUIDED mode because it will create all three standard FreeBSD partitions on its own.
If you choose to do it manually though, remember the freebsd-boot partition should be no larger than 512 KB. freebsd-swap should be the size of the RAM, and devote the rest to the freebsd-ufs (with / as the mount point). The boot partition must be the first one.
After that, commit to the installation. You don’t have to worry about the warnings since this is a virtual machine.
After the install, do not configure the em0 interface at this point. Do not add users at this point either. A lot of work has to be done as root. You can add users later. Just Exit the installer and reboot.
If the machine reboots into the ISO image again, you will need to power off this machine after reboot. Use Machine > ACPI Shutdown. Then go to machine settings and in the storage tab, select the FreeBSD ISO. Remove it from the virtual drive as shown in the pic.
And then start the machine.
Log in as root and the password you set during install. The first thing you should do is to connect to the internet via NAT (Network Address Translator) of Virtual Box. NAT configures itself automatically. Make sure the host OS is online. Then issue this command:
# dhclient em0
Then since Google is always on,
# ping google.com
I deliberately used this syntax because most users don’t know how to exit from the ping command. Well, here you go, press CTRL + C to exit from ping when it has transmitted/received a few packets. CTRL + C will exit most commands.
Let’s move on and install X11.
# cd /usr/ports/x11/xorg # make install clean
You are compiling from source. It may take a while. The dependencies will be downloaded from the internet also.
Alternatively you can run
# pkg_add -r xorg
To download precompiled packages directly and install them instead.
Once it is installed, I’d recommend you install nano text editor because we will need to edit a lot of files. The default editor, vi, is more fun to use but a bit complicated.
# pkg_add -r nano
Let’s move on to configure X11.
You need to edit /etc/rc.conf and place the following lines at the end:
This is because Xorg uses HAL to autodetect mice and keyboards. That’s it, fire up X.
You will see TWM, the default X11 window manager. Then run this command to create a skeleton configuration file in /root
# Xorg -configure
Now test if Xorg is working on your hardware.
# Xorg -config xorg.conf.new -retro
If a black and grey grid and an X mouse cursor appear, the configuration was successful. To exit the test, switch to the virtual console used to start it by pressing Ctrl+Alt+Fn (F1 for the first virtual console) and press Ctrl+C.
Install the URW font collection (the default fonts shipped with X11 are less than ideal).
# cd /usr/ports/x11-fonts/urwfonts # make install clean
Now make the X server detect these fonts. The following commands should be run in a shell in an X session:
% xset fp+ /usr/local/lib/X11/fonts/URW % xset fp rehash
Last thing for today, install GNOME:
# pkg_add -r gnome2
# cd /usr/ports/x11/gnome2 # make install clean
Once that is done, add the following lines to /etc/rc.conf to make GDM start automatically at boot:
That’s it. Reboot and you will be greeted with a graphical login screen. Enjoy your FreeBSD experience!