Experiencing Freebsd 10: tips and tricks for basic maintenance

Having recently tested Freebsd 10 here are some tips for new users to help them on their way.

When you install Freebsd and you are creating a new user you might want to include the user to extra groups wheel and network .

Wheel gives your regular user rights to go into super user mode via terminal by executing su – and network gives your user rights to use network devices etc.

You can of course always log in as a root user and perform administration task there as well, choice is yours.

First thing I encountered after installation was the complaint that pkg was not installed. I was trying to do pkg install fluxbox when the complaint appeared but thanks to Freebsd’s execelent structure the system asked automatically if I would want to download pkg and install it. In addition to the previous, the command line also printed out instructions about how to install pkg manually (if the automatic way would fail).

After the first “problem” was avoided it was time to start installing things. As I wanted a full desktop experience with all the needed tools I did:

pkg install fluxbox lxmusic feh conky leafpad midori rox-filer slim xinit nano xorg xtrlock xterm

Tip. With pkg delete someprogram you can remove installed programs if so desired.

While you are free to choose what you install here are some tips. 

1. If you want to use graphical desktop install xorg

2. Conky will not start automatically if you do not have .conkyrc file in your user’s home directory. Get some conky configurations from here: http://www.techtimejourney.net/?s=conky

3. Firefox proved to be problematic as it only started via terminal and was very slow. This might be a specific issue relating to my hardware though. Midori was working very well though.

4, If you want to use Slim or any other display manager you must enable it via /etc/rc.conf after you have installed it. You must also tweak Slim’s entries which are to be found at /usr/local/etc/slim.conf.sample 

Note. Save the slim.conf.sample as slim.conf once you have made modifications to it. The specific lines of interest are:

login_cmd exec /bin/sh – ~/.xinitrc %session
#login_cmd exec /bin/bash -login ~/.xinitrc %session

Disable or enable (#=Disabled) one of the above lines depending on where you have placed your .xinitrc file. The usual suspect is your home directory.

See more from Slim by navigating to this post: http://www.techtimejourney.net/introducing-slim-display-manager/

5. Regardless whether or not you use Slim or start your Freebsd with startx command, which we installed with the xinit on the above, you will need .xinitrc . See this post for .xinitrc example: http://www.techtimejourney.net/log-in-to-linux-desktop-without-a-display-manager-xinitrc-and-startx-in-action/

Once you have done all the above you might want to secure your system, enable mouse and keyboard within graphical desktop etc. You will do all this and more within a file /etc/rc.conf. Here is my /etc/rc.conf as an example.  You need to be a root user to edit the file.

 

#/etc/rc.conf

hostname=”testing”
keymap=”finnish.iso.kbd”
ifconfig_re0=”DHCP”
dumpdev=”NO”

#Lines above are specific to your box

#Mouse and devices
moused_enable=”YES”
dbus_enable=”YES”
hald_enable=”YES”

#Firewall
firewall_quiet=”NO”
firewall_enable=”YES”
firewall_type=”workstation”
firewall_logging=”YES”

#Firewall type can also be client but workstation might be better for security.

#Display manager Slim
slim_enable=”YES”

Installing security updates

If you want to keep your Freebsd box secure you should install security updates. Here is how you do it in a terminal as a root user.

freebsd-update fetch

freebsd-update install

If updates fail to apply correctly you can go back to previous state by executing: freebsd-update rollback

Keeping Binary packages updated 

Here is how you do it in a terminal as a root user

pkg update

pkg upgrade

If you decide to use ports (compile your programs from source)

go to /usr/ports as a root user and via terminal client

cd /usr/ports

portsnap fetch extract update

The above command does all the heavy work and the result should be a ports collection, which is up to date.

Tip. You can chain the commands to follow each other. Notice how I entered portsnap fetch extract update instead of

portsnap fetch

portsnap extract

portsnap update

The above things should give you the basic idea about Freebsd maintenance. For more complex tricks you should always check the Freebsd handbook, which contains very good and complete documentation for beginners and experts alike.