Update [12-Nov-2007]: The sound driver still locks my system and the problem is NOT resolved yet. I have now abandoned BSD and moved fully to Linux for the desktop.
Update [12-May-2006]: After updating to FreeBSD 6.1 release, the whole system just crashes when the sound driver is loaded. The snd_emu10k1 driver hard locks my system. I have told the FreeBSD developers about this problem. Hopefully it will get fixed soon.
In this world where Linux dominates the Unix news sections of just about every technology news site, there lies another robust, powerful, Unix family of operating systems – the BSDs. There are six different flavours of BSDs available today: FreeBSD, NetBSD, OpenBSD, Dragonfly BSD, the new easy to use DesktopBSD and the new, easy-to-use PC-BSD. It is the last two mentioned ones – DesktopBSD and PC-BSD that are designed for common desktop use. In this series of articles, I will be focusing on PC-BSD. Do have a look at the PC-BSD site to accquaint yourself with this wonderful BSD flavour.
In this guide, I will cover the installation and configuration of PC-BSD for common desktop use. This guide is meant for the home user with a desire to learn about PC-BSD, therefore I have tried to keep things relatively simple. Note that only the installation of the OS is specific to PC-BSD. All other sections on installing and configuring applications are applicable to FreeBSD, PC-BSD and DesktopBSD equally [except if you install a PBI, since PBIs are specific to PC-BSD].
My system specifications are as follows:
- Intel celeron 2.0 GHZ
- 512 MB RAM
- ATI Radeon 7000 video card
- Realtek 8139 network card
- Creative Sound Blaster Live sound card
- Viewsonic VG800 monitor
- HP PSC 2110 multi function device
- Liteon DVD burner
- A local Taiwan brand PS/2 wheel mouse
Before we start, I need to mention a few things:
- Your home directory is:
When this guide says to make a script executable, you do the following as a regular user:
- Open a terminal
- cd to your scripts directory
chmod +x scriptnameto make scriptname executable.
- When this guide says execute a script as root, then you do the following:
- Open a terminal
- cd to your scripts directory
- Enter your root password
./scriptnameto execute scriptname
- Regular user is the user you log in as for day to day usage. Root is the user you log in as to administer the system.
In this guide, I install software using the ports system. The reasons I do not use PBI files (PC-BSD’s packages) are the following:
- I do not wish to have multiple copies of libraries around. In case of a vulnerability in a particular library, I need to patch each copy of the library. Ports system uses shared libraries where a single copy of a library is shared between multiple applications. Hence, in case of a vulnerability, only one copy of the affected library needs to be patched.
- PBI files, at this time, do not have support for md5. What I mean is that the installer does not automatically check the signature of a PBI file before installation. This means that one cannot verify the authenticity of the file. Installing from ports does not have this problem since the md5 of all software that is to be installed is checked and only if the md5 sum matches, will the software be installed.
- If two programs – say A and B depend on a library X, and if these two programs are running at the same time, then there will be two copies of library X in memory. This is IMHO weird.
- You have no control over the options selected when building the program. In part 2, we will show you how to select the different options an application might have, when using ports.
Update: However since PBIs are a part of PC-BSD, I will cover them in part 2 of this guide. I will leave it to the user to choose which method they like to use for installating applications.
The version we are installing is the latest at this time – ver 0.7.8
So with this preamble, we dive into the installation….
Once downloaded, you burn the iso file to a CD-ROM using your favourite CD burning software and you are ready to roll.
To install PC-BSD, insert the PC-BSD CD into your CD/DVD drive and restart your system. Make sure your system is set to boot from the CD/DVD drive first. The system should begin to boot from the PC-BSD CD and the installer screen should appear. The screen should look like this.
Click Next to select the hard drive to which you want to install PC-BSD. I elected to allot the whole drive to PC-BSD. I also unticked the “Customize Disklabel” option as my intent is to keep things simple.
A confirmation message will popup asking you whether you want to proceed with the partioning. Click Yes to proceed.
Once the disk is partitioned, the next screen is the boot loader configuration screen. I elected to use the BSD boot loader.
Click Next to let the installer install all packages on the CD. At this time, you cannot customize the package selection.
Once the installation is finished, the next screen lets you enter your root password (remember root is for administration purposes only – NEVER use it for day to day usage). You also need to create a regular user and set the regular user password. (the regular user acct is what you will use for day to day usage). You can also enable the “Auto-Login User” option if you wish. If you do this, then the system will automatically log you in as the regular user without you having the need to type in your regular username and password. I chose not to enable this option. You can see an example of the screen here.
I created the user
michael as my regular user. Therefore my home directory is:
After setting your username and passwords, click Next to finish the installation. The screen informs you to click Finish to close the installer and reboot the system to boot into your newly installed PC-BSD installation. So do what it says. Be sure to remove the CD from the drive, else it will boot from the CD and restart the installation.
Once the system reboots, it will automatically boot into graphical mode. Log in with your regular user name and password (if you are like me and have not enabled Auto-Login) and the desktop should appear.
Making the terminal easily accessible
Since we are going to use the terminal regularly, in this guide, let us make the terminal more easier to access. To do that, right click anywhere on the taskbar as shown. Then select “Add to Panel” – “Special Button” – “Teminal Sessions”. Now your terminal icon should be on your taskbar. Clicking it will give you a list of terminal choices.
Setting the screen resolution
PC-BSD got my screen resolution wrong. It had my monitor in 1024×768 resolution, when my monitor is capable of displaying at 1280×1024 resolution. To rectify this, I opened a terminal, became root (type
su and then your root password to become root) and then executed the following command:
xorgconfig. This brought up the X configuration utility.
The following are the choices I made. Adapt as required.
- Mouse Configuration: 1 (Auto)
- Emulate3buttons: Yes
- Mouse device: /dev/sysmouse
- Keyboard: 3 (generic 104-key PC)
- Language Selection: 1 (US English)
- Variant name: -Press Enter- – this will use the default
- Group switcher: No
- Monitor horizontal sync: 11 – custom. Then entered 30-82 for my Viewsonic.
- Verical range: 5 – custom. Then entered 50-75 for my Viewsonic.
- Monitor definition: VG-800
- Look at card database: Yes
- Selected card: 6 (Radeon)
- Video memory: 8 (32768k)
- Identifier for video card: ATI
- Change modes: 3 (change modes for 24-bit)
- Selected modes: 543
- Virtual screen larger than physical screen: No
- Change modes: 4 (modes are OK, continue)
- Color depth: 5 (24-bits)
- Write to /etc/X11/xorg.conf: Yes
To get my scroll mouse working, I opened a terminal, became root and typed
I then added the line:
Option "ZAxisMapping" "4 5" to get my scroll mouse working. This is shown here.
Now I logged out of X and logged back in and I had full 1280×1024 resolution with my scroll mouse working. Sweet!!!
Note: For newbies, vi may be difficult to use. Substitute ee for vi to work with the ee editor.
Connecting to the internet
I have a dynamic ADSL connection that uses the PPPOE protocol. Here is what I did to get my connection working. Please note that you need to know what your ethernet interface is called – mine is called rl0 (for realtek). Via-rhine users need to change this to vr0.
For a list of interface names, check the configuration options here.
Now edit your
/etc/ppp/ppp.conf file as root. You can download my ppp.conf and change it to your needs. Here are the lines that you need to change:
- HINET: – Change this label to your ISP name.
- allow users michael – Change
michaelto your regular user name. This line indicates who are the users who are allowed to connect.
- set device PPPoE:rl0 – Change
rl0to your ethernet interface name.
- set authname xxxx – Change xxxx to your ADSL username.
- set authkey xxxx – Change xxxx to your ADSL password.
Now open a terminal, become root, and type
ppp -ddial HINET.
Replace HINET with whatever label you chose in your /
etc/ppp/ppp.conf file. You should then be connected to the internet.
To automatically connect to the internet at boot, edit your
/etc/rc.conf file as root and add the following lines:
HINET with the label you chose in your /etc/ppp/ppp.conf file. Now the system will automatically connect to the net at boot.
To disable DHCP for my ethernet connection (rl0), since my net connection is adsl (tun0), and to set my hostname, I add the following lines to
ifconfig_rl0="inet 192.168.100.100 netmask 255.255.255.0"
The first line will set my rl0 to a private static ip address and the second one sets my hostname.
Now reboot your system. When the system is back up and running, your hostname should be set, your ethernet interface should have the static ip that you set and your net connection should be up. To verify this, open a terminal and execute the command:
ifconfig as a regular user. You should see output similar to the following:
rl0: flags=8843 mtu 1500
inet 192.168.100.100 netmask 0xffffff00 broadcast 192.168.100.255
media: Ethernet autoselect (100baseTX )
lo0: flags=8049 mtu 16384
inet 127.0.0.1 netmask 0xff000000
tun0: flags=8051 mtu 1492
inet 22.214.171.124 --> 126.96.36.199 netmask 0xffffffff
Opened by PID 207
To view your hostname, open a terminal, and execute the command:
hostname as a regular user. You should see output similar to the following:
Updating source code, ports tree and docs
Before we install software, it is recommended to update all source code, the ports collection and all documents, so that we can get the latest changes when we install software. The updation scripts are adapted from Dru Lavigne’s excellent article on updating FreeBSD. To do this first make a directory called scripts in your home directory. Open a terminal and then as a regular user, execute the command:
mkdir /usr/home/michael/scripts/. Substitute your regular user name for
michael in this command.
Then download my script – to download, right click on the script and select “Save Link As..” (update-pkgs) into your scripts directory.
Make it executable (open a terminal, cd scripts, chmod +x update-pkgs) and execute it as root (su, enter root passwd and then ./update-pkgs). This will download and install all the necessary pkgs required for the updatation script to work.
Once that is done, download my cvsup file (pc-bsd-sup) and save it to your scripts folder.
Finally, download my main update script (pc-bsd-update) and save it to your scripts folder.
Make it executable (open a terminal, cd scripts, chmod +x pc-bsd-update) and execute it as root (su, enter root passwd and then ./pc-bsd-update)
You can change the following line in the script to suit your geographic location:
Change the ‘tw’ to your country – ‘us’, ‘ca’, ‘sg’, ‘my’ or wherever else you live.
if SERVER=`fastest_cvsup -q -c tw`
This script will update the sources, ports tree and docs of your PC-BSD installation and make it in sync with the stable FreeBSD 5.4 tree. Please note that this script will NOT update all installed programs, but updates only the sorce code, the ports tree and the documents to their latest versions.
If you get this error message:
/libexec/ld-elf.so.1:shared object "libperl.so" not found,required by perl, (which you may get since the default perl installation in this version of PC-BSD is broken), then you need to reinstall perl. To do that:
Download my script (get-ports) to your scripts directory.
Make it executable (open a terminal, cd scripts, chmod +x get-ports) and execute it as root (su, enter root passwd and then ./get-ports). This script will download the latest ports tarball and extract it in
/usr/ports/. We need this to get the perl port.
Then download my script (build-perl) to your scripts directory.
Make it executable (open a terminal, cd scripts, chmod +x build-perl) and execute it as root (su, enter root passwd and then ./build-perl). This script will build perl and reinstall it.
Now re-run the main update script and it should work. If you get bored waiting for the script to finish, then wait atleast till it starts updating the docs, then you can quit it with a CTRL-C and re-run it at a later time (probably when you go to sleep).
Custom kernel configuration and firewall activation
Now we will customize the kernel, remove all un-needed modules (not needed for our system) and enable the firewall. PC-BSD already comes with a good firewall called IPFW. We just need to configure it for our needs and activate it.
First navigate to the directory where the kernel configuration file is stored (do this as root):
Now make a new directory under the root directory and call it kernels. We do this since we want to store our kernel configuration here. In the event that we delete the
/usr/src directory by accident, our kernel configuration is still safe.
Now copy the GENERIC file to /root/kernels and call it whatever you want. I call mine CUSTKERNEL.
cp GENERIC /root/kernels/CUSTKERNEL
Replace the name CUSTKERNEL with what ever name you want.
Then create a symbolic link to the file in the i386 directory.
Edit CUSTKERNEL as root, and remove all un-needed devices and options. You can use my CUSTKERNEL as a sample. Take heed to abide by the comments I have noted in that file. I will not be able to help you with this, as your machine and the hardware may be different from mine. You can always refer to the kernel configuration file when in doubt.
ln -s /root/kernels/CUSTKERNEL
Add the following lines to
/etc/rc.conf as root, to activate the firewall.
Create a new file
/etc/firewall.rules to place the firewall rules. You can copy mine (firewall.rules) and save it as
/etc/firewall.rules. Here are the rules:
Let’s copy the old working kernel to a new name. Just in case our new kernel does not boot, then we can boot from the old kernel.
#Check packets against the dynamic ruleset,deny all incoming connections, allow all outgoing connections
add 00300 check-state
add 00301 deny tcp from any to any in established
add 00302 allow tcp from any to any out setup keep-state
#Allow DNS lookup
add 00400 allow udp from any 53 to any in
add 00402 allow udp from any to any out
#Allow ICMP - Destination Unreachable
add 00500 allow icmp from any to any icmptypes 3
#Allow source quench in both directions
add 00501 allow icmp from any to any icmptypes 4
#Allow ping out but do not allow ping in
add 00502 allow icmp from any to any icmptypes 8 out
add 00503 allow icmp from any to any icmptypes 0 in
#Allow me to traceroute anyone
add 00504 allow icmp from any to any icmptypes 11 in
#Since I do not allow anyone to ping me back, no one can trace route me
Now let us build and install the kernel with the following three commands:
cp -Rv /boot/kernel/ /boot/kernel.working
make buildkernel KERNCONF=CUSTKERNEL
make installkernel KERNCONF=CUSTKERNEL
Remember to replace CUSTKERNEL with whatever name you gave your kernel configuration file.
Once the kernel is built and installed, reboot your machine to boot into the new kernel. Once your machine is up and running, open a terminal and execute the following command:
uname -a as a regular user. You will see output similar to the following:
This shows which kernel your system is using.
FreeBSD localhost.local 5.4-RELEASE-p5 FreeBSD 5.4-RELEASE-p5 #2: Fri Jul 22 09:36:32 UTC 2005 [email protected]:/usr/obj/usr/src/sys/CUSTKERNEL i386
Note: Just in case, your kernel does not boot, see this page for a solution.
Installing and customizing the BASH shell
Let us install the BASH shell that is easier to use. We will also do a few customizations and change the shells for both the regular user as well as root.
Download my script (bash-build) and save it in your scripts folder.
Make it executable (open a terminal, cd scripts, chmod +x bash-build) and execute it as root (su, enter root passwd and then ./bash-build). This will build and install bash and change the shell for the root user.
Now change the shell for the regular user. Open a terminal and execute the following command as root:
chsh -s /usr/local/bin/bash michael
michael with your regular user name in the above command.
For customizing BASH for a regular user, download my file (.bashrc) and save it in your home folder as .bashrc
If my scripts folder is
/home/michael/scripts, then my home folder is
For customizing BASH for root, download my file (.bashrc) and save it in
/root as .bashrc
Logout and login back again. Open a terminal and it should look like this. BASH is now installed and fully functional.
Installing linux compatibility
Now let us install the linux compatibility layer. This is needed for programs such as Skype, Real Player etc to work.
Download my script (linux-build) and save it to your scripts folder.
Make it executable (open a terminal, cd scripts, chmod +x linux-build) and execute it as root (su, enter root passwd and then ./linux-build). This will build and install linux compatibility for PC-BSD.
Next we are going to install Skype – the VOIP communications tool. Note that Skype requires linux compatibility, so install linux compatibiltiy first. (see above)
Download my script (skype-build) and save it to your scripts folder.
Make it executable (open a terminal, cd scripts, chmod +x skype-build) and execute it as root (su, enter root passwd and then ./skype-build). This will build and install Skype.
To start Skype, open a terminal and execute the command:
skype as a normal user. This will start Skype.
When you make a call, you will notice the following error:
This is due to mic boost alias igain not being enabled. My advice is to ignore this error. Skype works perfectly fine without this.If you do want to enable igain, be warned, that during a call, Skype will keep on fiddling with the igain setting making the call absolutely jarring. And to the folks at Skype, setting AGC to 0 in config.xml has no effect.
volume_adjust: SOUND_MIXER_WRITE_IGAIN failed: No such device or address
If you still want to enable igain, edit
/sys/dev/sound/pcm/ac97.c and look for the following line:
Change it to:
/* use igain for the mic 20dB boost */
Now re-compile the kernel with the following commands:
/* use igain for the mic 20dB boost */
cd /usr/src/Replace CUSTKERNEL with the name of your kernel configuration file. Once the kernel is built and installed, reboot to use the new kernel. Once the machine is up and running, open up sound mixer and you will see the igain control.
make buildkernel KERNCONF=CUSTKERNEL
make installkernel KERNCONF=CUSTKERNEL
Let us add Skype to the KDE menu under Internet.
Open the KDE menu editor (K -Settings – Menu Editor) and add Skype as shown.
To disable Skype from using ports 80 and 443 as alternatives, open Skype, then navigate to Tools – Options – Advanced and untick the “Use port 80 and 443 as alternatives for incoming connections” option. This is shown here.
To install java, navigate here, download the package corresponding to your FreeBSD version and then as root, execute the command: pkg_add [package name] to install it.
Update [12-May-2006]: Flash is no longer available for FreeBSD, thanks to Macromedia.
Update [26-Jun-2006]: Flash is again available thanks to the licensing issue being resolved. Thanks Macromedia.
We now build the browser that is taking over the world – Mozilla Firefox.
Download my script (firefox-build) to your scripts directory.
Make it executable (open a terminal, cd scripts, chmod +x firefox-build) and execute it as root (su, enter root passwd and then ./firefox-build). This will build and install firefox.
When the script executes, an options box with firefox build options will be displayed. Select XFT, OPTIMIZED CFLAGS and NEW TAB, then click OK.
Installing acrobat reader, real player and flash for firefox
To enhance our browsing experience, we install acrobat reader, real player and flash. Using these three, we can view a vast majority of online content.
Download my script (firefox-plugins-build) to your scripts directory.
Make it executable (open a terminal, cd scripts, chmod +x firefox-plugins-build) and execute it as root (su, enter root passwd and then ./firefox-plugins-build). This will build and install firefox plugins.
Let us add firefox to the KDE menu under Internet.
Open the KDE menu editor (K -Settings – Menu Editor) and add firefox as shown.
Let us wrap up part 1 of this guide by installing the crowning glory of all media players – mplayer.
Mplayer – the best of all media players out there plays virtually every media format known to mankind. So let us install this beauty.
Download my script (mplayer-build) to your scripts directory.
Make it executable (open a terminal, cd scripts, chmod +x mplayer-build) and execute it as root (su, enter root passwd and then ./mplayer-build). This will build and install mplayer along with a front end.
When the script executes, first an options box for sdl options will be displayed. Just select GL (support for open GL) and click OK.
Next the script will display an options box for choosing mplayer skins. Select whatever you fancy and click OK.
This script also builds the front end kplayer. Let us add kplayer to the KDE menu under Multimedia.
Open the KDE menu editor (K -Settings – Menu Editor) and add kplayer as shown.
This completes part 1 of the guide. Part 2 will cover Open Office, Amarok and other goodies. Stay tuned!!!
Written by Michael R.M. David.