Step-by-Step Installing FreeBSD, version 13.3

The full FreeBSD installation guide is available from the FreeBSD Handbook

Get FreeBSD from a mirror located physically near you.
For our project, get the 64 bit (AMD64) image for USB flash drive (memory stick). For those unfamiliar with FreeBSD naming, the i386 branch is for 32bit Intel processors, while the amd64 branch is for both AMD and Intel 64 bit processors. All modern processors since Core-2 are 64 bit. The newest "i5" series Intel supports the 64 bit instruction set and that is what we will use in this project.

Look in image installers for amd64. The filename should be something like "FreeBSD-13.3-RELEASE-amd64-memstick.img.xz".



Use an unzip program such as 7-Zip www.7zip.org to unzip the xz file to just the img file.
Get Image Writer for Windows.
from Sourceforge

Use the Image Writer utility to place the memory stick image on a flash (Pen) drive of at least 2GB capacity.

...:::WARNING:::...
Image writer will completely erase all existing data on the flash drive with the FreeBSD image file. After writing, the file system on the flash drive will not be recognized by Windows. This is not a problem. But, do not allow Windows to reformat the drive after the image has been written, or we will need to write the image again to the flash drive.

Place the flash drive in one of home gateway's rear panel USB ports. If the USB drive does not boot, go into your motherboard's BIOS and setup to boot from USB. (On my system, the USB booted automatically without any BIOS modifications.)


Save the BIOS settings, exit and reboot.

STEP 1 - Boot

Now the PC will boot from the FreeBSD 13.3-RELEASE USB flash drive.

After the initial boot a text page of startup options will be displayed.

  ______               ____   _____ _____  
 |  ____|             |  _ \ / ____|  __ \ 
 | |___ _ __ ___  ___ | |_) | (___ | |  | |
 |  ___| '__/ _ \/ _ \|  _ < \___ \| |  | |
 | |   | | |  __/  __/| |_) |____) | |__| |
 | |   | | |    |    ||     |      |      |
 |_|   |_|  \___|\___||____/|_____/|_____/     ```                        `
                                              s` `.....---.......--.```   -/
 -------------Welcome to FreeBSD------------- +o   .--`         /y:`      +.
 |                                          |  yo`:.            :o      `+-
 |  1. Boot Installer [Enter]               |   y/               -/`   -o/
 |  2. Boot Single User                     |  .-                  ::/sy+:.
 |  3. Escape to loader prompt              |  /                     `--  /
 |  4. Reboot                               | `:                          :`
 |  5. Cons: Video                          | `:                          :`
 |                                          |  /                          /
 |  Options:                                |  .-                        -.
 |  6. Kernel: default/kernel (1 of 1)      |   --                      -.
 |  7. Boot Options                         |    `:`                  `:`
 |                                          |      .--             `--.
 --------------------------------------------         .---.....----.
    Autoboot in 9 seconds. [Space] to pause


Press [Enter] or just let the counter count down to zero. The kernel will finish loading.


STEP 2 - The FreeBSD Installer

Next, the "BSDinstall Main Menu" will be displayed.
	+------------Welcome--------------+
	| Welcome to FreeBSD! Would you   |
	| like to begin an installation   |
	| or use the live CD?             |
	+---------------------------------+
	| <Install> < Shell > <Live CD>   |
	+---------------------------------+

Use [Arrow] or [Tab] to select "Install". Press [Enter].


STEP 3 - Step 3 Keymap

Next, on the 'Keymap Selection' page, just press [Enter] on ">>> Continue with default keymap" if this is a US keyboard.
Otherwise, select your keyboard using up/down [Arrow] keys and press [Enter].


STEP 4 - Hostname
        +------------------Set Hostname---------------------+
	| Please choose a hostname for this machine.        |
	|                                                   |
	| If you are running on a managed network, please   |
	| ask your network administrator for an appropriate |
	| name.                                             |
	| +-----------------------------------------------+ |
	| | fbsd133.local                                 | |
	| +-----------------------------------------------+ |
	+---------------------------------------------------+
	|                     <  OK  >                      |
	+---------------------------------------------------+

