FreeBSD CheatSheet

2014-10-05 18:19

Here are some notes on how to bootstrap a FreeBSD workstation and keep it up-to-date using binary packages and/or the ports collection.

System configuration

Setting the timezone

cp /usr/share/zoneinfo/Europe/Warsaw /etc/localtime

Setting an alternative keymap in console

The keymap directive should be set in rc.conf :

keymap = "fr.iso.acc"

Enabling trackpad gestures

The atp_load directive should be activated in loader.conf :

atp_load = "YES"

freebsd-update fetch freebsd-update install

Using pkg

Since FreeBSD 10.0, pkg is now the default tool for installing binary packages. Legacy pkg_* tools are now deprecated.

Installing pkg

To install pkg , simply invoke it and confirm action:

pkg The package management tool is not yet installed on your system. Do you want to fetch and install it now? [ y/N]: y Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/freebsd:10:x86:64/latest, please wait... Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done Installing pkg-1.3.8_2: 100% Message for pkg-1.3.8_2: If you are upgrading from the old package format, first run: # pkg2ng pkg: not enough arguments Usage: pkg [ -v ] [ -d ] [ -l ] [ -N ] [ -j <jail name or id > |-c < chroot path>] [ -C <configuration file>] [ -R <repo config dir >] [ -o var = value] [ -4 |-6] < command > [ <args>] For more information on available commands and options see 'pkg help' .

Installing packages

pkg install package

Updating package repository catalogues

pkg update

Performing upgrade of packages

pkg upgrade

Using the ports collection

Fetching and extracting the ports collection

portsnap fetch extract

Updating the ports collection

portsnap fetch update

Compiling a port and cleaning working directory and dependencies

make -C /usr/ports/category/name install clean clean-depends

Using the X.Org Server

Installing required packages

pkg install xorg

Required configuration directives

The hald_enable and dbus_enable directives should be set in rc.conf :

hald_enable = "YES" dbus_enable = "YES"

Minimal .xinitrc to launch a Window Manager

exec /usr/local/bin/wmaker

Setting an alternative keymap for X

The setxkbmap directive should be set in .xinitrc :

setxkbmap fr

Setting background and font colors for xterm

The following directives should be set in .Xdefaults :

xterm * background: #000 xterm * foreground: #aaa xterm * pointerColor: #aaa xterm * cursorColor: #aaa

Installing Fonts

Installing TrueType core fonts for the Web:

pkg install cabextract make -C /usr/ports/x11-fonts/webfonts install clean clean-depends

Then follow instructions displayed after installation:

Make sure that the freetype module is loaded. If it is not, add the following line to the "Modules" section of xorg.conf or XF86Config: Load "freetype" Add the following line to the "Files" section of xorg.conf or XF86Config: FontPath "/usr/local/lib/X11/fonts/webfonts/"

Allowing Chromium to start

The kern.ipc.shm_allow_removed directive should be set in sysctl.conf :