How to install and configure a FreeBSD 8 Desktop with Xorg and KDE?
FreeBSD X
I realize that PC-BSD exists, but sometimes, you need only FreeBSD without PBIs and you want it to do it all yourself because that is why you came to FreeBSD in the first place; to be an expert user and be able to set everything up yourself.
Requirements for Success
To consider the desktop a success, the user should be able to do the following after installation:
- Have a graphical login screen.
- Auto-mount CD/DVD and USB drives.
- Connect a USB drive and read and write to it.
- Browse the web with Firefox.
- Create a document with Open Office.
- Play an mp3.
- Play a DVD
Step 1 – Download the DVD and burn it
- To download the DVD, go here: http://www.freebsd.org/where.html
- Click on your platform type. You are probably going to want i386 for a 32 bit computer or amd64 for a 64 bit computer.
- Select the DVD and download it.
- Extract it as it is compressed into a zip file. Use gunzip on FreeBSD or 7zip on Windows.
- Use your favorite burning software to burn the ISO to disk.
Step 2 – Install FreeBSD and include Xorg and KDE4 as additional install packages.
- Insert the installation media and boot off it. Wait for it to boot.
- First select your Country.
- At Sysinstall’s Main Menu, choose Standard.
- Read the next screen and hit OK.
- Press A to select Use entire disk.
- Press Q to Finish.
- For the Boot Manager choose Standard and hit OK.
- Read the next screen and hit OK.
- Press A to select Auto Defaults.
- Press Q to Finish.
- For Distributions select Custom. (Don’t worry, the Custom is not that hard) and select the following distributions:
Required – You must have the base system and a kernel.- base
- kernels | GENERIC
Optional – You don’t have to select these but I am selecting them.
- dict
- doc | en (or you language).
- games
- man
- src | All (Optional, if you plan on having the source so you can work on it an contribute some work back to FreeBSD.)
- ports
- To get back to the Choose Distributions screen, either select Exit or OK.
- Hit OK to continue.
- At the Choose Installation Media screen choose CD/DVD.
- Read the next screen and choose Yes.
- Wait for the installations to complete.
- Read the Success screen and hit OK.
- Choose Yes to configuring an Ethernet network device.
- Select you network card type and hit OK. It is usually the top entry. Mine is em0.
- (Optional) You may want to say Yes to configure IPv6 these days. All my machines at home support IPv6 now since they are FreeBSD and Windows 7.
It will try to detect a server, but probably won’t find one, that is just fine. - Choose Yes to try DHCP. Assuming you have a DHCP server (any corporate network or home with an internet connection and router has one).
The network configuration screen will open with your IP Address. - Enter a computer name in the Host field.
- Choose No when prompted if you want the machine to function as a network gateway.
- Choose No when prompted if you want the machine to configure inetd.
- When prompted to enable SSH, choose Yes if you are going to connect via SSH remotely. Choose No otherwise. I am choosing Yes because I always find a reason to SSH in.
- Choose No to have anonymous FTP access to this machine.
- Choose No to for configuring this as an NFS server.
- Choose No to for configuring this as an NFS client (unless it is going to be and if it is going to be, you would no).
- Choose No to customizing the system console settings.
- Choose Yes to set the machines time zone now.
- Choose No when asked if the CMOS clock is set to UTC (unless you know for sure 100% that it is).
- Choose your Region.
- Choose your Country.
- Choose your Time Zone.
- If prompted if your Time Zone looks reasonable, choose Yes.
- When prompted if you have a PS/2, serial, or bus Mouse you need to understand that a mouse if almost always only PS2 or USB anymore. If USB choose No, otherwise choose Yes.
If you choose Yes, then enable your mouse, test it and then exit that screen. - Choose Yes when prompted about the FreeBSD Package collection and if you want to browse it now as this is where we are going to install Xorg and KDE.
- On the Package Selection screen, scroll down X11 and hit OK.
- On the X11 screen, scroll down and select KDE4. Notice that a lot of other packages are auto-selected as dependencies. This is normal.
- Continue scrolling down and select xorg-7.
- Now click Ok.
- You may want other packages such as bash. Choose them now.
- Choose Install and you will see the Package Targets screen. It will only list the packages your selected, not all the dependencies, but don’t worry, all the dependencies will install.
- Choose Ok.
- Wait for the installation of the packages to complete.
- When prompted for adding initial user accounts, choose Yes.
- On the User and Group Management Screen choose User and hit OK.
- Enter a user name under the Login ID field.
- Leave UID and GROUP as is.
- Enter a password and confirm the password.
- Enter your full name.
- In the Member Groups add these groups (without a space, only separated by a comma): wheel,operator
- Leave home directory as is.
- Leave the login shell as is. (Unless you installed bash and want to use it, then you can change it to /usr/local/bin/bash).
- Hit OK.
- Back at the User and group management screen choose Exit and hit OK. Feel free to add as many users as you need first, but don’t worry you can add more later.
- Read the next screen and hit OK, it is just an informational screen about the fact that you must set a root password.
- Enter the root password and hit enter and then enter it again and hit enter to confirm the password.
- When prompted to visit the configuration menu for a chance to set any last options, choose No.
- You are back at the Sysinstall Main Menu. Select Exit Install.
- When asked if you are sure you wish to exit, choose Yes.
- Read the next screen, and hit OK.
- Whilst rebooting, remove your DVD from the drive so you don’t boot off it (assuming it is first in your boot order otherwise you may not need to do this).
FreeBSD 8 is now installed with all the software needed to make a nice FreeBSD 8 Desktop, Xorg-7 and KDE4. However, there are a few more steps to get Xorg-7 and KDE4 configured.
Step 3 – Patch your new system
Update and patch your system. I already have steps to do this here:
What are the first commands I run after installing FreeBSD
Important: While the ports tree is already installed, don’t skip this step. Updating the ports tree is how you get the latest versions.
Step 4 – Configure Xorg Dependencies
- Login to the newly installed system with the username and password you created. Make sure you use the account that you added to the wheel and operators group.
- Once logged in, su to root by simply typing this command:
$ su - After typing su, you will be prompted for a password. Enter the root password.
- You now logged in as root. Your prompt should have changed from a $ to a NAME#. For example, I named my system FBSD8 so my prompt looks as follows:
FBSD# - Add dbus to /etc/rc.conf. Either use easy editor, or use the following shell command to add it without using and editor.
FBSD# echo ‘dbus_enable=”YES”‘ >> /etc/rc.conf - Enable dbus with this command.
FBSD# /usr/local/etc/rc.d/dbus start - Add hald to /etc/rc.conf. Either use easy editor, or use the following shell command to add it without using and editor.
FBSD# echo ‘hald_enable=”YES”‘ >> /etc/rc.conf - Enable hald with this command.
FBSD# /usr/local/etc/rc.d/hald start - Reboot by running this command:
FBSD# reboot Note: It is also common to reboot using this command: (It doesn’t matter which command you use to reboot.)
FBSD# init 6 - Once rebooted, log back in and su to root again.
Step 5 – Configure Xorg
Note 1: 1 and 2 are optional and you may skip them if you want. An xorg.conf file is not longer required. Usually most configurations work without it.
Note 2: If you are using VMWare, you may want to jump to this article and come back: How to install VMWare-tools on FreeBSD 8?
- Have Xorg automatically create an xorg.conf file using this command:
FBSD# Xorg -configure /root/xorg.conf.new -retro - Copy the xorg.conf.new to /etc/X11/xorg.conf
FBSD# cp /root/xorg.conf.new /etc/X11/xorg.conf - Type exit to logout as root. You should go back to the $ prompt.
- Create a file called .xinitrc in the users home directory. This file will contain one line.
$ echo exec /usr/local/kde4/bin/startkde4 > ~/.xinitrc - Run startx to launch Xorg-7 and KDE4.
$ startx Note: If something goes wrong here, your xorg.conf may not have been generated correctly. Reboot (you may have to hit the power button or SSH in to reboot as you may not have console access anymore).
Xorg-7 and KDE4 should now be working.
Step 6 – Enable KDM (Optional) on FreeBSD
Instead of having to login in at a command prompt and run startx, you may prefer a GUI login screen. This can be done very easily with KDM. There is an old way and a new way. Just in case the new way isn’t available to you for some reason, I will leave both methods. Do NOT use both of them.
The new way.
- Add the following lines to /etc/rc.conf. Either use easy editor, or use the following shell command to add it without using and editor.
FBSD#
FBSD#echo ‘local_startup=”${local_startup} /usr/local/kde4/etc/rc.d”‘ >> /etc/rc.conf
echo ‘kdm4_enable=”YES”‘ >> /etc/rc.conf - Start kdm
The old way.
- If you are still in KDE, logout. Click the blue K icon at the bottom left of your screen and you can select Leave | Logout to exit KDE.
- Use su to login as root as you have done before.
- Open the following file with your favorite editor: /etc/ttys. I use Easy Editor or ee.
FBSD# ee /etc/ttys - Find the following line: (In ee, Page Down three times almost takes me right to this line.)
ttyv8 “/usr/local/bin/xdm -nodaemon” xterm off secure
- Replace that line with this line:
ttyv8 “/usr/X11R6/kde4/bin/kdm” xterm on secure
- Reboot to have the virtual consoles restart. (or make sure Xorg and KDE are not running and run: kill -HUP 1)
KDM should now be working and your system should reboot to a graphic login screen, which is handled by kdm.
Step 7 – Enable CD/DVD/USB mounting
FreeBSD is more secure by default, so something as simple as accessing a CD or DVD or USB drive is not actually allowed by default. You have enable this.
These steps assume that your user is a member of the operator group. Remember above during the installation, I mentioned to make your user a member of both the wheel and operator groups.
- Access a shell and su to root.
Note: The easiest shell to access now that you are in KDE is Konsole. To access Konsole, click the K and go to Applications | System | Terminal. Also you can add the shell icon to your panel by right-clicking on the icon and choosing Add to Panel. - Enable vfs.usermount.
FBSD# sysctl -w vfs.usermount=1 - Configure vfs.usermount to be enabled on boot.
FBSD# echo vfs.usermount=1 >> /etc/sysctl.conf - Open the following file with an editor: /etc/devfs.conf
FBSD# ee /etc/devfs.conf - Add the following lines:
# Commonly used by many ports
link acd0 cdrom
link acd0 dvd# Allow all users to access CD’s
perm /dev/acd0 0666
perm /dev/acd1 0666
perm /dev/cd0 0666
perm /dev/cd1 0666# Allow all USB Devices to be mounted
perm /dev/da0 0666
perm /dev/da1 0666
perm /dev/da2 0666
perm /dev/da3 0666
perm /dev/da4 0666# Misc other devices
perm /dev/pass0 0666
perm /dev/xpt0 0666
perm /dev/agpart 0666
perm /dev/uscanner0 0666Note: Yes, I copied these from a PC-BSD install’s version of this file.
Note: Change to 0660 to only allow users in the operator group to mount drives.
- Also you need a devfs.rules file. Lets create one.
FBSD# ee /etc/devfs.rules - Add the following lines.
[Removable_Media]
add path ‘ad*’ mode 666 group operator
add path ‘acd*’ mode 666 group operator
add path ‘cd*’ mode 666 group operator
add path ‘pass*’ mode 666 group operator
add path ‘xpt*’ mode 666 group operator
add path ‘ugen*’ mode 666 group operator
add path ‘usb*’ mode 666 group operator
add path ‘lpt*’ mode 666 group cups
add path ‘ulpt*’ mode 666 group cups
add path ‘unlpt*’ mode 666 group cups
add path ‘fd*’ mode 666 group operatorNote: Again, I copied these from PC-BSD.
- Tell /etc/rc.conf about the rules section in /etc/devfs.rules
FBSD# echo ‘devfs_system_ruleset=”Removable_Media”‘ >> /etc/rc.conf - Edit the following file: /usr/local/etc/PolicyKit/PolicyKit.conf
FBSD# ee /usr/local/etc/PolicyKit/PolicyKit.conf - Change the xml’s config section from this…
<config version="0.1"> <match user="root"> <return result="yes"/> </match> <define_admin_auth group="wheel"/> </config>
…to this:
<config version="0.1"> <define_admin_auth group="operator"/> <match action="org.freedesktop.hal.storage.mount-removable"> <return result="yes"/> </match> <match action="org.freedesktop.hal.storage.mount-fixed"> <return result="yes"/> </match> <match action="org.freedesktop.hal.storage.eject"> <return result="yes"/> </match> </config>
Note: Yes, again, I copied this straight from PC-BSD’s PolicyKit.conf.
- Edit the following file with ee: ee /etc/fstab
FBSD# ee /etc/fstab - Comment out or remove the line for your /cdrom. I usually just comment it out by adding a # sign as shown:
#/dev/acd0 /cdrom cd9660 ro,noauto 0 0
- Restart the computer.
You should now be able to mount CD, DVD, and USB drives. You also should be able to both read and write to them, burn disks, write and format USB drives, etc…
Step 8 – Enable your sound card
I already have an article on this here and it is so very simple.
How to enable sound in FreeBSD 8?
Step 9 – Install Software
We are going to install the following software:
- Firefox
- Open Office
- K3b
Binary Packages
- To browse the precompiled package lists, open a web browser to here:
ftp://ftp.freebsd.org/pub/FreeBSD/ports//packages-8.0-release/Latest/My architecture is amd64 so the URL I use is this:
ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.0-release/Latest/Hint: Some time in the future you may be on a different version or architecture. If you run this command, it will fail and the output may show you where to go.
FBSD# pkg_add -r DoesNotExist
Firefox
- Access a shell and su to root as software should be installed as root.
- FreeBSD has a binary package for Firefox, so to install it you only have to run one command:
FBSD# pkg_add -r firefox35 - Firefox 3.5 installation notes recommend adding a line to /boot/loader.conf, so use ee and add this line:
sem_load=”YES”
Firefox is now installed.
Open Office
Note: Here I describe installing using ports, but there may be a package available. Read this post: http://forums.freebsd.org/showthread.php?t=8639
- Access a shell and su to root as software should be installed as root.
- To install Open Office, run the following commands:
Note: There is not package as of this moment, so we have to compile from ports and this takes longer. You can check for a package if you want as there may be one sometime after I write this document.)FBSD#
FBSD#cd /usr/ports/editors/openoffice.org
make install - Wait…and wait…and wait…and wait…
- Ok, when it fails because you have to manually download some items for java, read and follow the instructions:
IMPORTANT: To build the JDK 1.6.0 port, you should have at least
2.5Gb of free disk space in the build area!Due to licensing restrictions, certain files must be fetched manually.
Please download the Update 3 Source from http://www.java.net/download/jdk6/6u3/promoted/b05/jdk-6u3-fcs-src-b05-jrl-24_sep_2007.jar and the Source Binaries from http://www.java.net/download/jdk6/6u3/promoted/b05/jdk-6u3-fcs-bin-b05-jrl-24_sep_2007.jar and the Mozilla Headers from http://www.java.net/download/jdk6/6u3/promoted/b05/jdk-6u3-fcs-mozilla_headers-b05-unix-24_sep_2007.jar.
Please open http://java.sun.com/javase/downloads/index.jsp in a web browser and follow the “Download” link for “JDK US DST Timezone Update Tool – 1_3_21” to obtain the time zone update file, tzupdater-1_3_21-2009p.zip.
Please download the patchset, bsd-jdk16-patches-4.tar.bz2, from http://www.eyesbeyond.com/freebsddom/java/jdk16.html.
Please place the downloaded file(s) in /usr/ports/distfiles and restart the build.
- While you are at it, get the file from this prompt as well. I am not sure why it is not in the same prompt above, but it isn’t.
Because of licensing restrictions, you must fetch the distribution manually.
Please access http://www.FreeBSDFoundation.org/cgi-bin/download?download=diablo-caffe-freebsd7-amd64-1.6.0_07-b02.tar.bz2 with a web browser and “Accept” the End User License Agreement for “Caffe Diablo 1.6.0”.
Please place the downloaded file(s) in /usr/ports/distfiles.
- Make sure you followed the instructions, download the files, and placed them in /usr/ports/distfiles. Restart the build using the same command you ran before. If you didn’t know, you can probably press the up arrow on your keyboard to see command history so you don’t have to type it again.
- You will shortly be prompted with a license agreement. Please read ever word, pressing the space bar to scroll until the end, before typing yes.
- Now wait some more as Open Office and its dependencies continue compiling.
- No you haven’t waited long enough.
- Ok…no just kidding, wait a little more.
- No really. It takes a long time to compile Open Office so leave it running and skip to the next step.
When it is done, you will be able to write documents that are compatible with MS Office.
K3b
- Access a shell and su to root as software should be installed as root.
- FreeBSD has a binary package for K3b, so to install it you only have to run one command:
FBSD# pkg_add -r k3b - There are a lot of notes about postinstallation steps, so burning a CD is going to be for another day and another document.
Playing MP3s
As for paying I can play MP3s with juK the KDE4 Music player that is installed by default with KDE4.
You should now have the idea and can go installing software that you want.
Playing a DVD
Dragon Player didn’t play the a DVD for me. So I installed kmplayer-kde4. It didn’t play the DVD either. I installed Xine and it worked.
Keywords: FreeBSD X
Copyright ® Rhyous.com – Linking to this article is allowed without permission and as many as ten lines of this article can be used along with this link. Any other use of this article is allowed only by permission of Rhyous.com.