STEP 5 - Distribution Sets

Select the distribution options to be installed. (Use [Arrow] keys and select/unselect with [Space].) I recommend only a bare minimum with only the optional src components. If you plan on using jails or upgrading by rebuilding world, system source code should be installed now. Ports can be manual installed by fetching the latest one via 'portsnap'.
        +-----------------Distribution Select----------------------------+
	| Choose optional system components to install:                  |
	| +------------------------------------------------------------+ |
	| | [ ] base-dbg    Base system (Debugging)                    | |
	| | [ ] kernel-dbg  Kernel (Debugging)                         | |
	| | [ ] lib32-dbg   32-bit compatibility libraries (Debugging) | |
	| | [ ] lib32       32-bit compatibility libraries             | |
	| | [ ] ports       Ports tree                                 | |
	| | [*] src         System source code                         | |
	| | [ ] tests       Test suite                                 | |
	| +------------------------------------------------------------+ |
	|                                                                |
	|                                                                |
	|                                                                |
	+----------------------------------------------------------------+
	|                      <  OK  >                                  |
	+----------------------------------------------------------------+

Use the up and down [Arrow] keys to highlight the options.
Press [Space] to change the option selection (*=selected).
Deselect 'kernel-dbg' and 'lib32'.
System source code is for a development system, jails or kernel compilation.
Ports will be installed with latest, after the install.

Press [Enter] to continue.


STEP 6 - Partitioning Method
        +------------------------Partitioning---------------------------+
	| How would you like to partition your disk?                    |
	| +-----------------------------------------------------------+ |
	| |   Auto (ZFS)  Guided Root-on-ZFS                          | |	
	| |   Auto (UFS)  Guided Disk Setup                           | |
	| |   Manual      Manual Disk Setup (experts)                 | |
	| |   Shell       Open a shell and partition by hand          | |
	| +-----------------------------------------------------------+ |
	|                                                               |
	|                                                               |
	+---------------------------------------------------------------+
	|                 <  OK  >          <Cancel>                    |
	+---------------------------------------------------------------+

Unless your system has less than 8GB of RAM, ZFS is the preferred filesystem. Otherwise, choose the old UFS method. For ZFS, just press [Enter] to use the default Auto (ZFS) partitioning tool.
(Auto ZFS is required for software mirroring or RAID disks)


STEP 7 - ZFS Configuration
        +----------------ZFS Configuration-------------------+
	| Configure Options:                                 |
	| +------------------------------------------------+ |
	| | >>> Install          Proceed with Installation | |
	| | T Pool Type/Disks:   stripe: 0 disks           | |
	| | - Rescan Devices     *                         | |
	| | - Disk Info          *                         | |
	| | N Pool Name          zroot                     | |
	| | 4 Force 4K Sectors?  YES                       | |
	| | E Encrypt Disks?     NO                        | |
	| | P Partition Scheme   GPT (BIOS)                | |
	| | S Swap Size          2g                        | |
	| | M Mirror Swap?       NO                        | |
	| | W Encrypt Swap?      NO                        | |
	| +------------------------------------------------+ |
	|                                                    |
	+----------------------------------------------------+
	|         < Select >       < Cancel >                |
	+----------------------------------------------------+
[Arrow] down to Pool Type/Disks and press [Enter].

STEP 8 - ZFS Configuration (cont.)
        +----------------ZFS Configuration-------------------+
	| Select Virtual Device type:                        |
	| +------------------------------------------------+ |
	| | stripe  Stripe - No Redundancy                 | |
	| | mirror  Mirror - n-Way Mirroring               | |
	| | raid10  RAID 1+0 - n x 2-Way Mirrors           | |
	| | raidz1  RAID-Z1 - Single Redundant RAID        | |
	| | raidz2  RAID-Z2 - Double Redundant RAID        | |
	| | raidz1  RAID-Z3 - Triple Redundant RAID        | |
	| +------------------------------------------------+ |
	|                                                    |
	+----------------------------------------------------+
	|           <  OK  >       < Cancel >                |
	+----------------------------------------------------+

