new-install

Notes on OS intalls
git clone https://git.bracken.jp/new-install.git
Log | Files | Refs | LICENSE

openbsd_install.md (5311B)


      1 OpenBSD Install
      2 ===============
      3 
      4 Last updated for OpenBSD 7.2.
      5 
      6 Writing to a flash drive on macOS
      7 ---------------------------------
      8 ```
      9 % cd /tmp
     10 % export URL=https://cdn.openbsd.org/pub/OpenBSD
     11 % curl -Os $URL/7.2/amd64/SHA256
     12 % curl -Os $URL/7.2/amd64/install72.img
     13 % shasum -c SHA256 --ignore-missing
     14 install72.img: OK
     15 % sudo diskutil list
     16 /dev/disk4 (external, physical):
     17    #:                       TYPE NAME                    SIZE       IDENTIFIER
     18    0:     FDisk_partition_scheme                        *16.0 GB    disk4
     19 ...
     20                     (free space)                         15.6 GB    -
     21 
     22 % sudo diskutil unmountDisk /dev/diskX
     23 % sudo dd if=install69.img of=/dev/diskX bs=1m
     24 664+1 records in
     25 664+1 records out
     26 696745984 bytes transferred in 93.000559 secs (7491847 bytes/sec)
     27 ```
     28 
     29 Initial install
     30 ---------------
     31 
     32 1. At install prompt, select "(I)nstall".
     33 1. For keyboard, type us.swapctrlcaps or jp.swapctrlcaps.
     34 1. When prompted for the hostname, enter the short hostname with no domain.
     35 1. When prompted for an interface to configure, select em0.
     36 1. When prompted for how to configure IPv4, use dhcp.
     37 1. When prompted for how to configure IPv6, select none.
     38 1. When prompted for the next network interface to configure, select
     39    done.
     40 1. Enter your domain name at the prompt.
     41 1. Enter the root password, then confirm.
     42 1. When asked whether to start sshd by default select yes.
     43 1. When prompted for whether to start xwindows select no for a server,
     44    optionally yes otherwise.
     45 1. Leave the default console on video out rather than com0.
     46 1. Add a user.
     47 1. When prompted for whether to enabled root ssh login, select no.
     48 1. When prompted for what timezone you're in enter "America" or "Asia".
     49 1. When prompted for the sub-timezone, select the correct value.
     50 1. Select the disk you wish to install the OS onto. Type ? to ensure
     51    you're writing to the correct disk.
     52 1. Use gpt to partition the disk as desired.
     53 1. When prompted for the location of sets, pick http.
     54 1. Set proxy settings as needed, or leave blank if none.
     55 1. The default http server is probably reasonable.
     56 1. The default directory is probably correct.
     57 1. Select all sets (unless there are some you don't want).
     58 1. When prompted for more sets to install, select done.
     59 1. When prompted to exit/halt/reboot, select reboot.
     60 
     61 Create `/etc/doas.conf` with the following contents:
     62 
     63     permit nopass :wheel
     64     permit :wheel cmd reboot
     65     permit :wheel cmd shutdown
     66     permit nopass keepenv root as root
     67 
     68 Edit `/etc/ssh/sshd_config` and set:
     69 
     70     PasswordAuthentication no
     71     KbdInteractiveAuthentication no
     72 
     73 Restart sshd:
     74 
     75     kill -HUP `cat /var/run/sshd.pid`
     76 
     77 If we're using DHCP to configure the network interface, dhclient
     78 requires a config file, but an empty file is sufficient. Without this,
     79 it appears to pick up a 6 month-long lease by default. One symptom of
     80 this is that routers will typically stop resolving the hostname (which
     81 is provided to the router in the DHCP lease request) if the device
     82 doesn't renew the lease before it's up:
     83 
     84     touch /etc/dhclient.conf
     85 
     86 I generally leave a comment in the file along these lines:
     87 
     88     #	This file is required by the ISC DHCP client.
     89     #	See ``man 5 dhclient.conf'' for details.
     90     #
     91     #	In most cases an empty file is sufficient for most people as the
     92     #	defaults are usually fine.
     93     #
     94     # See /etc/examples/dhclient.conf
     95 
     96 If we're running in a VM under the Xen hypervisor, management support is built
     97 in to the OpenBSD kernel. It can be configured as documented in the `xen(4)`
     98 manpage. Edit `/etc/rc.local` and insert the following:
     99 
    100     ostype=$(sysctl -n kern.ostype)
    101     osrelease=$(sysctl -n kern.osrelease)
    102 
    103     # XenServer Tools version
    104     hostctl attr/PVAddons/MajorVersion 6
    105     hostctl attr/PVAddons/MinorVersion 2
    106     hostctl attr/PVAddons/MicroVersion 0
    107     hostctl attr/PVAddons/BuildVersion 76888
    108     hostctl attr/PVAddons/Installed 1
    109 
    110     # OS version
    111     hostctl data/os_name "$ostype $osrelease"
    112     hostctl data/os_uname $osrelease
    113     hostctl data/os_distro $ostype
    114 
    115     # Update XenStore
    116     hostctl data/updated 1
    117 
    118 You may also need to disable the 'viridian' capability, which is enabled by
    119 default in XenServer. We can disable that by running the following command on
    120 one of the Xen host machines:
    121 
    122     xe vm-param-set uuid=<VM_UUID> platform:viridian=false
    123 
    124 Configure basics
    125 ----------------
    126 
    127 Install zsh:
    128 
    129     doas pkg_add zsh
    130 
    131 Install git and tig:
    132 
    133     doas pkg_add git tig
    134 
    135 Install vim. The following command will prompt you for which variant to
    136 install (I prefer `vim-no_x11-python3`):
    137 
    138     doas pkg_add vim
    139 
    140 Install basic utilities:
    141 
    142     doas pkg_add unzip
    143     doas pkg_add gnupg
    144 
    145 Install browsers:
    146 
    147     doas pkg_add lynx
    148     doas pkg_add firefox-esr ffmpeg
    149     doas pkg_add amfora
    150 
    151 Install fonts:
    152 
    153     doas pkg_add noto-fonts noto-cjk noto-emoji
    154 
    155 Install development toolchain extras:
    156 
    157     doas pkg_add llvm
    158     doas pkg_add clang-tools-extra
    159 
    160 
    161 Enable power management
    162 -----------------------
    163 
    164 In `/etc/rc.conf`, set:
    165 
    166     apmd_flags="-A"
    167 
    168 
    169 Configure X11
    170 -------------
    171 
    172 Install i3, dmenu, urxvt and/or alacritty:
    173 
    174     doas pkg_add i3
    175     doas pkg_add i3lock xautolock
    176     doas pkg_add i3status
    177     doas pkg_add dmenu
    178     doas pkg_add rxvt-unicode alacritty
    179 
    180 Enable the xenodm login manager in `/etc/rc.conf`:
    181 
    182     xenodm_flags=YES