Files
oam/knowledge base/netbsd.md
2024-09-06 08:44:56 +02:00

3.1 KiB

NetBSD

  1. TL;DR
  2. The rc.conf files
  3. Package management
    1. Upgrade the system
    2. Manage ports from the Ports collection
  4. Enable time sync for the NTP server
  5. Graphical UI
  6. VirtualBox Guest Additions
  7. Linux binary compatibility
  8. Further readings
    1. Sources

TL;DR

# Read manual pages.
man 'man'
man 5 'rc.conf'

# List all available man pages.
man -w 'time'

# Read all available man pages.
man -a 'time'

# Search for keywords in the manual page descriptions.
man -k 'mail'

# Change the keyboard's layout.
wsconsctl -kw encoding=it

# Edit files.
vi 'path/to/file'

# Become 'root' from user sessions.
# The user must know root's password *and* be member of the 'wheel' group.
# Use '-' at the end to also load root's environment.
su
su -

# Add users.
useradd -m 'username'
useradd -mG 'secondary_group' 'username'

# Add new members to groups.
usermod -G 'group_name' 'username'

# Change users' default shell.
chpass -s 'path/to/shell' 'username'
chpass -s "$(grep 'bin/zsh' '/etc/shells')" 'username'

# (Re)start services.
service ntpd restart
service vboxguest restart

# Start services at boot.
echo ntpd_enable="YES" >> '/etc/rc.conf'
echo vboxguest_enable="YES" >> '/etc/rc.conf'

# Upgrade the system to newer *minor* versions.
sysinst
sysupgrade auto 'https://cdn.netbsd.org/pub/NetBSD/NetBSD-10.0/amd64'

# Upgrade the system to newer *major* versions.
sysinst
sysupgrade fetch 'https://cdn.netbsd.org/pub/NetBSD/NetBSD-10.0/amd64' \
&& sysupgrade kernel \
&& sysupgrade modules \
&& reboot \
&& sysupgrade sets \
&& sysupgrade etcupdate \
&& sysupgrade clean \
&& reboot

# Initialize the package managers.
export PKG_PATH="https://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r | cut -d '_' -f '1')/All"

# Install packages the basic way.
pkg_add -v 'git'
pkg_add -v 'pkgin'

# Install packages using `pkgin`.
pkgin install 'firefox'
pkgin in 'sqlite3'

# Refresh the packages database.
pkgin update
pkgin up

# Search for packages.
pkgin search 'fish'
pkgin se 'boinc'

# Upgrade packages.
pkgin upgrade
pkgin ug

# List installed packages.
pkgin list
pkgin ls

# *Gently* reboot the system.
shutdown -r now
shutdown -r +30 "System will reboot"

# *Gently* shutdown the system.
# `poweroff` is equivalent to `shutdown -p now`.
shutdown -p +5
poweroff

The rc.conf files

TODO

Package management

Upgrade the system

TODO

Manage ports from the Ports collection

TODO

Enable time sync for the NTP server

sysrc ntpd_enable="YES"
sysrc ntpd_sync_on_start="YES"

Graphical UI

TODO

VirtualBox Guest Additions

TODO

Linux binary compatibility

TODO

Further readings

Sources