FreeBSD Survival Guide
This document refers to FreeBSD 14.0.
Installation
Networking under VirtualBox: use Intel Pro/1000 MT Desktop (8254OEM) network card. The inferface is available under FreeBSD as
em0
.Allow remote login for root by editing
/etc/ssh/sshd_config
:PermitRootLogin yes
Add to
/etc/rc.conf
:sshd_enable="yes"
and start SSH server:
$ service sshd start
Use bsdconfig to configure it: Configure –> Networking –> sshd.
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
Packages
Install
pkg
command 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
Administration
System settings
The main settings are stored in
/etc/rc.conf
file which consists of parameters listed in/etc/defaults/rc.conf
. Seerc.conf(5)
for more details.The main administration tool is bsdconfig.
To access the CD-ROM:
$ mount -t cd9660 /dev/cd0 /mnt
Install bash and set it as a default shell for root using chsh.
Networking: add to
/etc/rc.conf
:ifconfig_DEFAULT="DHCP accept_rtadv"
to activate DHCP for
em0
interface.
Console
History is available after pressing ScrollLock.
Polish keybord/fonts: add to
/etc/rc.conf
:font8x8="iso02-8x8" font8x14="iso02-8x14" font8x16="iso02-8x16" keymap="pl"
Next, add to
/etc/login.conf
to thedefault
section:default:\ ... :charset=UTF-8:\ :lang=en_US.UTF-8:
Finally run:
$ cap_mkdb /etc/login.conf
Mouse in text mode: add to
/etc/rc.conf
:moused_enable="YES"
Kernel modules
List of modules:
$ kldstat
Automatic loading of modules: edit
/boot/loader.conf
:linux_load="YES"
FB as VirtualBox guest
Install:
$ pkg install virtualbox-ose-additions
Add to
/etc/rc.conf
:vboxguest_enable="YES" vboxservice_enable="YES"
Users management
Add user to a group:
$ pw groupmod wheel -m voytek
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
Resources
FreeBSD Handbook. Available at https://www.freebsd.org/doc/handbook/.
Wikipedia entry for FreeBSD: http://en.wikipedia.org/wiki/FreeBSD.