FreeBSD Installation and SetupRepost from my WordPress site. The information might be slightly outdated. On the surface, FreeBSD is almost identical to Linux. The difference is that, like Arch Linux, the base installation doesn't have the features or configuration that something like Ubuntu provides for non-technical users. This post goes through my process of getting FreeBSD running with a full desktop environment. It should take a couple of hours at most, starting with a basic installation disc or ISO. Essentially what’s happening here are the following steps:
Installing the Base SystemFor this I used the i386 ‘disc 1’ ISO file in VirtualBox, but the following should apply when installing FreeBSD directly onto a machine with fairly generic hardware. The first thing we get is the boot screen. From the menu select the ‘Boot Multi-user’ option, then at the next menu launch the FreeBSD Installer. The installation should be fairly quick, as it consists of the base system and the command line interface. When prompted, we definitely need to create a second user account.
Reboot the system and login as root. Fortunately, these days the common UNIX-like systems have package managers. The next stage will require the ‘pkg’ tool to fetch and install other components, so enter the ‘pkg command.
Adding a desktop interface to the installation will involve modifying configuration files. I use Vim for this, but I strongly recommend the Nano for the less experienced - it's very easy to screw things up with Vim, if you're not fully used to it. The package manager can be used to install this.
Certain components need to be enables - dbus, hald and kdm4 in particular. The Hardware Abstraction Layer daemon (hald) is used for handling display-related hardware, and dbus is used for inter-process communication.
Edit /etc/rc.conf to add the following lines:
The thing is hald relies indirectly on procfs, the /etc/fstab file should look something like the following screenshot, and contain the entry for proc:
Installing X Server and Desktop Environment
There are some pages on this in the official FreeBSD documentation, but I’ve skipped certain things.
The system will require an X Server:
As the status messages indicate, this also fetches and installs the TWM environment. Also required are the X Display Manager (xdm) and Session Manager (xsm).
Run ‘X -configure’ and copy the generated file with the following command:
In the new file (/etc/X11/xorg.conf) add the following section:
Sorting KDE and KDM
Now we’re ready to install a full desktop environment on this. As with Linux, we have a range of possible environments to choose from. I chose KDE, which gives users something vaguely similar to the Windows 7 desktop.
Roughly 950MB of KDE and KDE-related packages are fetched (many of them we don’t really need), and installation takes up around 3GB.
When this is done, we modify /etc/ttys so TTY8 uses KDM instead of XDM:
I also entered the following to see whether KDM runs as a service at this point.
In the user’s home directory we require a file that starts KDE as the default GUI. Enter the following command:
And add the following line to the .xinitrc file:
Changing the Display Size and ResolutionAfter installing FreeBSD with a desktop environment, the first thing I wanted to fix was the virtual screen size, which was much smaller than the physical screen.
Before getting to that, a fresh installation doesn’t have the ‘sudo' program to enable the execution of specific tasks with root privilieges. Switch to another terminal, e.g. Ctrl+Alt+F4, log in as root, then install sudo':
Then:
Now we need to add the user to the sudoers file, using the visudo command.
Add something like the following into the file:
Maxing Out the DisplayAs often happens when installing Linux/UNIX on VirtualBox, and sometimes when installing on physical hardware, the desktop is much smaller than the physical screen. In this case, I’m guessing the underlying problem was the operating system attempted to detect the video hardware and load the appropriate driver for it. Failing that (because it’s VirtualBox), the operating system falls back to a generic driver module. The driver module needs to be replaced with something from the VirtualBox Additions package. The FreeBSD wiki does have some information on this.
To install the VirtualBox Additions:
In xorg.conf, the following lines in the Device section are important:
Hopefully the boot messsages would show the VirtualBox additions being loaded successfully whenever the system is rebooted, and a full size desktop should appear. Configuring Display Size for Installations without a DesktopEnvironmentBefore resolving the KDE problem, I managed to fix the display size for the command line by playing with the video mode. As far as I can tell, this only works when the generic display driver module’s loaded.
The following command displays a list of video modes:
When you’ve hit the correct one, the mode can be made persistent by adding the following line to /etc/rc.con:
|