FreeBSD Survival Guide
This document refers to FreeBSD 15.0.
Installation
VirtualBox:
Use Intel Pro/1000 MT Desktop (8254OEM) network card. The inferface is available under FreeBSD as
em0.Change System → Motherboard → Enable EFI, and System → Motherboard → Chipset: ICH9.
Change Display → Graphics controller: VBoxSVGA
Resize the disk image before running the VM:
# VBoxManage modifymedium disk --resize 10240 FreeBSD150.vdi
Install package
virtualbox-ose-additions-72, and add to/etc/rc.conf:vboxguest_enable="YES" vboxservice_enable="YES"
Add the user to the wheel group:
# pw groupmod wheel -m voytek
Resize virtual drive image and then resize the partition:
$ gpart show $ gpart recover ada0 $ gpart show $ gpart resize -i 4 ada0 $ gpart show
and finally resize the filesystem:
$ growfs /dev/gpt/rootfs
Allow remote login for root by editing
/etc/ssh/sshd_config:PermitRootLogin yesAdd to
/etc/rc.conf:sshd_enable="yes"and start SSH server:
$ service sshd start
Use bsdconfig to configure it: Configure –> Networking –> sshd.
Configure boot loader: edit
/boot/loader.conf.d/local.conf:efi_max_resolution="720p" screen.font="10x20" hw.efi.poweroff=0
Administration
Packages
Install
pkgcommand by running:$ pkg The package management tool is not yet installed on your system. Do you want to fetch and install it now? [y/N]: y
Info about installed packages:
$ pkg info $ pkg info vim $ pkg info -l vim
Search for packages:
$ pkg search vim
Update remote repository cache:
$ pkg update
Install a package:
$ pkg install vim
Upgrade packages:
$ pkg upgrade
Remove unneeded packages:
$ pkg delete vim $ pkg autoremove
Usefull packages:
bash htop ncdu rsync vim
Clear cache:
# pkg clear -a
System settings
The main settings are stored in
/etc/rc.conffile which consists of parameters listed in/etc/defaults/rc.conf. Seerc.conf(5)for more details. The settings may be modified usingsysrc, e.g.:# sysrc mouse_enable="YES"
The main administration tool is bsdconfig.
Install bash and set it as a default shell (
/usr/local/bin/bash) for root using chsh.Networking: add to
/etc/rc.conf:ifconfig_DEFAULT="DHCP accept_rtadv"to activate DHCP for
em0interface.
Console
History is available after pressing ScrollLock.
Polish keybord/fonts: add to
/etc/rc.conf:keymap="pl"Mouse in text mode: add to
/etc/rc.conf:moused_enable="YES"Download Terminus fonts and unpack it into
/usr/share/vt/fonts. Next, add to/etc/rc.conf:allscreens_flags="-f ter-u20"
Kernel modules
List of modules:
$ kldstatAutomatic loading of modules: edit
/boot/loader.conf:linux_load="YES"
Networking
Restart:
$ service netif restart $ service routing restart
Start/stop a single interface:
$ ifconfig eth0 down $ ifconfig eth0 up
Alias:
$ ifconfig em0 192.168.1.2/24 alias $ ifconfig em0 192.168.1.2/24 -alias
Show routing:
$ netstat -r -4 $ route add -net 192.168.2.0/24 192.168.0.1
Show network services listening on ports:
$ sockstat -4 -l
Graphical user interface
Install packages:
chromium droid-fonts-ttf lightdm xfce xorg (or xorg-minimal)
Check the display:
# pciconf -lv | grep -B3 display
LightDM (display manager): edit
/usr/local/etc/lightdm/lightdm.conf:[Seat:*] ... autologin-user=voytek
and run:
# sysrc dbus_enable="YES" # sysrc lightdm_enable="YES"
Resources
FreeBSD Handbook. Available at https://www.freebsd.org/doc/handbook/.
Wikipedia entry for FreeBSD: http://en.wikipedia.org/wiki/FreeBSD.