Installation Guides 3d ago 6 views 4 min read

How to Install OpenBSD on a Bare Metal Server

Download the ISO, create a bootable USB, and perform a clean install of OpenBSD 7.6 on your hardware. This guide covers partitioning, installing the base system, and setting up a basic network configuration.

Master Sensei
Updated 17h ago
Sponsored

Cloud Hosting — blazing fast websites

Fully managed cloud hosting with free SSL, auto-backups and a friendly cPanel. Built for WordPress, Laravel and custom PHP apps.

This guide walks you through installing OpenBSD 7.6 on a physical server. You will create a bootable USB drive, partition the disk, and configure the network. These steps target OpenBSD 7.6 and standard x86_64 hardware.

Prerequisites

  • A physical server with at least 4GB of RAM.
  • A USB flash drive with 4GB or more storage.
  • The OpenBSD 7.6 ISO image downloaded from the official site.
  • A terminal or computer to write the ISO to the USB drive.
  • Root privileges to access the disk partitioning tools.

Step 1: Write the ISO to the USB Drive

Connect the USB drive to your computer. Identify the device name, such as /dev/sdX, by running lsblk. Replace sdX with your actual device identifier. Do not select the wrong drive or you will erase data.

Mount the ISO image to a directory like /mnt/iso. Copy the contents of the ISO to the USB drive using cp. Then unmount the ISO directory. This creates a bootable drive with the necessary files.

sudo mkdir /mnt/iso
sudo mount -o loop OpenBSD-7.6.iso /mnt/iso
sudo cp -r /mnt/iso/* /dev/sdX
sudo umount /mnt/iso

Alternatively, use the dd command to write the image directly. This method is faster but takes longer to complete. Ensure the device name is correct before running the command.

sudo dd if=OpenBSD-7.6.iso of=/dev/sdX bs=1m status=progress

Step 2: Boot from the USB Drive

Reboot your server and enter the BIOS or UEFI settings. Select the USB drive as the first boot device. Save the changes and restart the machine. You should see the OpenBSD boot prompt appear on the screen.

At the boot prompt, press Enter to continue. The system will load the kernel and start the installation menu. Follow the on-screen instructions to proceed to the installation wizard.

Step 3: Partition the Disk

Select the option to partition the disk. You will see a list of available drives. Choose the drive you want to install OpenBSD on, such as /dev/ad0 for SATA or /dev/da0 for USB. Press Enter to confirm the selection.

Choose the default partitioning scheme. This creates a root partition, a swap partition, and a separate /usr partition. This layout is recommended for most servers. You can adjust the sizes if you have specific requirements.

# Example partition command output
# /dev/ad0s1a: 1024M (root)
# /dev/ad0s1b: 2048M (swap)
# /dev/ad0s1c: rest (usr)

Confirm the partitioning plan. The installer will write the partition table and format the filesystems. Wait for the process to complete. This step takes a few minutes depending on the drive speed.

Step 4: Install the Base System

Choose to install the base system only. This option installs the core operating system without extra packages. You can add packages later using the pkg_add command. This keeps the initial installation small and secure.

Select the network interface you want to configure. The installer will ask for the hostname and domain name. Enter a name for your server, such as server1.example.com. This name will appear in DNS records and logs.

Set the root password when prompted. Choose a strong password with mixed characters. This password protects the root account from unauthorized access. Remember this password for later configuration steps.

Confirm the installation. The system will copy files to the new partitions and set up the bootloader. This process writes the kernel and bootloader to the MBR or EFI partition.

Verify the installation

Remove the USB drive from the server. Reboot the machine to boot from the hard drive. You should see the OpenBSD boot prompt and then the login screen. Log in using the root account and the password you set.

Check the system version to confirm the installation. Run the following command to see the OpenBSD version and kernel release.

uname -a

You should see output similar to this:

OpenBSD server1.example.com 7.6 GENERIC amd64

Verify the network configuration. Run ifconfig to list the network interfaces and their IP addresses. Ensure the interface you configured has an IP address assigned.

ifconfig em0

Troubleshooting

If you cannot boot from the USB drive, check the BIOS settings. Ensure the USB drive is set as the primary boot device. Some systems require you to enable Legacy or UEFI boot modes in the BIOS.

If the partitioning fails, check the disk for errors. Run gpart show to view the current partition table. If the drive is encrypted or has a different filesystem, you may need to wipe it first using gdisk -z /dev/ad0.

If the network configuration does not apply, check the /etc/hostname. file. Ensure the interface name matches the hardware, such as em0 or re0. You can also try setting a static IP in /etc/hostname. to test connectivity.

If the root password is incorrect, you can reset it by booting from the USB drive again. Select the option to edit the configuration and change the root password. Then reboot the server to apply the new credentials.

Sponsored

Powerful Dedicated Servers — Linux & Windows

Bare-metal performance with SSD storage, DDoS protection and 24/7 expert support. Ideal for production workloads, databases and high-traffic sites.

Tags: securityLinuxNetworkingServerOpenBSD
0
Was this helpful?

Related tutorials

Comments 0

Login to leave a comment.

No comments yet — be the first to share your thoughts.