How to install FreeBSD 9.0 on VirtualBox

Default featured post

The article expresses about installing FreeBSD version 9.0 as a virtual machine on ViirtualBox application. In the first part of tutorial you will familiar about installation procedure of FreeBSD. The next step is about configuration and installation VirtualBox Guest Addition package on FreeBSD. Finally, the last section talks about Graphic User Interface(GUI) in FreeBSD and how to install either KDE or Gnome on it.

Introduction

FreeBSD is a free Unix-like Operating System(OS) for the i386, amd64, IA-64, arm, MIPS, powerpc, ppc64, PC-98 and UltraSPARC platforms based on U.C. It is derived from AT&T Unix and BSD Unix. It is also developed at the University of California, Berkeley. According to the FreeBSD website,

FreeBSD’s code base has undergone over thirty years of continuous development, improvement, and optimization

Continuous development makes FreeBSD one of the most compatible and stable OS. Today. it is used in many servers and web-servers of big companies such as Yahoo!. In addition, the core of Apple Mac OS X is based on this powerful OS.

Install FreeBSD on VirtualBox

FreeBSD has text-based installation and it might quite tough for those of people who are not familiar with the installation steps. If you are not interested and are not patient enough to work with text mode, it is highly recommended to download and install PC-BSD. It is utilized with GUI installation for making tasks easy. It also has pre-configures KDE for immediately use. The first step of installing Free-BSD is VirtualBox configuration. You should change default configuration of your VirtualBox machine from PIIX3 to ICH9 on system. Furthermore, mark Enable IO APIC from the same window (Figure-1). Otherwise installation process will not complete with showing errors.

VirtualBox setting
Figure_1 (VirtualBox setting)

The next step is inserting FreeBSD installation CD on CD-ROM drive or identify the location of its ISO file. After pressing start button you should see the picture such as below.

Boot menu of FreeBSD
Figure_2 (Boot menu of FreeBSD)

Now press enter for going to next step. After boot screen new menu similar to Figure_3 will appear.

3
Figure_3 (Welcome screen)

In this section you have three alternatives. You also have this chance to work with FreeBSD as a live CD or check the Shell. The shell is mostly used for restoring and recovering installed system. With choosing install and pressing enter, you will go to the FreeBSD installer.

4
Figure_4 (Keyboard Selection)

In this part you have the option to set your keyboard. If you want standard mapping just press yes to continue installation. Otherwise, press no and select your desire mapping. Next, it will show you a window for the host name for the system. You can easily write the host name if you have one or just press “OK”. After that, the components to install window will show be shown (Figure_5).

5
Figure_5 (Components selection)

It is not a bad idea to select all packages but installation program does not check available free space on your hard disk for ticked ones. Therefore, bear in mind to choose needed applications. Next menu is about allocating disk with three Guided, Manual, and Shell options. Just press Guided to go to next step. After that the program will ask about allocating disk.

6
Figure_6 (Disk allocation)

You can dedicate whole disk space to FreeBSD or just free partition or free space. Since you are installing FreeBSD as virtual, you do not need to be worry, Only choose Entire Disk. The final stage of disk allocating is editing partition. In this section you can create different numbers of partition with various sizes. On the other hand, you can just press Auto for making slides automatically. (More information about partitioning is available on FreeBSD website or FreeBSD handbook).

7
Figure_7 (Partitioning)

With pressing Finish installer will direct you to final confirmation phase. It will warn you about changes which will be written on disk and erasing data. If you ready just select Commit and if you are not prepare, you have this chance to go back for any changes.

8
Figure_8 (Final confirmation)

After pressing Commit the installer program will start to install packages. The installing time depends on packages which have been chosen and your computer hardware.

9
Figure_9 (Installing process)

With finishing installation you will be directed to the post_installation section. In this step password of the root user must be set. In addition, some network configuration should be done such as network interface selection, IP and DHCP configuration. (Figure_10,11,12). If you do not have any special configuration you can easily skip this section.

10
Figure_10 (IPv4 networking)
11
Figure_11 (IPv4 DHCP configuration)
12
Figure_12 (IPv4 static configuration)

The next step is setting the time zone. In this step you can select the time zone of your area and set it properly. Figure_13 & 14 show time zone configuration.

13
Figure_13 (Time zone selector)
14
Figure_14 (Selecting time zone)

After time zone configuration the installation program of FreeBSD goes to the services section. In this section you have authority to enable additional services for your FreeBSD. The list below expresses about additional services which are available on FreeBSD.

  • sshd – Secure Shell (SSH) daemon for secure remote access.
  • moused – Provides mouse usage within the system console.
  • ntpd – Network Time Protocol (NTP) daemon for automatic clock synchronization.
  • powerd – System power control utility for power control and energy saving.
