Official PacBSD Install Guide

From PacBSD Wiki
Jump to: navigation, search


This document is a guide for installing PacBSD from the live system booted with the installation media. Most help can be found on the wiki or through the various programs' man pages; see pacbsd(7) for an overview of the configuration. For interactive help, the IRC channels and the forums are also available.

Pre-installation[edit]

Download and boot the installation medium as explained in Category:Getting and installing PacBSD, then proceed with the rest of this guide.

The installation process requires a working internet connection as each install uses the latest packages available in the remote repositories.

Set the keyboard layout[edit]

The default keyboard layout is US English Qwerty. This can be changed with the kbdmap command, which will present a list of available layouts.


Note: This change only affects the live system, when the system is rebooted this will be reset. To see how to make this change permanent see #Post-installation

Change virtual console resolution[edit]

If the default console resolution doesn't match the monitor's native resolution vidcontrol can be used to alter this.

To list all available modes use:

vidcontrol -i mode

To change the current resolution use the following command, replacing the XXX with a mode number from the previous command

vidcontrol MODE_XXX

Connect to the Internet[edit]

The live system is configured to use DHCP via dhclient on available network interfaces by default.

Verify a connection was established if none is available, proceed to configure the network to see how to manually configure it.

Update the system clock[edit]

TODO (maybe add directions to configure ntpd?)

Partition the disks[edit]

See Partitioning for details; if wanting to create any stacked block devices for disk encryption do it now.

Format the partitions[edit]

See File systems and optionally Swap for details.

Mount the partitions[edit]

Mount the root partition on /mnt, and activate your swap partition if you want them to be detected later by genfstab.

Installation[edit]

Select the mirrors[edit]

Install the base packages[edit]

Use the Pacstrap script to install the base group:

# pacstrap /mnt base

Other packages or groups can be installed by appending their names to the above command (space separated), possibly including the boot loader.

If planning on installing packages outside the official repositories, such as through the PUR or other means, then it is recommended to install the base-devel as well.

Configure the system[edit]

After the install process is complete, the install needs to be configured. To do so chroot into the system with: # arch-chroot /mnt

Enable ZFS kernel module[edit]

If using ZFS then the kernel module needs to be loading during system boot. to do this add the following to /boot/loader.conf

/boot/loader.conf
...

zfs_load="YES"
vfs.root.mountfrom="zfs:tank/ROOT/pacbsd"

Making sure to use the correct name of the dataset that contains the root filesystem.

Update fstab[edit]

The fstab needs manually with an editor such as ee or vi. Any Swap or filesystems created earlier will need to be added.


Note: If using ZFS then only swap and non-ZFS partitions need added. The system will automount the dataset/subvolumes automatically when it imports the pool.

Example fstab entry

/etc/fstab
/dev/ada0p2      none        swap   sw 0 0
/dev/ada0p3      /           ufs    rw 1 1

Enable ZFS service[edit]

In order for the ZFS pool(s) to be imported and mounted during boot the ZFS service needs to be enabled on the system.

FreeBSD-init[edit]
# sysrc zfs_enable="YES"
OpenRC[edit]
# rc-update add zfs default

Connect to the Internet[edit]

By default the network settings from the live installation environment in not carried over. To ensure that a connection will be available upon first boot, it will need to be configured while inside the jail. See configure the network for details on setting this up.

Set timezone[edit]

# ln -s /usr/share/zoneinfo/zone/subzone /etc/localtime

Replacing zone with Country/Content name (America/Europe/Japan/etc), and subzone with timezone information.

Enabling time synchronization[edit]

To enable time synchronization on the system see Time#Time_synchronization

Set Hostname[edit]

Freebsd-init[edit]
# sysrc hostname="hostname"
OpenRC[edit]
# echo 'HOSTNAME="hostname"' > /etc/conf.d/hostname

Set system locales[edit]

To change the system locale, example setting the system to UTF-8, first check if the desired locale is available for your language and country.

$ locale -a | grep '\.UTF-8$'

The above will return a list of all languages available under UTF-8

Once the locale availability has been confirmed, edit /etc/login.conf make the following changes:

/etc/login.conf

--- /usr/src/etc/login.conf     2011-03-10 13:48:59.000000000 -0800
+++ /etc/login.conf     2011-05-08 16:44:01.000000000 -0700
@@ -26,7 +26,7 @@
        :passwd_format=md5:\
        :copyright=/etc/COPYRIGHT:\
        :welcome=/etc/motd:\
-       :setenv=MAIL=/var/mail/$,BLOCKSIZE=K,FTP_PASSIVE_MODE=YES:\
+       :setenv=MAIL=/var/mail/$,BLOCKSIZE=K,FTP_PASSIVE_MODE=YES,LC_COLLATE=C:\
        :path=/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin ~/bin:\
        :nologin=/var/run/nologin:\
        :cputime=unlimited:\
@@ -44,7 +44,9 @@
        :pseudoterminals=unlimited:\
        :priority=0:\
        :ignoretime@:\
-       :umask=022:
+       :umask=022:\
+       :charset=UTF-8:\
+       :lang=en_US.UTF-8:

Then rebuild the login class capabilities database:

# cap_mkdb /etc/login.conf

Set console keymap[edit]

To permanently set the console keymap to something other than US QWERTY:


Note: List of available keymaps can be found in /usr/share/syscons/keymaps/ or usr/share/vt/keymaps/
FreeBSD-init[edit]
# sysrc keymay=<keymap>
OpenRC[edit]
/etc/conf.d/syscons
...
# Set the keymap to "uk.iso".
keymap="<keymap>"

Set root password[edit]

# passwd

Exit the chroot[edit]

# exit

Copy ZFS pool cache and set bootfs property[edit]

If using ZFS the pool cache information needs to be copied from the live environment to the system:

# cp /boot/zfs/zpool.cache /mnt/boot/zfs/zpool.cache

Install a bootloader[edit]

The bootloader tells the system where it should boot from. Setting this differs based on whether the root filesystem uses UFS2 or ZFS

UFS[edit]
Installing the bootcode for GPT partition layout[edit]
# gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada0
Installing the bootcode for MBR partition layout[edit]
# gpart bootcode -b /boot/boot0 ada0
# gpart bootcode -b /boot/boot ada0s1

If you want to use FreeBSDs bootloader as the primary bootloader

# gpart set -a active -i 1 ada0
ZFS[edit]
Installing the bootcode for GPT partition layout[edit]
# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i1 ada0
Installing the bootcode for MBR partition layout[edit]

If using MBR partition based layout the ZFS pool will need to first be unmounted

# zpool export tank

Then install the bootcode with

# gpart bootcode -b /boot/boot0 ada0
# dd if=/boot/zfsboot of=/dev/ada0s1 count=1
# dd if=/boot/zfsboot of=/dev/ada0s1a skip=1 seek=1024
Setting bootfs ZFS property[edit]

Set the bootfs property tank/ROOT/pacbsd:

# zpool set bootfs=tank/ROOT/pacbsd tank

Reboot[edit]

Unmount all the partitions with umount -R /mnt then restart the machine with reboot. Remember to remove the installation media then login into the new system with the root account.

Post-installation[edit]

See Post Installation Recommendations for system management suggestions and post-installation tutorials.