Basic configuration
doas
Configure
doasfor default normal user:cat <<- 'EOF' >> /etc/doas.conf permit persist keepenv :wheel EOF
sudo
Installing package for
sudo:pkg_add sudoConfigure
sudofor default normal user:cat <<- 'EOF' >> /etc/sudoers %wheel ALL=(ALL) SETENV: ALL EOF
Repository commands
Mirrors
Select mirror:
export PKG_PATH=http://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(uname -m)/
Finding packages
Search for a package by name:
pkg_info -Q <name>Search for a specific filename:
pkg_add pkglocatedb pkglocate <filename>
Installing packages
Install package ‘pkg’:
pkg_add <pkg>
Updating packages
Update package ‘pkg’ and its dependencies:
pkg_add -u <pkg>Update all packages:
pkg_add -u
Removing packages
Uninstall package ‘pkg’:
pkg_delete <pkg>Uninstall package ‘pkg’ and unused dependencies:
pkg_delete -a <pkg>
Duplicating installed packages on another machine
Dump list of installed packages to a file:
pkg_info -mz | tee pkg_listInstall packages from a list:
pkg_add -l pkg_list
Consistency of installed packages
Check installed packages:
pkg_check
Ports
Setting up as normal user
Add user ‘john’ to appropriate groups:
sudo user mod -G wobj,wsrc johnModify
mk.conffile:cat <<- 'EOF' | sudo tee -a /etc/mk.conf SUDO=sudo PORTS_PRIVSEP=Yes BUILD_USER=john FETCH_USER=john WRKOBJDIR=/usr/obj/ports PACKAGE_REPOSITORY=/usr/packages DISTDIR=/usr/distfiles EOFCreate
portsdirectory with appropriate permissions:cd /usr sudo mkdir ports sudo chmod 775 ports sudo chgrp wsrc portsClone ports tree as user:
cd /usr cvs -qd [email protected]:/cvs checkout -rOPENBSD_6_5 -P portsCheck permissions and fix if necessary:
cd /usr/ports sudo make fix-permissions
Finding ports
Search the ports tree for a package:
sudo pkg_add portslist cd /usr/ports make search key=dwm
Installing ports
Install package:
cd /usr/ports/x11/dwm make installPatch and install package:
cd /usr/ports/x11/dwm make patch && cd `make show=WRKDIST` # # Do some changes (e.g. `patch -p1 < patch.diff`) cd - make install
Cleaning up ports
Remove packages that were installed only for building:
sudo pkg_delete -aClean port’s working directory:
make cleanRemove the source distribution set(s) of the port:
make clean=dist
Updating ports
Updating ports tree:
cd /usr/ports cvs -q update -Pd -rOPENBSD_6_5
Uninstalling ports
Uninstall package:
make uninstallClean built package:
make clean=packages
Serial console
Configure serial boot:
echo 'set tty com0' >> /etc/boot.confConfigure serial console login:
sed -i 's,^tty00.*unknown.*off$,tty00 "/usr/libexec/getty std.9600" vt220 on secure,' /etc/ttysMake installation ISO (e.g. cd65.iso) boot using serial:
echo 'set tty com0' > /tmp/boot.conf growisofs -M cd65.iso -l -graft-points /etc/boot.conf=/tmp/boot.conf