15
Figure_15 (Additional services)

Furthermore, FreeBSD asks for enabling crash dump which is very useful for debugging issues. The process of enabling crash dump is quite simple and the system just ask for confirmation. With enabling this option the crash dumps will be stored in /var of your system but bear in mind that these files occupy a lot of disk space. The next step is known as adding user(s). In this step, FreeBSD allows you to add new users, groups with setting their attributes as well. Figure_16 shows regrading the adding users in FreeBSD.

16
Figure_16 (User information)

The list below describes the user information which you can fill in this step.

  • Username – The name the user will enter to log in. Typically the first letter of their first name combined with their last name.
  • Full name – The user’s full name.
  • Uid – User ID. Typically, this is left blank so the system will assign a value.
  • Login group – The user’s group. Typically left blank to accept the default.
  • Invite user into other groups? – Additional groups to which the user will be added as a member.
  • Login class – Typically left blank for the default.
  • Shell – The interactive shell for this user.
  • Home directory – The user’s home directory. The default is usually correct.
  • Home directory permissions – Permissions on the user’s home directory. The default is usually correct.
  • Use password-based authentication? – Typically yes.
  • Use an empty password? – Typically no.
  • Use a random password? – Typically no.
  • Enter password – The actual password for this user. Characters typed will not show on the screen.
  • Enter password again – The password must be typed again for verification.
  • Lock out the account after creation? – Typically no.

After adding new user(s) system will ask for confirmation and with proceeding it you will be directed to the last step of FreeBSD installation.
In the last step you also have alternative to come back to previous steps and do some changes. If everything is set properly and no need to change anything FreeBSD installation program will show you a windows such as Figure_17.

17
Figure_17 (Installation compilation)

With pressing Reboot the virtual machine program virtually reboot the system and FreeBSD will boot up and in few minutes the login page of FreeBSD will be appeared.

Installing UI and VirtualBox guest addition

The first part was a review of installation procedure of FreeBSD on Virtual Box application which some parts of the tutorial could be use for the real machine as well. Now this section is about doing some configurations for FreeBSD in order to have fully functional virtual machine with either KDE or GNOME GUI.

The first step of this section is to add Xorg and other packages from FreeBSD DVD. In order to achieve to this goal, it is necessary to mount CD/DVD-ROM. The procedure of mounting in FreeBSD is a bit different from Linux. The command which is needed to mount medium is mount command which is the same as Linux but the path of mounting in Dev folder is different. With using following commands you can access to the content of the FreeBSD. It is important that you should have root access for executing the commands.

$ mkdir /cdrom
$ mount -t cd9660 /dev/cd0 /cdrom
$ cd /cdrom

The first command makes cdrom folder in / partition and the second command mount CD-ROM to assigned folder which here is cdrom and the last command change the directory to cdrom folder.

The next step is installing VirtualBox Guest addition. For installing VirtualBox addition package you just need to run the following command.

$ cd /usr/ports/emulators/virtualbox-ose-additions && make install clean

This command install necessary packages which are needed for FreeBSD in order to run on VirtualBox properly. Usually, it takes few minutes to install. After the packages installed you should add the below two lines to /etc/rc.conf file.

vboxguest_enable="YES"
vboxservice_enable="YES"

The last step is to install GUI on FreeBSD. For installing GUI you have two common options, one is GNOME and other is KDE desktop. Before installing one of mentioned desktop is necessary to install Xorg, so for installing Xorg write the following commands in your shell.

$ cd /cdrom/packages/x11
$ pkg_add xorg-[Version]

The first line change the current directory to the cdrom folder in x11 folder and DVD of FreeBSD should be mounted already. The second command install the Xorg package on FreeBSD machine.

After installation of Xorg now you can either install KDE or GNOME on your FreeBSD. For installing GNOME type pkg_add -r gnome2 and for installing KDE just type pkg_add -r kde.

The last thing which is needed to do is to edit some files in order to enable mouse and keyboard plus loading one of the desktops automatically. For enabling mouse and keyboard add these two line to /etc/rc.conf.

hald_enable="YES"
dbus_enable="YES"

For enabling and auto start of GNOME desktop the add these two line to /etc/rc.conf.

gdm_enable="YES"
gnome_enable="YES"

Plus for proper operation, GNOME requires the /proc filesystem to be mounted. Add the following line to /etc/fstab.

proc        /proc        procfs rw 0 0

Finally, for enabling KDE just add this line to /etc/rc.conf.

kdm4_enable="YES"

References