• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

[howto] Minimal FreeBSD desktop

Beastie

Daemon

Thanks: 418
Messages: 2,085

^ Sure, a pair of grave accents "``" does something called "command substitution" or "inline execution", e.g.:
<your command here> screenshot_`date "+%d.%m.%Y"`.png
 

thisalone

New Member


Messages: 1

I'm a long time lurker here and registered just so I could thank you for this guide! Got a slick Openbox desktop running with your help running FreeBSD 10 on amd64. One thing I might add is installing Conky, it doesn't take up much memory and looks nice on the desktop for displaying system info and resources.
 

nydn

New Member


Messages: 5

Hello @taz and everyone!

First of all: thanks for this great guide, it really helped me a lot!

I'm a *BSD newbie, moved from Win7 to FreeBSD two weeks ago and actually I haven't even booted into Windows since then (I'm still surprised about that, because I have tried various Linux distros before but could not get used to any of them). Anyway, I tried to follow your guide, integrated some more ports and got a really nice system!

However since I've added x11/slim as a login manager I cannot use the shutdown command from Openbox as a normal user anymore (it worked perfectly before). Is it possible to make it work again somehow?

Regards,
Daniel
 
Last edited by a moderator:

tzoi516

Well-Known Member

Thanks: 12
Messages: 368

Since I refer to this frequently for various reasons, I've decided to update a few parts, starting with this one:
[DISCLAIMER: I didn't write any of this, just edited it for the new BB code (read: I'm not the author, @taz is). I left the quotes out for readability]
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 by a moderator:

tzoi516

Well-Known Member

Thanks: 12
Messages: 368

Since I refer to this frequently for various reasons, I've decided to update a few parts:
[DISCLAIMER: I didn't write any of this, just edited it for the new BB code (read: I'm not the author, @taz is). I left the quotes out for readability]
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.
 
Last edited by a moderator:

tzoi516

Well-Known Member

Thanks: 12
Messages: 368

Since I refer to this frequently for various reasons, I've decided to update a few parts:
[DISCLAIMER: I didn't write any of this, just edited it for the new BB code (read: I'm not the author, @taz is). I left the quotes out for readability]

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 http://www.bsdnexus.com/wallpapers/DD_freebsd.jpg
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.
 

Attachments

Last edited by a moderator:

tzoi516

Well-Known Member

Thanks: 12
Messages: 368

Since I refer to this frequently for various reasons, I've decided to update a few parts:
[DISCLAIMER: I didn't write any of this, just edited it for the new BB code (read: I'm not the author, @taz is). I left the quotes out for readability]

---[ 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 :)
 
Last edited by a moderator:

tzoi516

Well-Known Member

Thanks: 12
Messages: 368

Since I refer to this frequently for various reasons, I've decided to update a few parts:
[DISCLAIMER: I didn't write any of this, just edited it for the new BB code (read: I'm not the author, @taz is). I left the quotes out for readability]

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 your share from a Windows machine enter this in the windows explore bar or run it via run:

//server_name

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.
 
Last edited by a moderator:

taz

Active Member

Thanks: 148
Messages: 115

Thanks @tzoi516 for this. I have been meaning to do this but just could not find the time. I have put the link in the guide header. Also for all the "lovers" off this guide the "[howto] minimal FreeBSD desktop v2" should be available within a month or two.

:beergrin
 
Last edited by a moderator:

xtremystinx

New Member


Messages: 15

Thank you both, @taz and @tzoi516. I'm using a similar setup with Archbang these last few years and your guide was a very big push for me to try FreeBSD and get something familiar to start with. Thanks again!
 
Last edited by a moderator:

MuTeD

New Member


Messages: 1

Fantastic guide! I basically created an account here just to show my appreciation. This "how to" pushed me over the line to try FreeBSD on an old desktop and I have since installed it on my main laptop. I even try to mimic this when installing a Linux system. Thanks!

I had a few issues though:
  1. x11/xorg-minimal was a little too minimal. I don't think it asked me what video driver to install. All I know is that my screen was rather blurry so I just installed x11/xorg which solved the problem.
  2. x11-wm/openbox wouldn't install with ports-mgmt/portmaster, I had to cd /usr/ports/x11-wm/openbox && make install clean instead and that worked fine.
  3. Making emulators/virtualbox-ose gave errors. It required me to have both lib32 and FreeBSD's src installed.
 

shepper

Aspiring Daemon

Thanks: 197
Messages: 617

Fantastic guide! I basically created an account here just to show my appreciation. This "how to" pushed me over the line to try FreeBSD on an old desktop and have since installed it on my main laptop. I even try to mimic this when installing a Linux system. Thanks!
This has become my favorite desktop and I have basically set it up in Debian, Fedora 20, OpenBSD and NetBSD. In OpenBSD I went ahead and chose applications based on their stability and have put together a walkthrough install http://daemonforums.org/showthread.php?t=8489. I tried to stay with GTK applications and collected the configuration files in ~/.config/. There is also a link on how to create a custom x11/wbar dock.
 

free-and-bsd

Aspiring Daemon

Thanks: 66
Messages: 633

Made a small addition to my minimal desktop (fvwm2): menu item to make a snapshot of a section of my screen.
Code:
#!/usr/local/bin/bash
echo "Type filename to save"
read imagename
import $imagename
echo "Screenshot saved as $imagename"
This file is saved as ~/printscreen

Then it can be called from the fvwm2 menu like this:
Code:
...
+       "Screenshot"   Exec exec xterm -geometry 30x5 ~/./printscreen
How it works: upon clicking the menu item "Screenshot" a small xterm window appears prompting to type the name you want your screenshot to be saved under. After typing in a name in the format filename.jpg or filename.png you select the section of the screen you want to have saved. For more details about the available graphics formats, see import(1).

PS: forgot to mention: you'll need ImageMagick for that to work.
 

ANOKNUSA

Aspiring Daemon

Thanks: 358
Messages: 671

And BTW, more about how to make screenshots using ImageMagick, see this page. Arch people are very nice.
If you don't need ImageMagick installed for anything else, have a look at graphics/scrot. It's tiny, and can take a screenshot of the entire display, a selection or a single window. Seems to be what most folks use make screenshots for the Arch forums. ;)
 

free-and-bsd

Aspiring Daemon

Thanks: 66
Messages: 633

If you don't need ImageMagick installed for anything else, have a look at graphics/scrot. It's tiny, and can take a screenshot of the entire display, a selection or a single window. Seems to be what most folks use make screenshots for the Arch forums. ;)
Yea, they talk a lot about this one. But I just happen to have ImageMagick installed (as do many, I believe) for a good deal of things, including some funny FVWM2 "look & feel" customizations.
Also, I cannot possibly tell if I won't be needing it for some other things in the future, because I enjoy finding and absorbing new ideas. And graphics/ImageMagick seems to be invented just with this approach in mind :). For the same reason I use icon sets in my x11-fm/pcmanfm file manager, which also pulls in a number of desktop-related utilities. But then files have icons in the file manager window...

With this said, my idea of a "minimal" desktop finds me with some 500 packages installed, ;). But it remains "minimal" in that it doesn't impose upon me all these junk programs from GNOME DE, for example, which make it work slow and even prevent it from doing properly what my "limited" installation does without fail.