For a single physical disk, on stripe Stripe - No Redundancy press [Enter]
For two disk mirroring, choose mirror or for multi-disk RAID, choose appropriately.

STEP 9 ZFS Configuration (cont.)

A list of all drives will be displayed. Use the [Arrow] down key and the [Space]
key to select the drive for the boot disk. In this example, we have a single
M.2 NVMe SSD drive and our booted USB. Warning, da0 is our USB installation drive, don't select it! Only the NVM Express SSD is being selected for OS installation.
        +----------------ZFS Configuration-------------------+
	|                                                    |
	| +------------------------------------------------+ |
	| | [ ] da0   Philips USB Flash Drive              | |
	| | [*] nvd0  Apacer AS2280P4 256GB                | |
	| +------------------------------------------------+ |
	|                                                    |
	+----------------------------------------------------+
	|           <  OK  >       < Back >                  |
	+----------------------------------------------------+
Use the [Space] to select the drive, then press [Enter].

        +----------------ZFS Configuration-------------------+
	| Configure Options:                                 |
	| +------------------------------------------------+ |
	| | >>> Install          Proceed with Installation | |
	| | T Pool Type/Disks:   stripe: 1 disk            | |
	| | - Rescan Devices     *                         | |
	| | - Disk Info          *                         | |
	| | N Pool Name          zroot                     | |
	| | 4 Force 4K Sectors?  YES                       | |
	| | E Encrypt Disks?     NO                        | |
	| | P Partition Scheme   GPT (BIOS)                | |
	| | S Swap Size          2g                        | |
	| | M Mirror Swap?       NO                        | |
	| | W Encrypt Swap?      NO                        | |
	| +------------------------------------------------+ |
	|                                                    |
	+----------------------------------------------------+
	|         < Select >       < Cancel >                |
	+----------------------------------------------------+
[Arrow] down to the Swap Size (default 2G) and press [Enter].
Make the Swap Size at least half, if not equal to the physical RAM size. Then press [Enter].

        +----------------ZFS Configuration-------------------+
	| Configure Options:                                 |
	| +------------------------------------------------+ |
	| | >>> Install          Proceed with Installation | |
	| | T Pool Type/Disks:   stripe: 1 disk            | |
	| | - Rescan Devices     *                         | |
	| | - Disk Info          *                         | |
	| | N Pool Name          zroot                     | |
	| | 4 Force 4K Sectors?  YES                       | |
	| | E Encrypt Disks?     NO                        | |
	| | P Partition Scheme   GPT (BIOS)                | |
	| | S Swap Size             8g                     | |
	| | M Mirror Swap?       NO                        | |
	| | W Encrypt Swap?      NO                        | |
	| +------------------------------------------------+ |
	|                                                    |
	+----------------------------------------------------+
	|         < Select >       < Cancel >                |
	+----------------------------------------------------+
[Arrow] up to >>> Install and press [Enter].

STEP 10 ZFS Configuration (cont.)
        +--------------ZFS Configuration----------------+
	| Last Chance! Are you sure you want to destroy |
	| the current contents of the following disks:  |
	|                                               |
	| nvd0                                          |
	|                                               |
	+-----------------------------------------------+
	|              < Yes >        < No >            |
	+-----------------------------------------------+
This is the final confirmation. Up until now, nothing has been written
to the disk. Proceeding will erase all existing data.
Use [Tab] or [Arrow] to select 'Yes'.
Press [Enter] to continue ...

The installation extraction will quickly proceed.


STEP 11 - Set root Password

The root password is very important. Make it secure and don't loose it.

Enter the password twice.


