Install NetBSD (Short and Sweet Version)
The NetBSD Guide has an extensive chapter on installing NetBSD that covers a wide range of scenarios. Its an invaluable resource maintained by volunteer contributors.
After performing a few installs, these are my personal notes of steps taken and choices made. A short and sweet version of the above Guide HOWTO.
NOTE
If disk encryption is required, see Manual NetBSD Installation with Disk Encryption.
1. Start Here
Throughout this guide, if you see square brackets []
in code blocks, that means the word of code (square brackets included) should be replaced with something else. This is detailed in the instructions before or after the code block.
This guide makes a few assumptions:
- Target device is amd64 architecture
- System uses UEFI to boot and a GPT partition table
- NetBSD install media prepared on a Linux/BSD system
- NetBSD is the sole OS on a single disk
- Network access during install uses a (NetBSD supported) wired interface
1.1 Download install image
Download the INSTALL image and the SHA512
file for verification:
$ wget -c https://cdn.netbsd.org/pub/NetBSD/NetBSD-10.1/images/NetBSD-10.1-amd64-install.img.gz
$ wget https://cdn.netbsd.org/pub/NetBSD/images/10.1/SHA512
Verify the image using sha512sum
:
$ sha512sum -c --ignore-missing SHA512
NetBSD-10.1-amd64-install.img.gz: OK
Decompress the image:
$ gunzip NetBSD-10.1-amd64-install.img.gz
1.2 Prepare USB install media
Plug in a USB stick and identify its device label. If the USB stick is mounted, unmount the device:
# umount /dev/[device_label]
For example, if the USB stick is mounted as sdx1
:
# umount /dev/sdx1
WARNING
Be very careful to note the proper device. All contents on the device will be lost!
Write the install image to the USB stick using the dd(1) command:
# dd if=NetBSD-10.1-amd64-install.img of=/dev/[device_label] bs=2M conv=fsync oflag=direct status=progress
# sync
Using the previous example of sdx1
, this command would replace [device_label]
with sdx
(omit the partition number):
# dd if=NetBSD-10.1-amd64-install.img of=/dev/sdx bs=2M conv=fsync oflag=direct status=progress
# sync
2. Live Environment
Insert the USB install stick into the target device and boot. Select Option 1
(default) to Install NetBSD
.
After the installer has successfully booted into the NetBSD kernel, a prompt appears to select which language will be used for installation messages, followed by a prompt to select a different keyboard type if desired or leave unchanged.
Next up the menu-based sysinst program is launched:
NetBSD-10.1 Install System
>a: Install NetBSD to hard disk
b: Upgrade NetBSD on a hard disk
c: Re-install sets or install additional sets
d: Reboot the computer
e: Utility menu
f: Config menu
x: Exit Install System
2.1 Configure network
At the Install System
main menu, select >e: Utility menu
then >c: Configure network
.
Available interfaces
lists the network interfaces detected by the NetBSD installer.
EXAMPLE
With my target device Available interfaces
lists two: wm0
(wired) and iwn0
(wireless). I choose to configure the wired ethernet interface.
Network media (empty to autoconfigure) [autoselect]: <enter>
Perform autoconfiguration?
>a: Yes
Your host name: bsdbox
Your DNS domain [home]: home.arpa
The following are the values you entered.
[...]
Are they OK?
>a: Yes
>x: Exit
the Utilities
menu and return to the Install System
main menu.
3. Installation
NetBSD-10.1 Install System
>a: Install NetBSD to hard disk
Shall we continue?
>b: Yes
NOTE
NVMe devices show up as ld
and hard disks are identified by wd
. USB devices usually show up as sd
.
Under Available disks
I select my SATA disk identified as wd0
.
Select >a: Guid Partition Table (GPT)
for partitioning scheme.
For partition sizes select Use default partition sizes
.
NetBSD proposes a default partition layout with 3 partitions:
- 128MB efi partition with
MSDOS
file system - remaining disk space (minus swap) for root partition with
FFSv2
file system - swap partition with
swap
file system
Select >x: Partition sizes ok
and >b: Yes
to continue.
Under Select your distribution
choose either >a: Full installation
for a desktop install or >b: Installation without X11
for a server install.
Under Install from
select >a: CD-ROM / DVD / install image media
. Installation to target device begins.
When prompted to confirm that the network information entered earlier is accurate and should it be installed in /etc
, select >a: Yes
then Hit enter to continue
.
Set password for root
.
A warning may appear:
This system seems to lack a cryptographically strong pseudo random number generator. There is not enough entropy available to create secure keys (e.g. ssh host keys).
If so, select >a: Manually input random characters
and enter one line of random characters.
4. Configuration
Additional items I configure:
>b: Timezone
Default is UTC
; select whatever is appropriate (Example: Canada/Eastern
).
Ease the future installation of binary packages by installing and configuring the pkgin
package manager:
>e: Enable installation of binary packages
pkgin
will be fetched and installed from an FTP server. Confirm network information >a: Yes
, accept the defaults and select >x: Install pkgin and update package summary
to run the task, then Hit enter to continue
.
Enable remote access to this device by starting sshd
at boot:
>g: Enable sshd YES
Confirm datetime at boot and correct any drift:
>h: Enable ntpd YES
>i: Run ntpdate at boot YES
Create a user account:
>o: Add a user
Choose >a: Yes
to add user to group wheel
, user shell >a: /bin/sh
, and set password.
Exit configuration:
>x. Finished configuring
and Hit enter to continue
.
Reboot:
>d: Reboot the computer
System messages stream past, and finally:
NetBSD/amd64 (bsdbox.home.arpa) (constty)
login:
Welcome to NetBSD!
To shutdown/poweroff the system:
# shutdown -p now
5. Resources
- NetBSD INSTALL: Installation procedure for NetBSD/amd64
- NetBSD Wiki: Installing NetBSD on a x86 system with UEFI
- NetBSD Guide: Chapter 3. Example installation
You can like, share, or comment on this post on the Fediverse 💬
« Previous: Virtualization Using KVM + QEMU + Libvirt