Tested with OpenBSD 6.9.
Download install69.img
for USB flash drive and install69.iso
for CD/DVD. Check to see if checksum matches with SHA512
file.
# From OpenBSD:
sha256 -C SHA256 install*.{img,iso}
# From GNU+Linux:
sha256sum -c --ignore-missing SHA256
For USB:
# From OpenBSD:
dd if=install*.img of=/dev/rsdXc bs=1m; sync
# From GNU+Linux:
dd if=install69.img of=/dev/sdX bs=1M status=progress; sync
For CD/DVD:
# From OpenBSD:
doas cdio tao install*.iso
Refer to OpenBSD download page for instructions.
The installer is mainly question based. After booting the medium, enter i to start the installer.
Keyboard layout: I enter "us". Enter ? for list and choose option for your keyboard.
Host and network:
Basic setup questions:
User setup:
Partitioning:
d *
to delete all part, a [part] to add a part, p m
to see current layoutc
, it will always stay there, you can't change it.a a
. the first partition should always be mounted as /, otherwise openbsd bootloader will not be able to boot. When done, enter q to save all changesInstall Set names:
To install from the medium itself (offline):
To install from internet:
ftp.jaist.ac.jp
, mirrors.dotsrc.org
or enter ? or choose from https://www.openbsd.org/ftp.htmlServer directory? default is fine, so you can press enter
Select sets by entering... If you don't now what you're doing, you can press enter. (~1.7G install)
To customize file sets:
This is not generally needed, but if a lightweight system is aimed for, enter -all
to deselect all, then enter the name (e.g. base66.tgz) or pattern (e.g. base*) to select items. More info about the file sets are here: https://www.openbsd.org/faq/faq4.html#FilesNeeded
It may ask again to select set names. Just press enter to finish the install.
If you mess up and want to install any missing file sets: https://www.cyberciti.biz/faq/openbsd-install-sets-after-install/
Then you will get option to reboot. Reboot and enjoy!
Further reading:
https://www.gabsoftware.com/tutorials/tutorial-how-to-install-openbsd-6-1-step-by-step/
https://linoxide.com/how-tos/install-openbsd-easiest-guide-ever/
doas
Do this to run commands as root. Login as root and enter:
vi /etc/doas.conf
permit persist :wheel
persist
is so that it doesn't ask for password again for a while.
This is a security feature. But if you insist on disabling it:
doas rcctl disable library_aslr
ifconfig # to find out tethered interface name, usually urndis0
doas dhclient urndis0
# Auto connect on boot:
echo dhcp | doas tee /etc/hostname.urndis0
Mirrors can be found here.
Temporary way:
export PKG_PATH=ftp://your.ftp.mirror/pub/OpenBSD/`uname -r`/packages/`machine -a`/
e.g.
export PKG_PATH=https://ftp.jaist.ac.jp/pub/OpenBSD/`uname -r`/packages/`machine -a`/
export PKG_PATH=https://mirrors.dotsrc.org/pub/OpenBSD/`uname -r`/packages/`machine -a`/
Permanent way:
doas vi /etc/installurl
#https://cdn.openbsd.org/pub/OpenBSD
https://ftp.jaist.ac.jp/pub/OpenBSD
Run this after installing:
su
syspatch
pkg_add -Uu
sysmerge -d
Premature end of archive in header
when installing or upgrading packagesChanging the mirror URL (as described above) should solve the issue.
If that doesn't work, you can try something like doas sh -c 'until pkg_add -uU; do sync; done'
until there are no more packages to be updated.
fw_update
Source:
https://www.openbsdhandbook.com/installation/
https://sohcahtoa.org.uk/openbsd.html
doas pkg_add -u
# install
doas pkg_add package
# remove
doas pkg_delete package
# search
pkg_info -c -Q package
# reinstall
doas pkg_add -D installed -r packagenamehere
# ignore ambiguities and install the extact package name given
doas pkg_add packagenamehere--
# for example:
doas pkg_add openvpn--
# remove orphan packages (installed to satisfy dependencies but which are no longer needed)
doas pkg_delete -a
Further reading: https://cromwell-intl.com/open-source/package-management.html
Example with xenodm
service:
doas rcctl enable xenodm
doas rcctl disable xenodm
doas rcctl start xenodm
doas rcctl stop xenodm
doas rcctl restart xenodm
touch .xession && chmod +x .xsession
vi ~/.xsession
# Start DBUS session bus:
if [ -x "$(command -v dbus-launch)" && -z $DBUS_SESSION_BUS_ADDRESS ]; then
eval `dbus-launch --sh-syntax --exit-with-x11`
fi
exec openbox-session
Then login from xenodm screen as user.
The exec
line above is for Openbox. Adjust for your DE/WM.
.core
file creation~/.profile
...
# on tty
ulimit -c 0
~/.xsession
...
# on xorg sessions
ulimit -c 0
Source: http://daemonforums.org/showthread.php?t=7149
touch ~/.kshrc && chmod +x ~/.kshrc
vi ~/.xsession
[ -f $HOME/.kshrc ] && export ENV=$HOME/.kshrc
...
* Add the above code before exec session commands. Better to put it above every other command. Otherwise it will not work.
vi ~/.profile
[ -f $HOME/.kshrc ] && export ENV=$HOME/.kshrc
...
Example ~/.kshrc
# change shell prompt
PS1='\w \$ '
By default, ksh doesn't store history between sessions. To store history:
vi ~/.kshrc
HISTFILE="$HOME/.ksh_history"
HISTSIZE=3000
List of previous commands will be stored in the file mentioned in HISTFILE
. Number of commands to store is indicated by HISTSIZE
. Adjust accordingly. Previous commands will be available with Ctrl+R search, up arrow or any other way to access history.
Since the file stores your last run commands, it is a better idea to do this on multi user system so that no other user can read this:
chmod 600 ~/.ksh_history
Bash aliases are more or less compatible with ksh without edits. So any .bash_aliases
may be used with it (such as bash/.bash_aliases
in this repo).
~/.kshrc
[ -f $HOME/.bash_aliases ] && . $HOME/.bash_aliases
. ~/.kshrc # to update changes for current shell
This is a way to map the back and next button (positioned left and right to the up arrow button) to home and end keys.
~/.xsession
# map thinkpad back-next button to home-end button
xmodmap -e 'keycode 234 = Home'
xmodmap -e 'keycode 233 = End'
...
~/.xsession
# enable scrolling with a combination of trackpoint and middle button
# remember to put this before exec session command
xinput set-prop "/dev/wsmouse" "WS Pointer Wheel Emulation" 1
xinput set-prop "/dev/wsmouse" "WS Pointer Wheel Emulation Button" 2
xinput set-prop "/dev/wsmouse" "WS Pointer Wheel Emulation Axes" 6 7 4 5
...
By default, ctrl+a takes cursor to beginning, instead of select all and ctrl+/ selects all text. Emacs keyboard shortcut theme is set by default.
To fix:
gsettings set org.gnome.desktop.interface gtk-key-theme "Default"
If it doesn't work:
vi ~/.config/gtk-3.0/settings.ini
[Settings]
...
gtk-key-theme-name = Default
If it doesn't work for GTK 2 apps:
vi ~/.gtkrc-2.0
...
gtk-key-theme-name = "Default"
Ref:
https://askubuntu.com/questions/294953/gtk-key-theme-emacs-what-keystroke-is-for-select-all
https://askubuntu.com/questions/124815/how-do-i-enable-emacs-keybindings-in-apps-such-as-google-chrome
doas -s
pkg_add hotplug-diskmount
/usr/local/libexec/hotplug-diskmount init
echo hotplugd_flags= >> /etc/rc.conf.local
cp /usr/local/share/doc/pkg-readmes/hotplug-diskmount /etc/hotplug/attach
chmod +x /etc/hotplug/attach
vi /etc/hotplug/attach
Now delete everything keeping only lines "#!/bin/sh" to "esac". Change "joeuser" in the LOGIN line to your normal username.
rcctl start hotplugd
exit
Plug your USB storage devices and it should show up in /vol/
.
If it doesn't work, reboot.
Tip: You can right click /vol directory on your file manager and bookmark it or send to > sidepane or anything equivalent to get easier access to mounted drives.
Ref:
https://libredd.it/r/openbsd/comments/fvmy29/looking_to_set_up_automount_for_usb_sticks/fmmsj0m/?context=3
https://www.tumfatig.net/20110903/automount-usb-stick-on-openbsd/
https://unix.stackexchange.com/a/417571
Install manXX.tgz
from file sets.
sndioctl # lists all options
sndioctl output.mute=0 # to unmute main output
# if still having problems:
sndioctl output.level=1
You can also do doas pkg_add cmixer
and solve the issue by running cmixer
then adjusting manually.
Details: https://www.openbsd.org/faq/faq13.html
doas pkg_add tor-browser
On Firefox, if there is an error message showing saying "No compatible source was found for this media." in the video area, this may fix it:
doas pkg_add ffmpeg gstreamer1-plugins-libav
Below are suggested around the internet and pkg-readmes. Depending on your setup, some of them might (or might not) work.
xcompmgr
layers.acceleration.force-enable
to true
on about:configgfx.webrender.enabled
to true on about:configsysctl hw.smt=1
(it is a security risk though)usermod -G wheel,staff yourusername
,softdeps
or ,noatime
after rw
on your /etc/fstab (you may have to experiment which one works best on your system)doas sysctl kern.maxfiles=16000; echo "kern.maxfiles=16000" | doas tee -a /etc/sysctl.conf
Ref:
/usr/local/share/doc/pkg-readmes/firefox
for more information.[ Moved to openbsd-current.md
]
OpenBSD ports are sources for the packages available. Not to be confused with port accompanied by an IP address.
Setting up:
$ cd /tmp
$ ftp https://cdn.openbsd.org/pub/OpenBSD/$(uname -r)/{ports.tar.gz,SHA256.sig}
$ signify -Cp /etc/signify/openbsd-$(uname -r | cut -c 1,3)-base.pub -x SHA256.sig ports.tar.gz
# cd /usr
# tar xvzf /tmp/ports.tar.gz
# rm /tmp/ports.tar.gz
Searching:
rsnapshot
is shown as an example port in the commands below. Use your port name instead.
$ cd /usr/ports
$ doas pkg_add portslist
$ make search key=rsnapshot # change rsnapshot with query
To run builds as normal user:
doas nano /etc/mk.conf
WRKOBJDIR=/usr/obj/ports
DISTDIR=/usr/distfiles
PACKAGE_REPOSITORY=/usr/packages
$ doas mkdir -p /usr/{obj/ports,distfiles,packages}
$ doas chown -R $USER:$USER /usr/{obj,distfiles,packages} # whole /usr/obj!!
Installing a port:
$ cd /usr/ports/net/rsnapshot
$ make install # if it doesn't work, run with doas
Cleaning build leftovers:
$ cd /usr/ports/net/rsnapshot
$ make clean
$ doas pkg_delete -a
$ make clean=dist
$ make clean=flavors
Uninstalling a port:
$ cd /usr/ports/net/rsnapshot
$ make uninstall
$ make clean=packages
Ref:
https://www.openbsd.org/faq/ports/ports.html
https://www.cyberciti.biz/faq/openbsd-install-ports-collection/