STEP 12 - Network Configuration
   +-----------------------------------------------------------------------------+
   | Please select a network interface to configure:                             |
   | +-------------------------------------------------------------------------+ |
   | |   re0   RealTek 8169/8169S/8169SB(L)/8110S/8110SB(L) Gigabit Ethernet   | |
   | |   re1   RealTek 8169/8169S/8169SB(L)/8110S/8110SB(L) Gigabit Ethernet   | |
   | +-------------------------------------------------------------------------+ |
   |                                                                             |
   |                                                                             |
   +-----------------------------------------------------------------------------+
   |                      < OK >           < Cancel >                            |
   +-----------------------------------------------------------------------------+
Select the interface to be configured first.
It can be configured for IPv4 and/or IPv6.
It can be DHCP client, or manually configured.


STEP 13 - Local time
        +-----------Select local or UTC (Greenwich Mean Time) clock-------------+
	| Is this machine's CMOS clock set to UTC?  If it is set to local time, |
	| or you don't know, please choose NO here!                             |
	|                                                                       |
	+-----------------------------------------------------------------------+
	|                     < Yes >           < No  >                         |
	+-----------------------------------------------------------------------+
Normally the machine time is already set for local time,
so select 'No' and [Enter]


STEP 14 - Time Zone
        +-------Time Zone Selector----------+
	| Select a region                   |
	| +-------------------------------+ |
	| | 1  Africa                     | |
	| | 2  America -- North and South | |
	| | 3  Antarctica                 | |
	| | 4  Artic Ocean                | |
	| | 5  Asia                       | |
	| | 6  Atlantic Ocean             | |
	| | 7  Australia                  | |
	| | 8  Europe                     | |
	| | 9  Indian Ocean               | |
	| | 0  Pacific Ocean              | |
	| | a  UTC                        | |
	| +-------------------------------+ |
	+-----------------------------------+
	|       <  OK  >    <Cancel>        |
	+-----------------------------------+
Choose a region and then a country
This setting will be important for a number of programs, so set it correctly.
Verify and confirm setting. Skip any manual time and date settings.


STEP 15 - System Configuration
        +------------------------System Configuration---------------------------+
	| Choose the services you would like to be started at boot:             |
	| +-------------------------------------------------------------------+ |
	| | [ ] local_unbound  Local caching validating resolver              | |
	| | [*] sshd           Secure shell daemon                            | |
	| | [ ] moused         PS/2 mouse pointer on console                  | |
	| | [*] ntpdate        Synchronize system and network time at bootime | |
	| | [*] ntpd           Synchronize system and network time            | |
	| | [*] powerd         Adjust CPU frequency dynamically if supported  | |
	| | [ ] dumpdev        Enable kernel crash dumps to /var/crash        | |
	| +-------------------------------------------------------------------+ |
	|                                                                       |
	|                                                                       |
	+-----------------------------------------------------------------------+
	|                               <  OK  >                                |
	+-----------------------------------------------------------------------+
Use the up/down [Arrow] to select and [Space] key to enable/disable.
This system is going to be a web server, without X11 or other GUI, and
therefore a mouse will not be required. Enable both ntpdate and ntpd so
the system clock will be properly synchronized at boot time and then the
time settings will be maintained from network time.
Enable powerd option for energy saving.
Hint: Do not enable powerd if this is a virtual machine.
Only enable dumpdev for development systems.
Press [Enter] to continue ...


