[howto] Minimal FreeBSD desktop

Table of contents
---[ Intro
---[ Desktop usage on FreeBSD
---[ Objective
---[ Getting started - ports and packages
---[ Xorg and basic desktop

------[ Xorg
------[ Window manager
------[ Panel
------[ Launching applications
------[ Setting wallpaper and viewing images
------[ Terminal emulator
------[ Auto mounting
------[ Starting X

---[ Userland applications
------[ Browser
------[ Editor/IDE
------[ File Manager
------[ Video and audio player
------[ PDF Reader
------[ Torrent client
------[ Wireless network manager
------[ Network file sharing
------[ VirtualBox

---[ Misc
---[ Outro



---[ Intro

Three years back I was starting to become seriously unhappy with Windows and started to look for an alternative. My biggest problems were the fact that I did not have full control over my OS, closed source philosophy and "millions" of applications/libraries I did not want to have on my system.

The choice came down to FreeBSD and GNU/Linux. After browsing the Internet for a weak or so I decided to go with FreeBSD because I wanted a UNIX system and back then FreeBSD seemed to be "more of a pure UNIX" then Linux.

Nowadays I use FreeBSD because of these reasons:

  • FreeBSD flows the UNIX philosophy: "Write programs that do one thing and do it well"
  • FreeBSD is almost fully POSIX compliant
  • FreeBSD code is clean
  • FreeBSD Handbook
  • FreeBSD gets the job done.
  • FreeBSD is virus free.
  • BSD license
...and so much more but these are the highlights.

The focus of this "howto" is desktop usage on FreeBSD but I would just like to say that three years back FreeBSD was an "alternative" for me and now everything else is the "alternative".
Also I would like to say thanks to FreeBSD developers for creating such a beautiful piece of software.

---[ Desktop usage on FreeBSD

After deciding that FreeBSD was going to be my new primary OS the question was "how to set it up for desktop usage?". FreeBSD handbook helped me with this a lot in the beginning. But if you follow the handbook you will probably end up with GNOME or KDE desktop environment and this "how to" is about minimal but functional desktop on FreeBSD.

Fact is that FreeBSD is more than capable of being a desktop OS the only question is what are your own preferences/requests. Mine were: minimalism, functionality, speed, low memory footprint and avoiding linuxisms.

In general, if you want to use FreeBSD as a desktop you have two ways of doing that:

1) installing a desktop environment (DE) like x11/gnome2, x11/kde4, x11-wm/xfce4, x11-wm/enlightenment , x11/lxde-meta

I have been down this road when I first started and I was not happy. I ended up with the same problem I had on Windows. Bunch of applications I did not use, high memory footprint , eye candy that has no functionality apart from eating memory for no good reason, etc.

I have actually tried all of these ports and the only one that comes into consideration IMHO, as far as minimalism goes, is x11/lxde-meta. But this "how to" is not about DE so I will not go any further into this option.

2) building your desktop from ground up with ports your only want

Now we are in business. IMHO this path is the "true" path because you will have a fully functional desktop set up the way YOU want it and you will gain so much experience and knowledge that would be simply skipped with the first path.

Do not get me wrong, althoughgh this is the "true" path it is not the easy one. It took me a lot of time to figure things out and to set up my desktop just the way I want it. I have installed and reinstalled FreeBSD so many times because I was experimenting with different ports. Now I have a shell script that installs and sets up my desktop with almost zero human interaction.

This "how to" is so that you would not need to experiment as much as I did (but you will have to experiment to a certain degree). I will present my findings over the years, ports I have settled on and alternatives to thees ports, useful readings and so on. By the end of this "howto" a FreeBSD newcomer should get the general idea of what it means and what is necessary to set up a desktop from grand up.

I will assume that you have in fact successfully installed FreeBSD and you just logged in for the first time with you user name.

If you are looking for some help on how to install FreeBSD refer to the handbook's section Installing FreeBSD 9.X and Later.

Reading the whole Getting Started section in the handbook is a MUST and I will assume that you have read it. Do not install anything but read it.

---[ Objective

Apart from preferences I have mentioned before we will try to avoid as much as possible the following things:


and depending on your choices for certain ports it is possible to build a "pure CLI" desktop without x11-toolkits/gtk20 or devel/qt4.

At the end we will be able to:

  • browse the internet
  • manage our files and folders with a file manager
  • edit our files with an editor
  • play movies and music
  • download torrents
  • auto mount USB drives (including NTFS formatted drives with read/write operations)
  • read pdf files
  • view images
  • manage our wireless connection
  • share files with FreeBSD/Linux/Windows
  • emulate another OS for anything else we do not want to/can not have on our FreeBSD system but is needed.

What more do you need, eh? :)

---[ Getting started - ports and packages

Assuming you have read the handbook's section on ports and packages I am just going to say that we are going to use ports and compile everything from source. Reason is that we need to be able to "turn off" features and that can not be accomplished via packages since they are precompiled.

Before anything we need to update our ports tree so run this commands if you don't have the ports tree installed:

# portsnap fetch
# portsnap extract
# portsnap update

run this command later on when you wish to update the installed ports tree:

# portsnap fetch update

Now we need to decide how are we going to manage our ports. ports-mgmt/portmaster is a great tool that dose not require external databases or languages so we will use that.

Install the port:

# cd /usr/ports/ports-mgmt/portmaster/ && make install clean

Sample configuration file for portmaster si located at /usr/local/etc/portmaster.rc.sample. Copy it to /usr/local/etc/portmaster.rc and set the options you like:

# cp /usr/local/etc/portmaster.rc.sample /usr/local/etc/portmaster.rc
# ee /usr/local/etc/portmaster.rc

ee(1) stands for "easy editor" and comes with FreeBSD. It is very simple to use and perfect for editing configuration files form command line. Another option would be VI(1) if you are familiar with it.

I have enabled thees options but for more information you can refer to the man page PORTMASTER(8)
 
Last edited:
Code:
# Always delete stale distfiles without prompting (-d)
ALWAYS_SCRUB_DISTFILES=dopt
# Be verbose (-v)
PM_VERBOSE=vopt
# Install packages for build-only dependencies (--packages-build)
PM_PACKAGES_BUILD=pmp_build
# Delete build-only dependencies when finished (--delete-build-only)
PM_DEL_BUILD_ONLY=pm_dbo
#Suppress the build confirmation message (--no-confirm)
PM_NO_CONFIRM=pm_no_confirm

From now on we will use portmaster for managing ports.

And here are some commands you might find useful:

Code:
upadate all ports:

	portmaster -a 
	force:
		portmaster -af
	
search for updates and list all installed ports by category:
		
	portmaster -L
	portmaster -L | grep "New version available:"
		
clean stale distfiles:

	portmaster --clean-distfiles
	with out promt:
		portmaster --clean-distfiles-all
	
uninstall the port and it's dependencies:
	
	portmaster -e target_port

rebuild the specified port, and all ports that depend on it:
	
	portmaster -r target_port

---[ Xorg and basic desktop

Xorg

x11/xorg is a meta port for all the X.Org ports but we will install just the ones we need. You could just install the meta port and it would not make much of a difference but I like perfection so things like this get to me :). There is also x11/xorg-minimal and you can also use that too instead of compiling individual ports.

First install x11-servers/xorg-server:

# portmaster x11-servers/xorg-server

Important: disable HAL option!

sysutils/hal is usually used for auto mounting but we will use FreeBSD's DEVD(8) since hal is linuxisms.

Also disable hal in all other ports that might have HAL option.

Next install x11-drivers/xorg-drivers for mouse, keyboard and your video card:

# portmaster x11-drivers/xorg-drivers

Make sure MOUSE and KEYBOARD options are selected and select the video driver for your video card. You might also want to select VESA option just in case. Disable every thing else.
If you have an nvidia card use this port for video drivers instead of Xorg's: x11/nvidia-driver. But make sure you disable LINUX option for this port and all others that might have such an option.

Next install x11/xinit, x11/xauth, x11-fonts/xorg-fonts and x11-fonts/webfonts

# portmaster x11/xinit
# portmaster x11/xauth
# portmaster x11-fonts/xorg-fonts
# portmaster x11-fonts/webfonts

Next we need to configure Xorg so run this command:

# Xorg -configure

This will create a new configuration file which needs to be copied to Xorg folder:

# cp /root/xorg.conf.new /etc/X11/xorg.conf

Edit the file to set your keyboard layout and resolution. For keyboard layout add " Option "XkbLayout" "<your_layout>" " line to "InputDevice" section:

Code:
Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
Option "XkbLayout" "hr"
EndSection

And for resolution add "Modes "1366x768"" line to "Screen" section. If you have multiple depth's just delete them and leave the "Depth 24".

Code:
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1366x768"
EndSubSection
EndSection

If you are using nvidia-driver install x11/nvidia-xconfig:

# portmaster x11/nvidia-xconfig

and run:

# nvidia-xconfig
# echo "nvidia_load=\"YES\"" >> /boot/loader.conf

This will create a new xorg.conf file or edit an existing one. The second command will load nvidia-driver kernel module at start up.

And finally enable MOUSED(8) for mouse support.

# echo "moused_port=\"/dev/psm0\"" >> /etc/rc.conf
# echo "moused_enable=\"YES\"" >> /etc/rc.conf

We could now reboot and start our first Xorg session but there is not much of a point since we do not have anything else installed so we are proceeding to window managers.

Window manager

This is where experimenting starts. There are many window managers (WM) and finding the one that suits your needs can be time consuming. I will list the ones that are most commonly used and how to setup the one I personally use.

The first window manager I tred was x11-wm/fluxbox but swiched to x11-wm/openbox because openbox is written in C where fluxbox is written in C++ and because with openbox you just get a window manager where with fluxbox you get a window manager and a built in panel which I did not like. Openbox is configured via xml syntax which might be a little confusing but once you configure it you most likely won't need to change it ever again.

If you do not like openbox there are plenty of other windows managers out there. I will list here the ones that people seam to be using the most but trust me there are PLENTY of others.

Here is a list of most common ones:

Now lets setup the one I use and that would be x11-wm/openbox.

First install the port:

# portmaster x11-wm/openbox

Next is configuration (make sure you are not executing thees commands as root):

$ mkdir ~/.config
$ mkdir ~/.config/openbox
$ cp /usr/local/etc/xdg/openbox/menu.xml ~/.config/openbox/menu.xml
$ cp /usr/local/etc/xdg/openbox/rc.xml ~/.config/openbox/rc.xml
$ touch ~/.config/openbox/autostart.sh && chmod +x ~/.config/openbox/autostart.sh
$ echo "#!/bin/sh" >> ~/.config/openbox/autostart.sh

This will create the openbox configuration folder for your account and copy configuration files to it.
~/.config/openbox/autostart.sh is a script that will be executed every time you start openbox.
~/.config/openbox/menu.xml is the configuration file for openbox menu which will be visible when you press the right mouse button on the desktop.
~/.config/openbox/rc.xml is the configuration file for openbox itself.

For now we will leave it at default settings but further information on configuring openbox can be found here.

Finlay we need to tell Xorg to use openbox:

$ echo "exec openbox-session" >> ~/.xinitrc

Panel

The window manager will take care of our windows but we need some place to hold them when we minimize our windows and I will present two panels. One depends on gtk and the other one dose not.

First one is x11/tint and it depends on gtk.

Install the port (and make sure you disable PYCONF option):

# portmaster x11/tint

Configuration:

$ echo "(sleep 2 && tint2) &" >> ~/.config/openbox/autostart.sh
$ mkdir ~/.config/tint2
$ cp /usr/local/share/examples/tint2/tint2rc ~/.config/tint2/tint2rc

This will launch tint when openbox starts and copy the example configuration file to home directory. Later on you can edit that file to suit your needs. How to do that is explained here.

If you are using openbox find these lines in the ~/.config/openbox/rc.xml file:

Code:
<margins>
<top>0</top>
<bottom>30</bottom>
<left>0</left>
<right>0</right>
</margins>

Bottom height should be the same as tint's height, not 0. This will prevent windows to overlap tint when maximized.

Second one is deskutils/pypanel and it dose not depend on gtk nor qt.

Install the port:

# portmaster deskutils/pypanel

Configuration:

$ echo "(sleep 2 && pypanel) &" >> ~/.config/openbox/autostart.sh

This will launch pypanel when openbox starts and the first time pypanel is launched it will create a default configuration file ~/.pypanelrc. Later on you can edit that file to suit your needs. The configuration file is well commented and configuration is fairly straightforward.

You might want to change the button event handler a little bit, though.

Find this lines:
Code:
if button == 1:
pp.taskFocus(task)

and put this:
Code:
if button == 1:
pp.taskFocus(task)
pp.taskFocus(task)

this will maximize the window and put focus on it with one mouse click.
 
Launching applications

We already have the possibility of launching applications via openbox's menu but I like to use a quick launch bar for this task. x11/wbar is a light quick launch bar and looks really slick. It depends on gtk though, so you might want to skip this part and configure ~/.config/openbox/menu.xml file for quick launch. Also pypanel has a built in appliation launcher.

Install the port (and make sure you disable WBARCONFIG option):

# portmaster x11/wbar

Configuration:

Start wbar on openbox startup:

$ echo "(sleep 2 && wbar) &" >> ~/.config/openbox/autostart.sh

This will launch wbar when openbox starts and the first time wbar is launched it will create a default configuration file ~/.wbar. Later on you can edit that file to suit your needs. Configuration is fairly straightforward. You just have to specify the path to icon, command and text to be displayed.

Example:
Code:
i: /usr/local/share/pixmaps/wbar/terminal.png
c: urxvtc 
t: urxvtc

i: /usr/local/share/pixmaps/wbar/music.png
c: urxvt -e mplayer -playlist ~/tera1/Music/RadioStream/soulful.pls
t: soulful

A nice trick with launching terminal based applications is the terminals "-e" option. With it you can launch a terminal window and make it to immediately run a command specified behind the "-e" switch. That way you don't have to first launch the terminal and then type in the command.

Setting wallpaper and viewing images

For viewing images I have chosen graphics/feh and we can use it to set wallpaper to, which is neat.

Install the port:

# portmaster graphics/feh

Configuration:

$ echo "feh --bg-scale ~/path/to/wallpaper.jpg &" >> ~/.config/openbox/autostart.sh

This will set the wallpaper each time you start openbox. You probably don't have any pictures yet on your system so you can FETCH(1) this nice FreeBSD wallpaper and set it up.

$ cd ~/.config/openbox/
$ fetch [url]http://www.bsdnexus.com/wallpapers/DD_freebsd.jpg[/url]
$ echo "feh --bg-scale DD_freebsd.jpg &" >> autostart.sh

And if you want to view images just run feh form the command line and make sure you are positioned in the folder you want to view images:

$ feh -t

Extra reading can be found here.

Terminal emulator

Choosing the right terminal emulator is really important since you will be spending a lot of time using it. So you want to choose the one you are comfortable with. I will list the ones I have tried, reasons why I switched to another one and explain how to setup the one I settled with.

These are the one I have tried:

x11/rxvt-unicode is realy neat. It supports tabs via perl extension, stores text in unicode, has transparency if you want that slick look, configurable via ~/.Xdefaults file, lightweight, fast, deamon/client mod and most importantly it just works.

So if you want to try x11/rxvt-unicode here s how you set it up.

Install the port (default options are ok):

# portmaster x11/rxvt-unicode

Configuration:

Configuration is done via ~/.Xdefaults. Here is a nice reading on how to configure it.

I personally like the solarized colors so I have adapted this ~/.Xdefaults and and modified it to my needs.

I suggest running urxvt in deamon/client mode for faster performance and lower memoy footprint so run urxvtd at startup:

$ echo "urxvtd -q -f -o" >> ~/.config/openbox/autostart.sh

and then use:

$ urxvtc.

You can copy/paste via middle mouse button. Just select the text in terminal or other application and it will be "copied". To paste it, either to terminal or other application, press the middle button or both left and right mouse buttons simultaneously if you don't have a middle button.

A better solution is a perl plugin you can found here. You will need x11/xclip for it to work and the path for urxvt perl plugins on FreeBSD is /usr/local/lib/urxvt/perl/. How to set it up is described at the provided link.

If you don't want to use tabs to have multiple terminals in one window, take a look at sysutils/tmux which is a terminal multiplexer.

Auto mounting

As mentioned before we will not use hal but FreeBSD's DEVD(8) wich stand for "device state change daemon".

There is a script that wrapps around DEVD(8) and dose the mounting for us: sysutils/automount.

Install the port:

# portmaster sysutils/automount

Configuration is done via /usr/local/etc/automount.conf and you can run this command to see what options you have:

$ automount --help

I just use this option in my /usr/local/etc/automount.conf file:
Code:
REMOVEDIRS="YES"

If you want to mount NTFS formatted drives with read/write operations you will need to install sysutils/fusefs-ntfs.

Install the port:

# portmaster sysutils/fusefs-ntfs

Configuration:

# cp /usr/local/modules/fuse.ko /boot/modules/
# echo "fuse_load=\"YES\"" >> /boot/loader.conf

This will load the kernel module on start up and automount will recognise that you have installed fusefs-ntfs and will use it for NTFS formatted drives.

If you want to auto mount a IDE/SATA hard drive connected to your mother board check this thread out.

In case you are wondering how to use it by hand here is the command you can issue to mount NTFS drives:

# ntfs-3g /dev/da*s1 /mnt

Run this command to find out what number to repalce "*" with:

# dmesg

Starting X

Now we should be ready to start our first Xorg session. But first lets reboot the system:

# shutdown -r now

If you want to power down use this command:

# shutdown -p now

And if you want to be able to reboot or power down from openbox without being root you should add your user name to the operator group:

# pw groupmod operator -m user_name

Before we actually start Xorg make sure you can run your terminal emulator either from wbar or from openbox's menu! By now you should be able to know how to do that.

Once you have logged in with your user name run this command to start Xorg:

$ startx

If everything went well and you have chosen to use openbox with tint and wbar you should be seeing something like this:



If you are not seeing something like this that means something went wrong and you will have to fix the problems you have. My suggestion is to FIRST search google for answers and if that dose not work THEN post here for help.
 
---[ Userland applications

Now we will proceed to common applications used by a desktop user. And we will start with a browser.

Browser

By now you should know how to install ports so I will stop posting the install command. Also I hope you are able to run your virtual terminal from Xorg :).

Back to our browser. There is realy only one option IF you want to avoid gtk and qt which would be www/opera. VIDEO option is enabled by default and leave it at that if you want HTML5 video support. With it you will be able to view, currently, some YouTube videos.

With opera we can avoid gtk and qt but opera dose not really follow the "do one thing and do it well" philosophy. Do not get me wrong I use opera and it's great. They release a package for FreeBSD systems and really care about FreeBSD users. But comes with a built in email client, torrent client, etc.

Flash is currently supported on FreeBSD via Linux kernel module and we are trying to avoiding linuxisms remember :). In my opinion HTML5 will overcome Flash so I'm sticking with opera and HTML5. But here is how you do it if Flash is a "deal breaker".

Another solution for Flash would be www/youtube_dl. You can use this simple script to stream YouTube (and other popular video streaming sites like Vimeo) videos (requiers mplayer but we will get to that):

Code:
#!/bin/sh
#usage: ./this_script.sh "url"

COOKIE_FILE=/var/tmp/youtube-dl-cookies.txt
mplayer -cookies -cookies-file ${COOKIE_FILE} $(youtube-dl -g --cookies ${COOKIE_FILE} $*)

Use this command to download the video:

$ youtube-dl "http://www.youtube.com/watch?v={video_id}

Other popular browser like www/firefox, www/chromium, www/seamonkey are also available.

If you don't care about gtk that much and want minimalism with security I would suggest you check out www/xombrero.

And if you don't care about JavaScript check out www/links and www/dillo2. You can run links in a terminal or if you enabled X11 option you can run it like this:

$ links -g

Editor/IDE

Ah editor...such an important segment on UNIX like systems. For me it comes down to two options. One depends on gtk and the other one dose not.

First is devel/geany and I absolutely love it. It's actually a small IDE and I use it for all of my programming projects. The other one is editors/vim and it's THE editor among UNIX like systems. Vim is console based and once you learn , yes learn, how to use it it can become a very powerful tool/editor/IDE.

If you are going to try vim and you don't want the gtk front end called gvim make sure you pass this to make:

Code:
WITH_X11_ONLY=YES

this will compile vim with out the gui front end but will enable some other useful X11 features like the clipboard so you can copy/paste from other windows.

example for portmaster:

# portmaster -m WITH_X11_ONLY=YES editors/vim

Configuration file is ~/.vimrc. Browse the Internet on how to setup vim but I suggest you start with this example vimrc file.

I myself am in the process of completely switching to vim but I got so used to geany that it's not such a simple task.

I guess I should mention editors/emacs, but that is all I'm going to do.

File Manager

For a X11 based fm I suggest x11-fm/xfe. It dose not depend on gtk nor qt and it's awsome!

For a console based file manager I suggest misc/mc. You will have to get used to it, though.

Another option is to simply use your virtual terminal for file managing. This is what I do and I got quite used to it. Most of the time you just use cd, cp, rm, mv and mkdir commands anyway. And with a shell like shells/zsh and auto completion you can manage your files quite fast.

Video and audio player

For playing video multimedia/mplayer, IMHO, is the authority among UNIX like systems. If you don't want a gtk front end make sure you disable the GUI option.

To play video with mplayer use this command:

$ mplayer /path/to/video/file/example.avi

mplayer has lots of options and I strongly suggest you check out the documentation.

But here are the keys I use the most:
Code:
9 - volume -
0 - volume +
f - toggle full screen
p - pause/resume
q - quit

nvidia-driver users might want to take a look at this.

multimedia/vlc is also available and by default it will compile with a qt frontend. You can disable that option, if you don't want qt and enable the ncurses console interface.

You can play your audio with mplayer or vlc but if you want a separate port for that check out audio/moc for a console audio player. And multimedia/audacious for a Winamp like audio player with a gtk front end.

To run moc use this command:

$ mocp

PDF Reader

For a pdf reader I have choosen graphics/mupdf. It's quite lightweight and fast.

Another lightweight option would be graphics/xpdf.

Torrent client

For a console based torrent client net-p2p/rtorrent is an excellent choice.

Sample configuration file is /usr/local/share/examples/rtorrent/rtorrent.rc, copy it to ~/.rtorrent.rc

$ cp /usr/local/share/examples/rtorrent/rtorrent.rc ~/.rtorrent.rc

Configuration is fairly straight forward and here is a nice reading on how to do that.

For a torrent client that has a gtk or qt frontend check out transmission.

You could install net-p2p/transmission-daemon and set it up as a deamon which can then be acsessed via web browser or transmission-remote. I used to do that but that was more of a work around since net-p2p/rtorrent was missing some functionalities like magnet links.

Also, www/opera has a built in torrent client.

Wireless network manager

net-mgmt/wifimgr is a great tool for managing your wifi connections on your laptop but it depends on gtk. It's actualy just a front end for FreeBSD's WPA_SUPPLICANT(8) so technically you don't need it.

I really like it and was actually thinking of porting the code to an ncurses front end. That would be so sweet :)
 
Network file sharing

If you want to be able to share files between your FreeBSD system and FreeBSD/Linux/Windows net/samba36 is the answer.

I would suggest you disable all options expect for maybe IPV6 support. Because most likely you do not need them and if you do you will know what to enable.
After you have installed samba set the password for your user name:

$ smbpasswd -a user_name

With this user name and password you will authenticate yourself before accessing the share.

Now if you want to share something on your FreeBSD system create the samba configuration file (a template can be found here /usr/local/etc/smb.conf.default)

# ee /usr/local/etc/smb.conf

and put this in it:

Code:
[global]
workgroup = WORKGROUP
server string = FreeBSD Samba server
netbios name = server_name
security = user
encrypt passwords = yes
#hosts allow = 127.0.0.1 192.168.1.0/24
#hosts deny = 0.0.0.0/0
socket options = TCP_NODELAY
log level = 2
log file = /var/log/samba.log.%m
max log size = 50
debug timestamp = yes

[Media]
comment = Media Share Folder
path = /path/to/folder/you/want/to/share
read only = no
writeable = yes

Change the server_name and /path/to/folder/you/want/to/share to suit your needs.

If you want to access you share from a Windows machine enter this in the windows explore bar or run it via run:

[CMD=]//server_name[/CMD]

If you want to mount a windows share to your FreeBSD system, where xxx.xxx.xxx.xxx is the local ip address of a Windows machine, use this:

# mount_smbfs -I xxx.xxx.xxx.xxx -N "//user_name@pc_name/share_name" /mnt

If you want to mount another samba share to your FreeBSD system use this:

# mount_smbfs //user_name@server_name/share_name /mnt

If you want to start the samba service at start up run this command:

# echo "samba_enable=\"YES\"" >> /etc/rc.conf

If not you can start/stop the service like this form the terminal:

# service samba start
# service samba stop

For every thing else pleas refer to documentation.

VirtualBox

emulators/virtualbox-ose is one of my favorite application and I am so happy that FreeBSD supports it. I don't really like dual boot because I not want to have another OS on my hardware. With virtualbox-ose I can run Windows as if it was an application and every thing I don't want to have on my FreeBSD system, but need it on occasions, I just dump into virtualbox-ose and therefore keeping my FreeBSD system clean.

One thing that was bothering me constantly was the fact that it uses a qt based front end. And trust me qt is FAT! Turns out you do not need the front end and you can display the VM without the qt front end. The answer is VBoxSDL. You can read more about it here but here is a quote from the website:

Code:
VBoxSDL is a simple graphical user interface (GUI) that lacks the nice point-and-click support which VirtualBox, our main GUI, provides.

Sweet! Just what we need for our minimal desktop. And trust me it works great!

When you install virtualbox-ose make sure you disable QT4 and NLS options.

Here you can find instructions on how to set up virtualbox on FreeBSD or just run thees commands and reboot the system after:

# echo "vboxdrv_load=\"YES\"" >> /boot/loader.conf
# echo "vboxnet_enable=\"YES\"" >> /etc/rc.conf
# echo "devfs_system_ruleset=\"system\"" >> /etc/rc.conf
# echo "[system=10]" >> /etc/devfs.rules
# echo "add path 'usb/*' mode 0660 group operator" >> /etc/devfs.rules

Creating a VM form the terminal is fairly simple, you just have to read the documentation. I'm going to post a script that creates a very basic VM and if you want to enable some options that are not enabled by the script refer to this documentation.

Here is the script:
Code:
#!/bin/sh

#-----------------------------------------------------------------------
#CONFIG
#-----------------------------------------------------------------------

#set dir for virtual hard disk image
hdPath=/usr/home/$USER/DATA/VBoxHD
#set virtual hard disk image in MB
hdSize=20480
#set virtual machine name
vmName="WinXp"
#set os type. Run "VBoxManage list ostypes" to list options,c/p under ID.
osType="WindowsXP"
#set path to guest ISO
guestISO="/usr/home/$USER/DATA/xp.iso"
#set RAM size
ramSize=1024
#set RAM size for GPU
gpuRamSize=128
#set network interface
nic="re0"

#create folder for virtual hard disk image
if [ ! -d $hdPath ]
then 
mkdir $hdPath
fi

#-----------------------------------------------------------------------
#CREATE
#-----------------------------------------------------------------------

#create a new virtual hard disk image.
VBoxManage createhd --filename $hdPath/$vmName.vdi --size $hdSize

#create a new XML virtual machine definition file
VBoxManage createvm --name $vmName --ostype $osType --register

#add an IDE controller with a DVD drive attached, and the install ISO inserted into the drive. Set "--medium none" to detach all.
VBoxManage storagectl $vmName --name "IDE Controller" --add ide
VBoxManage storageattach $vmName --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium $hdPath/$vmName.vdi
VBoxManage storageattach $vmName --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium $guestISO

#set boot order
VBoxManage modifyvm $vmName --boot1 dvd --boot2 disk --boot3 none --boot4 none

#set I/O APIC support
VBoxManage modifyvm $vmName --ioapic on

#set the amount of RAM
VBoxManage modifyvm $vmName --memory $ramSize

#set the amount of RAM for virtual graphics card
VBoxManage modifyvm $vmName --vram $gpuRamSize

#set network mode(briged,NAT...)
VBoxManage modifyvm $vmName --nic1 bridged --bridgeadapter1 $nic

#enable USB support
VBoxManage modifyvm $vmName --usb on

#enable sound
VBoxManage modifyvm $vmName --audio oss --audiocontroller ac97

Once you have created the VM, run it with this command:

$ VBoxSDL --startvm VM_name --fullscreen

Use "CRTL + F" to toggle full screen.

To get a list of all the VMs run this:

$ VBoxManage list vms

If you want the guest additions you can find them here. Download the .iso and mount it to your virtual dvd like this:

$ VBoxManage storageattach $vmName --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium /path/to/iso/additions.iso.

We have enabled USB support so if you want to "mount" your USB drives here is what you do: (and make sure the VM is running!)

Firts make sure that the drive is not mounted on FreeBSD and if it is umount it:

# umount /dev/da*

Now list the USB devices to get UUID:

$ VBoxManage list usbhost

And attach your USB drive to your VM:

$ VBoxManage controlvm VM_name usbattach UUID

---[ Misc

Mount CD/DVD

Since devd dosn't have an event about inserting and removing CD/DVD from the drive you can't automount with sysutils/automount. Instead we have to mount manually for now:

# mount_cd9660 /dev/cd0 /mnt

Screenshot

You can take a screenshot with imlib2 like this:

$ imlib2_grab myBSD.png

Or with graphics/scrot that utilizes imlib2 but has some extra options like delay.

Calculator

bc

Disable beep sound in terminal:

# echo "hw.syscons.bell=0" >> /etc/sysctl.conf

Set UTF-8:

Edit ~/.login_conf and put this in it:

Code:
me:\
	:charset=UTF-8:\
	:lang=en_US.UTF-8:

for "lang" run this command to list avilable languages:

$ locale -a

---[ Outro

I hope this "howto" will be useful to someone trying to accomplish the same thing as me and to other FreeBSD beginners trying to set up a desktop environment from ground up. Comments and suggestions are more then welcome.
 
Ehi Taz, thank you very much! This is surely the most complete A to Z howto about a FreeBSD desktop machine I've ever read.
 
Congratulations for such a useful thread, taz! I have a few comments if you don't mind:

taz said:
Another solution for Flash would be multimedia/quvi.
I've never used multimedia/quvi. Is it any different from www/youtube_dl? youtube-dl only depends on Python. If the latest version is not yet available in the ports tree, you can grab it from the GitHub page. I have it stored in a $PATH directory in my home directory. It can be updated easily using the -U option.

taz said:
If you don't care about gtk that much and want minimalism with security I would suggest you check out www/xombrero.
Even if it's not available in the ports tree, you can easily build Vimprobable. If you need tab support you can use it within x11/tabbed.

taz said:
And if you don't care about JavaScript check out www/links.
May I suggest www/elinks (tabs, mouse support, etc.)?

taz said:
And for a more "familiar" file manager like the on found on Windows that depends on gtk I suggest you chek out x11-fm/rox-filer.
Their is also x11-fm/nautilus and x11-fm/thunar but they are far from "light" ports and would suggest to avoid them if you want minimalism.
I've tried/used most of these and many more. But none of them was good enough. Then I tried x11-fm/xfe and never looked back. It's a must for every minimalist setup!

taz said:
You can manage your torrent via WebUI which you will find if you enter this in you browser bar: "http://localhost:9091/".
transmission-remote can also be used to control everything from command-line.
 
Great thread. I have an almost identical setup.

Wish you had written it a few months ago! Although, I suppose I wouldn't have had the "pleasure" of finding these things out for myself. :\

If I may, I would like to make a few suggestions, in case anyone finds them useful.

------[ Window manager
x11-wm/spectrwm This is another good, lightweight tiling window manager.

---[ Userland applications

------[ File Manager
misc/vifm This ncurses file manager uses vi-like bindings and commands so vim users will be right at home. It has no dependencies whatsoever.

------[ Movie and music player
audio/musicpd This music playing daemon [MPD] is very light, fast and featureful.
audio/ncmpcpp This MPD client is light, fast, and powerful.

------[ Torrent client
www/aria2 This downloader is like wget + bit-torrent. It dowloads EVERYTHING! It can also download a single file from multiple sources [EG http and ftp] at the same time. Compile without MySQL for lightweight use.


None of the programs mentioned above require any toolkits, and can be compiled with unneeded features turned off to make the as light as possible.

Also, This may be a bit off topic.. When you really MUST use a graphical application, requiring many libraries and toolkits, etc, I recommend using ports-mgmt/pbi-manager and installing a self-contained PBI of the application you need so your system desn't get bogged down with unnecessary files. Read more about that here if you wish.

And one more thing, I always run rxvt-unicode in daemon-client mode as it is much lighter on resources. Essentially 10 open terminals use no more memory than one terminal.

Just my two cents. Great tutorial, thanks.
 
I've never used multimedia/quvi. Is it any different from www/youtube_dl? youtube-dl only depends on Python. If the latest version is not yet available in the ports tree, you can grab it from the GitHub page. I have it stored in a $PATH directory in my home directory. It can be updated easily using the -U option.

When I used www/youtube_dl I had to first download the .flv file and then play it with mplayer. With quvi I was able to stream videos so I just used quvi. Now I see I can do the same thing with youtube_dl so I will update the howto to use youtube_dl since it only needs python.

May I suggest www/elinks (tabs, mouse support, etc.)?

Last update was 2009 and has no support for graphics mode. www/links (well it's actually links2) is still actively developed. Check out the home page.

I've tried/used most of these and many more. But none of them was good enough. Then I tried x11-fm/xfe and never looked back. It's a must for every minimalist setup!

Just installed it and it's so slow that I can't use it. I like it though and would like to update the howto with it. Any ideas why it's not working properly? No error messages, just brutally slow.

transmission-remote can also be used to control everything from command-line.

True, updated the howto with this information.

EDIT:

Figured out why it was so slow and now works great! Anyway thank you for pointing x11/xfe to me I will update the howto.
 
Great writeup - even when running FreeBSD as desktop and laptop already I will take one or two things over.
 
And one more thing, I always run rxvt-unicode in daemon-client mode as it is much lighter on resources. Essentially 10 open terminals use no more memory than one terminal.

Yes that is true and I forgot to put it in the howto. I tried to update it but the post is to large. I will try to remove some text so I can put that information. Also thank you for your other suggestions I checked them out and added x11-wm/spectrwm to WM list.

Thanks for the extensive write-up. Had it running without any problems.

Glad to hear that!

Great writeup - even when running FreeBSD as desktop and laptop already I will take one or two things over.

Excellent! Although this howto is aimed for newcomers I was hoping other desktop users might find thing or two they can use.
 
  • Thanks
Reactions: GDP
  • Thanks
Reactions: GDP
Right, but with x11-drivers/xorg-drivers you can choose weather you want to have VESA as a backup or not. With x11/xorg-minimal you can not and I suggested to install VESA just in case, but someone might not want to have it on their system (like me). Anyhow, I get what your saying but this way you have a choice and that is what I was aiming for in general.
 
taz said:
Right, but with x11-drivers/xorg-drivers you can choose weather you want to have VESA as a backup or not. With x11/xorg-minimal you can not and I suggested to install VESA just in case, but someone might not want to have it on their system (like me). Anyhow, I get what your saying but this way you have a choice and that is what I was aiming for in general.

# echo "VIDEO_DRIVER=<driver>" >> /etc/make.conf
Just install x11-drivers/xf86-video-vesa after if you want it as a backup.

taz said:
Start rxvt-unicode with this command:
$ urxvt

You can save memory by starting urxvt as a daemon (urxvtd()). Use urxvtc instead of urxvt.

------[ Torrent client
sysutils/tmux or sysutils/screen with net-p2p/rtorrent
 
You can save memory by starting urxvt as a daemon (urxvtd). Use urxvtc instead of urxvt.

It has been mentioned a few post above yours and I know about urxvtd just forgot to put it in the howto. I'm trying to free some text form the post so I can update the howto with this info.


net-p2p/rtorrent has been mentioned in the howto. Is there any particular reason why you are suggesting a terminal multiplexer to be used with rtorrent?

EDIT:
never mind, figured out what you meant with sysutils/tmux or sysutils/screen.
 
Just 2c:
x11/rxvt-unicode is realy neat. It supports tabs via perl extension, stores text in unicode, has transparency if you want that slick look, configurable via ~/.Xdefaults file, lightweight, fast and most importantly it just works.
used tabs in terminal for some time, switched to tmux in 1 terminal window. More usable & more flexible.
If you don't care about gtk that much and want minimalism with security I would suggest you check out www/xombrero.
Or www/vimprobable or www/xxxterm or etc etc etc
For a pdf reader I have choosen graphics/mupdf. It's quite lightweight and fast.
You should try graphics/zathura. It is extermely-lite vim-like document viewer, supporting both pdf and djvu (probably more, but I use only this ones)
 
Fantastic tutorial with a nice overview of options. I'd like to mention the following ports of interest:

x11-wm/i3
i3 is an improved dynamic, tiling window manager. Inspired by wmii that supported Xinerama.

multimedia/mplayer2
MPlayer2 is an advanced general-purpose video player. A fork of the original MPlayer project, it contains significant further development and supports a number of features not available in other Unix players.

I am about to try such a kind of installation with i3 as WM on my IBM ThinkPad T42p soon, so thanks for sharing this guideline.
 
Back
Top