STEP 16 - System Hardening
   +----------------------------System Hardening---------------------------------+
   | Choose system security hardening options:                                   |
   | +-------------------------------------------------------------------------+ |
   | | [ ] 0 hide_uids       Hide processes running as other users             | |
   | | [ ] 1 hide_gids       Hide processes running as other groups            | |
   | | [ ] 2 hide_jail       Hide processes running in jails                   | |
   | | [ ] 3 read_msgbuf     Disable reading kernel message buffer for unprivil| |
   | | [ ] 4 proc_debud      Disable process debugging facilities for unprivile| |
   | | [ ] 5 random_pid      Randomize the PID of newly created processes      | |
   | | [ ] 6 clear_tmp       Clean the /tmp filesystem on system startup       | |
   | | [ ] 7 disable_syslog  Disable opening Syslogd network socket (disables r| |
   | | [ ] 8 disable_sendmailDisable Sendmail service                          | |
   | | [ ] 9 secure_console  Enable console password prompt                    | |
   | | [ ] 10 disable_ddtraceDisallow DTrace destructive-mode                  | |
   | +-------------------------------------------------------------------------+ |
   |                                                                             |
   |                                                                             |
   +-----------------------------------------------------------------------------+
   |                                  <  OK  >                                   |
   +-----------------------------------------------------------------------------+
Choose hardening options you desire. If this is a development machine in VM,
it might be a good idea to disable Syslogd and Sendmail.


STEP 17 - Add User Accounts
        +----Add User Accounts------+
	| Would you like to add     |
	| users to the installed    |
	| system now?               |
	+---------------------------+
	|     < Yes >   < No  >     |
	+---------------------------+
For remote access via SSH, a normal user account is required. FreeBSD
does not allow remote access via 'root' user. The correct method is to
create a user, add them to the 'wheel' group so they can 'su' to root.
FreeBSD does not have 'sudo', however it can be installed from Ports or Packages.
FreeBSD Installer
========================
Add Users

Username: john [Enter]
Full name: John Doe [Enter]
UID (Leave empty for default): [Enter]
Login group [john]: [Enter]
Login group is john. Invite john into other groups? []: wheel operator[Enter]
Login class [default]: [Enter]
Shell (sh csh tcsh nologin) [sh]: [Enter]
Home directory [/home/john]: [Enter]
Home directory permissions (Leave empty for default): [Enter]
Use password-based authentication? [yes]: [Enter]
Use an empty password? (yes/no) [no]: [Enter]
Use a random password? (yes/no) [no]: [Enter]
Enter password: ********
Enter password again: ********
Lock out the account after creation? [no]: [Enter]
OK? (yes/no): y [Enter]
adduser: INFO: Successfully added (john) to user database.
Add another user? (yes/no): n [Enter]

STEP 18 - Final Configuration
        +-----------------------Final Configuration-----------------------------+
	| Setup of your FreeBSD system is nearly complete. You can now modify   |
	| your configuration choices. After this screen, you will have an       |
	| opportunity to make more complex changes using a shell.               |
	| +-------------------------------------------------------------------+ |
	| |   Exit                Apply configuration and exit installer      | |
	| |   Add User          Add a user to the system                      | |
	| |   Root Password     Change root password                          | |
	| |   Hostname          Set system hostname                           | |
	| |   Network           Networking configuration                      | |
	| |   Services          Set daemons to run on startup                 | |
	| |   System Hardening  Set security options                          | |
	| |   Time Zone         Set system timezone                           | |
	| |   Handbook          Install FreeBSD Handbook (requires network)   | |
	| +-------------------------------------------------------------------+ |
	|                                                                       |
	|                                                                       |
	+-----------------------------------------------------------------------+
	|                              <  OK  >                                 |
	+-----------------------------------------------------------------------+
We have basically already done these, so it is time to exit. Press [Enter].

STEP 19 - Manual Configuration
        +-------Manual Configuration----------+
	| The installation is now finished.   |
	| Before exiting the installer, would |
	| you like to open a shell in the new |
	| system to make any final manual     |
	| modifications?                      |
	+-------------------------------------+
	|         < Yes >     < No  >         |
	+-------------------------------------+
[Tab] or left [Arrow] to 'Yes' if a shell is desired,
otherwise press [Enter] on 'No'.

STEP 20 - Reboot
        +---------Complete-----------+
	| Installation of FreeBSD    |
	| complete! Would you like   |
	| to reboot into the         |
	| installed system now?      |
	+----------------------------+
	|   <Reboot >  <Live CD>     |
	+----------------------------+
The installation is complete, press [Enter] to reboot. Remove the USB flash drive.

For more information, see the FreeBSD Handbook.