aboutsummaryrefslogtreecommitdiff
path: root/documentation/content/en/books/handbook/bsdinstall/_index.adoc
blob: 2afaa9418ed7344fbf5f9b1b793a12761926f14f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
---
title: Chapter 2. Installing FreeBSD
part: Part I. Getting Started
prev: books/handbook/introduction
next: books/handbook/basics
description: Guide about how to install FreeBSD, the minimum hardware requirements and supported architectures, how to create the installation media, etc
tags: ["bsdinstall", "installing FreeBSD", "requirements", "tutorial", "guide"]
showBookMenu: true
weight: 4
path: "/books/handbook/"
aliases: ["/en/books/handbook/bsdinstall-hardware/","/en/books/handbook/bsdinstall-pre/","/en/books/handbook/bsdinstall-start/","/en/books/handbook/using-bsdinstall/","/en/books/handbook/bsdinstall-partitioning/","/en/books/handbook/bsdinstall-fetching-distribution/","/en/books/handbook/bsdinstall-post/","/en/books/handbook/bsdinstall-network/","/en/books/handbook/bsdinstall-install-trouble/","/en/books/handbook/using-live-cd/"]
---

[[bsdinstall]]
= Installing FreeBSD
:doctype: book
:toc: macro
:toclevels: 1
:icons: font
:sectnums:
:sectnumlevels: 6
:sectnumoffset: 2
:partnums:
:source-highlighter: rouge
:experimental:
:images-path: books/handbook/bsdinstall/

ifdef::env-beastie[]
ifdef::backend-html5[]
:imagesdir: ../../../../images/{images-path}
endif::[]
ifndef::book[]
include::shared/authors.adoc[]
include::shared/mirrors.adoc[]
include::shared/releases.adoc[]
include::shared/attributes/attributes-{{% lang %}}.adoc[]
include::shared/{{% lang %}}/teams.adoc[]
include::shared/{{% lang %}}/mailing-lists.adoc[]
include::shared/{{% lang %}}/urls.adoc[]
toc::[]
endif::[]
ifdef::backend-pdf,backend-epub3[]
include::../../../../../shared/asciidoctor.adoc[]
endif::[]
endif::[]

ifndef::env-beastie[]
toc::[]
include::../../../../../shared/asciidoctor.adoc[]
endif::[]

[[bsdinstall-synopsis]]
== Synopsis

FreeBSD supports different architectures including amd64, ARM(R), RISC-V(R), and PowerPC(R).
Depending on the architecture and platform, different images can be link:https://www.freebsd.org/where/[downloaded] to install or directly run FreeBSD.

The image types are:

* Virtual Machine disk images, such as `qcow2`, `vmdk`, `vhd`, and raw device images. These are not installation images, but images that have FreeBSD preinstalled and ready for post-installation tasks. Virtual machine images are also commonly used in cloud environments.
* SD card images, for embedded systems such as Raspberry Pi. These files must be uncompressed and written as a raw image to an SD card, from which the board will boot.
* Installation images to boot from an ISO or USB device to install FreeBSD on a drive for the usual desktop, laptop, or server system.

The rest of this chapter describes the third case, explaining how to install FreeBSD using the text-based installation program named bsdinstall.
There may be minor differences between the installer and what is shown here, so use this chapter as a general guide rather than as a set of literal instructions.

After reading this chapter, you will know:

* How to obtain FreeBSD images and create FreeBSD installation media.
* How to start bsdinstall.
* The questions bsdinstall will ask, what they mean, and how to answer them.
* How to troubleshoot a failed installation.
* How to access a live version of FreeBSD before committing to an installation.

[[bsdinstall-hardware]]
== Minimum Hardware Requirements

The hardware requirements to install FreeBSD vary by architecture and version.
Hardware architectures and devices supported by a FreeBSD release are listed on the link:https://www.FreeBSD.org/releases/[FreeBSD Release Information] page.
The link:https://www.FreeBSD.org/where/[FreeBSD download page] also has recommendations for choosing the correct image for different architectures.

[[bsdinstall-pre]]
== Pre-Installation Tasks

Once it has been determined that the system meets the minimum hardware requirements for installing FreeBSD, the installation file should be downloaded and the installation media prepared.
Before doing this, check that the system is ready for an installation by verifying the items in this checklist:

[.procedure]
====
. *Back Up Important Data*
+
Before installing any operating system, *always* backup all important data first.
Do not store the backup on the system being installed.
Instead, save the data to a removable disk such as a USB drive, another system on the network, or an online backup service.
Test the backup before starting the installation to make sure it contains all of the needed files.
Once the installer formats the system's disk, all data stored on that disk will be lost.
. *Decide Where to Install FreeBSD*
+
If FreeBSD will be the only operating system installed, this step can be skipped.
But if FreeBSD will share the disk with another operating system, decide which disk or partition will be used for FreeBSD.
+
In the i386 and amd64 architectures, disks can be divided into multiple partitions using one of two partitioning schemes.
A traditional _Master Boot Record_ (MBR) holds a partition table defining up to four _primary partitions_.
For historical reasons, FreeBSD calls these primary partition _slices_.
One of these primary partitions can be made into an _extended partition_ containing multiple _logical partitions_.
The _GUID Partition Table_ (GPT) is a newer and simpler method of partitioning a disk.
Common GPT implementations allow up to 128 partitions per disk, eliminating the need for logical partitions.
+
The FreeBSD boot loader requires either a primary or GPT partition.
If all of the primary or GPT partitions are already in use, one must be freed for FreeBSD.
To create a partition without deleting existing data, use a partition resizing tool to shrink an existing partition and create a new partition using the freed space.
+
A variety of free and commercial partition resizing tools are listed at link:https://en.wikipedia.org/wiki/List_of_disk_partitioning_software[List of disk partitioning software wikipedia entry].
link:https://gparted.org/livecd.php[GParted Live] is a free live CD which includes the GParted partition editor.
+
[WARNING]
======
When used properly, disk shrinking utilities can safely create space for creating a new partition.
Since the possibility of selecting the wrong partition exists, always backup any important data and verify the integrity of the backup before modifying disk partitions.
======
+
Disk partitions containing different operating systems make it possible to install multiple operating systems on one computer.
An alternative is to use virtualization (crossref:virtualization[virtualization,Virtualization]) which allows multiple operating systems to run at the same time without modifying any disk partitions.
. *Collect Network Information*
+
Some FreeBSD installation methods require a network connection in order to download the installation files.
After any installation, the installer will offer to setup the system's network interfaces.
+
If the network has a DHCP server, it can be used to provide automatic network configuration.
If DHCP is not available, the following network information for the system must be obtained from the local network administrator or Internet service provider:
+
[[bsdinstall-collect-network-information]]
Required Network Information

.. IP address
.. Subnet mask
.. IP address of default gateway
.. Domain name of the network
.. IP addresses of the network's DNS servers

. *Check for FreeBSD Errata*
+
Although the FreeBSD Project strives to ensure that each release of FreeBSD is as stable as possible, bugs occasionally creep into the process.
On very rare occasions those bugs affect the installation process.
As these problems are discovered and fixed, they are noted in the FreeBSD Errata page of each version.
Check the errata before installing to make sure that there are no problems that might affect the installation.
+
Information and errata for all the releases can be found on the link:https://www.FreeBSD.org/releases/[FreeBSD Release Information] page.
====

[[bsdinstall-installation-media]]
=== Prepare the Installation Media

The FreeBSD installer is not an application that can be run from within another operating system.
Instead, download a FreeBSD installation file, burn it to the media associated with its file type and size (CD, DVD, or USB), and boot the system to install from the inserted media.

FreeBSD installation files are available at the link:https://www.FreeBSD.org/where/[FreeBSD download page].
Each installation file's name includes the release version of FreeBSD, the architecture, and the type of file.

Installation files are available in several formats, compressed with man:xz[1] or uncompressed.
The formats vary depending on computer architecture and media type.

Installation file types:

* `*-bootonly.iso*`: This is the smallest installation file as it only contains the installer. A working Internet connection is required during installation as the installer will download the files it needs to complete the FreeBSD installation. This file should be burned to optical media.
* `*-disc1.iso*`: This file contains all of the files needed to install FreeBSD, its source, and the Ports Collection. This file should be burned to optical media.
* `*-dvd1.iso*`: This file contains all of the files needed to install FreeBSD, its source, and the Ports Collection. It also contains a set of popular binary packages for installing a window manager and some applications so that a complete system can be installed from media without requiring a connection to the Internet. This file should be burned to optical media.
* `*-memstick.img*`: This file contains all of the files needed to install FreeBSD, its source, and the Ports Collection. Write this file to a USB stick as shown in <<bsdinstall-usb>>.
* `*-mini-memstick.img*`: Like `*-bootonly.iso*`, does not include installation files, but downloads them as needed. A working internet connection is required during installation. It should be written to a USB stick as shown in <<bsdinstall-usb>>.

After downloading the image file, download at least one _checksum_ file from the same directory.
There are two _checksum_ files available, named after the release number and the architecture name.
For example: `CHECKSUM.SHA256-FreeBSD-13.1-RELEASE-amd64` and `CHECKSUM.SHA512-FreeBSD-13.1-RELEASE-amd64`.

After downloading one of the files (or both), calculate the _checksum_ for the image file and compare it with the one shown in the _checksum_ file.
Note that you need to compare the calculated _checksum_ against the correct file, as they correspond to two different algorithms: SHA256 and SHA512.
FreeBSD provides man:sha256[1] and man:sha512[1] that can be used for calculating the _checksum_.
Other operating systems have similar programs.

Verifying the _checksum_ in FreeBSD can be done automatically using man:sha256sum[1] (and man:sha512sum[1]) by executing:

[source,shell]
....
% sha256sum -c CHECKSUM.SHA256-FreeBSD-13.1-RELEASE-amd64 FreeBSD-13.1-RELEASE-amd64-dvd1.iso
FreeBSD-13.1-RELEASE-amd64-dvd1.iso: OK
....

The checksums must match exactly.
If the checksums do not match, the image file is corrupt and must be downloaded again.

[[bsdinstall-usb]]
==== Writing an Image File to USB

The `\*memstick.img` file is an _image_ of the complete contents of a memory stick.
It _cannot_ be copied to the target device as a file.
Several applications are available for writing the `*.img` to a USB stick.
This section describes two of these utilities.

[IMPORTANT]
====
Before proceeding, back up any important data on the USB stick.
This procedure will erase the existing data on the stick.
====

[[bsdinstall-usb-dd]]
[.procedure]
====
*Procedure. Using `dd` to Write the Image* +

[WARNING]
======
This example uses `/dev/da0` as the target device where the image will be written.
Be *very careful* that the correct device is used as this command will destroy the existing data on the specified target device.
======

. The command-line utility is available on BSD, Linux(R), and Mac OS(R) systems. To burn the image using `dd`, insert the USB stick and determine its device name. Then, specify the name of the downloaded installation file and the device name for the USB stick. This example burns the amd64 installation image to the first USB device on an existing FreeBSD system.
+
[source,shell]
....
# dd if=FreeBSD-13.0-RELEASE-amd64-memstick.img of=/dev/da0 bs=1M conv=sync
....
+
If this command fails, verify that the USB stick is not mounted and that the device name is for the disk, not a partition.
+
Some operating systems might require this command to be run with man:sudo[8].
The man:dd[1] syntax varies slightly across different platforms; for example, Mac OS(R) requires a lower-case `bs=1m`.
Systems like Linux(R) might buffer writes.
To force all writes to complete, use man:sync[8].
====

[.procedure]
====
*Procedure. Using Windows(R) to Write the Image* +

[WARNING]
======
Be sure to give the correct drive letter as the existing data on the specified drive will be overwritten and destroyed.
======

. *Obtaining Image Writer for Windows(R)*
+
Image Writer for Windows(R) is a free application that can correctly write an image file to a memory stick.
Download it from https://sourceforge.net/projects/win32diskimager/[win32diskimager home page] and extract it into a folder.

. *Writing the Image with Image Writer*
+
Double-click the Win32DiskImager icon to start the program.
Verify that the drive letter shown under `Device` is the drive with the memory stick.
Click the folder icon and select the image to be written to the memory stick.
Click btn:[Save] to accept the image file name.
Verify that everything is correct, and that no folders on the memory stick are open in other windows.
When everything is ready, click btn:[Write] to write the image file to the memory stick.
====

[[bsdinstall-start]]
== Starting the Installation

[IMPORTANT]
====
By default, the installation will not make any changes to the disk(s) before the following message:

[.programlisting]
....
Your changes will now be written to disk. If you
have chosen to overwrite existing data, it will
be PERMANENTLY ERASED. Are you sure you want to
commit your changes?
....

The install can be exited at any time prior to this warning.
If there is a concern that something is incorrectly configured, just turn the computer off before this point and no changes will be made to the system's disks.
====

This section describes how to boot the system from the installation media which was prepared using the instructions in <<bsdinstall-installation-media>>.
When using a bootable USB stick, plug in the USB stick before turning on the computer.
When booting from CD or DVD, turn on the computer and insert the media at the first opportunity.
How to configure the system to boot from the inserted media depends upon the architecture.

[[bsdinstall-view-probe]]
=== FreeBSD Boot Menu

Once the system boots from the installation media, a menu similar to the following will be displayed:

[[bsdinstall-newboot-loader-menu]]
.FreeBSD Boot Loader Menu
image::bsdinstall-newboot-loader-menu.png[FreeBSD boot loader menu]

By default, the menu will wait ten seconds for user input before booting into the FreeBSD installer or, if FreeBSD is already installed, before booting into FreeBSD.
To pause the boot timer in order to review the selections, press kbd:[Space].
To select an option, press its highlighted number, character, or key.
The following options are available.

* `Boot Multi User`: This will continue the FreeBSD boot process. If the boot timer has been paused, press kbd:[1], upper- or lower-case kbd:[B], or kbd:[Enter].
* `Boot Single User`: This mode can be used to fix an existing FreeBSD installation as described in crossref:boot[boot-singleuser,“Single-User Mode”]. Press kbd:[2] or the upper- or lower-case kbd:[S] to enter this mode.
* `Escape to loader prompt`: This will boot the system into a repair prompt that contains a limited number of low-level commands. This prompt is described in crossref:boot[boot-loader,“Stage Three”]. Press kbd:[3] or kbd:[Esc] to boot into this prompt.
* `Reboot`: Reboots the system.
* `Cons`: Allow to continue the installation by `video`, `serial`, `Dual (serial primary)` or `Dual (Video primary)`
* `Kernel`: Loads a different kernel.
* `Boot Options`: Opens the menu shown in, and described under, <<bsdinstall-boot-options-menu>>.

[[bsdinstall-boot-options-menu]]
.FreeBSD Boot Options Menu
image::bsdinstall-boot-options-menu.png[Menu showing the different boot options supported]

The boot options menu is divided into two sections.
The first section can be used to either return to the main boot menu or to reset any toggled options back to their defaults.

The next section is used to toggle the available options to `On` or `Off` by pressing the option's highlighted number or character.
The system will always boot using the settings for these options until they are modified.
Several options can be toggled using this menu:

* `ACPI Support`: If the system hangs during boot, try toggling this option to `Off`.
* `Safe Mode`: If the system still hangs during boot even with `ACPI Support` set to `Off`, try setting this option to `On`.
* `Single User`: Toggle this option to `On` to fix an existing FreeBSD installation as described in crossref:boot[boot-singleuser,“Single-User Mode”]. Once the problem is fixed, set it back to `Off`.
* `Verbose`: Toggle this option to `On` to see more detailed messages during the boot process. This can be useful when troubleshooting a piece of hardware.

After making the needed selections, press kbd:[1] or kbd:[Backspace] to return to the main boot menu, then press kbd:[Enter] to continue booting into FreeBSD.
A series of boot messages will appear as FreeBSD carries out its hardware device probes and loads the installation program.
Once the boot is complete, the welcome menu shown in <<bsdinstall-choose-mode>> will be displayed.

[[bsdinstall-choose-mode]]
.Welcome Menu
image::bsdinstall-choose-mode.png[FreeBSD installation welcome menu]

Press kbd:[Enter] to select the default of btn:[Install] to enter the installer.
The rest of this chapter describes how to use this installer.
Otherwise, use the right or left arrows or the colorized letter to select the desired menu item.
The btn:[Shell] can be used to access a FreeBSD shell in order to use command line utilities to prepare the disks before installation.
The btn:[Live CD] option can be used to try out FreeBSD before installing it.
The live version is described in <<using-live-cd>>.

[TIP]
====
To review the boot messages, including the hardware device probe, press the upper- or lower-case kbd:[S] and then kbd:[Enter] to access a shell.
At the shell prompt, type `more /var/run/dmesg.boot` and use the space bar to scroll through the messages.
When finished, type `exit` to return to the welcome menu.
====

[[using-bsdinstall]]
== Using bsdinstall

This section shows the order of the bsdinstall menus and the type of information that will be asked before the system is installed.
Use the arrow keys to highlight a menu option, then kbd:[Space] to select or deselect that menu item.
When finished, press kbd:[Enter] to save the selection and move onto the next screen.

[[bsdinstall-keymap]]
=== Selecting the Keymap Menu

Before starting the process, bsdinstall will load the keymap files as shown in <<bsdinstall-keymap-loading>>.

[[bsdinstall-keymap-loading]]
.Keymap Loading
image::bsdinstall-keymap-loading.png[Keymap loading]

After the keymaps have been loaded, bsdinstall displays the menu shown in <<bsdinstall-keymap-10>>.
Use the up and down arrows to select the keymap that most closely represents the mapping of the keyboard attached to the system.
Press kbd:[Enter] to save the selection.

[[bsdinstall-keymap-10]]
.Keymap Selection Menu
image::bsdinstall-keymap-10.png[Keymap selection menu showing all supported keyboards]

[NOTE]
====
Pressing kbd:[Esc] will exit this menu and use the default keymap.
If the choice of keymap is not clear, [.guimenuitem]#United States of America ISO-8859-1# is also a safe option.
====

In addition, when selecting a different keymap, the user can try the keymap and ensure it is correct before proceeding, as shown in <<bsdinstall-keymap-testing>>.

[[bsdinstall-keymap-testing]]
.Keymap Testing Menu
image::bsdinstall-keymap-testing.png[Keymap testing menu]

[[bsdinstall-hostname]]
=== Setting the Hostname

The next bsdinstall menu is used to set the hostname for the newly installed system.

[[bsdinstall-config-hostname]]
.Setting the Hostname
image::bsdinstall-config-hostname.png[Setting the hostname]

Type in a hostname that is unique for the network.
It should be a fully-qualified hostname, such as `machine3.example.com`.

[[bsdinstall-components]]
=== Selecting Components to Install

Next, bsdinstall will prompt to select optional components to install.

[[bsdinstall-config-components]]
.Selecting Components to Install
image::bsdinstall-config-components.png[Different components that can be installed. Example: base-dbg, lib32, ports, etc.]

Deciding which components to install will depend largely on the intended use of the system and the amount of disk space available.
The FreeBSD kernel and userland, collectively known as the _base system_, are always installed.
Depending on the architecture, some of these components may not appear:

* `base-dbg` - Base tools like cat and ls, among many others, with debug symbols activated.
* `kernel-dbg` - Kernel and modules with debug symbols activated.
* `lib32-dbg` - Compatibility libraries for running 32-bit applications on a 64-bit version of FreeBSD with debug symbols activated.
* `lib32` - Compatibility libraries for running 32-bit applications on a 64-bit version of FreeBSD.
* `ports` - The FreeBSD Ports Collection is a collection of files which automates the downloading, compiling and installation of third-party software packages. crossref:ports[ports,Installing Applications: Packages and Ports] discusses how to use the Ports Collection.
+
[WARNING]
====
The installation program does not check for adequate disk space.
Select this option only if sufficient hard disk space is available.
The FreeBSD Ports Collection takes up about {ports-size} of disk space.
====

* `src` - The complete FreeBSD source code for both the kernel and the userland. Although not required for the majority of applications, it may be required to build device drivers, kernel modules, or some applications from the Ports Collection. It is also used for developing FreeBSD itself. The full source tree requires 1 GB of disk space and recompiling the entire FreeBSD system requires an additional 5 GB of space.
* `tests` - FreeBSD Test Suite.

[[bsdinstall-netinstall]]
=== Installing from the Network

The menu shown in <<bsdinstall-netinstall-notify>> only appears when installing from a `-bootonly.iso` or `-mini-memstick.img`, as this installation media does not hold copies of the installation files.
Since the installation files must be retrieved over a network connection, this menu indicates that the network interface must be configured first.
If this menu is shown in any step of the process, remember to follow the instructions in <<bsdinstall-config-network-dev>>.

[[bsdinstall-netinstall-notify]]
.Installing from the Network
image::bsdinstall-netinstall-files.png[Indicates that certain components have not been found and will be downloaded using the network.]

[[bsdinstall-partitioning]]
== Allocating Disk Space

The next menu is used to determine the method for allocating disk space.

[[bsdinstall-zfs-partmenu]]
.Partitioning Choices
image::bsdinstall-zfs-partmenu.png[Shows the different partition options. Example: Manual, Shell, etc.]

bsdinstall gives the user four methods for allocating disk space:

* `Auto (ZFS)` partitioning creates a root-on-ZFS system with optional GELI encryption support for _boot environments_.
* `Auto (UFS)` partitioning automatically sets up the disk partitions using the `UFS` file system.
* `Manual` partitioning allows advanced users to create customized partitions from menu options.
* `Shell` opens a shell prompt where advanced users can create customized partitions using command-line utilities like man:gpart[8], man:fdisk[8], and man:bsdlabel[8].

This section describes what to consider when laying out the disk partitions.
It then demonstrates how to use the different partitioning methods.

[[configtuning-initial]]
=== Designing the Partition Layout

The default partition layout for file systems includes one file system for the entire system.
When using `UFS` it may be worth considering the use of multiple file systems if you have sufficient disk space or multiple disks.
When laying out file systems, remember that hard drives transfer data faster from the outer tracks to the inner.
Thus, smaller and heavier-accessed file systems should be closer to the outside of the drive, while larger partitions like `/usr` should be placed toward the inner parts of the disk.
It is a good idea to create partitions in an order similar to: `/`, swap, `/var`, and `/usr`.

The size of the `/var` partition reflects the intended machine's usage.
This partition is used to hold mailboxes, log files, and printer spools.
Mailboxes and log files can grow to unexpected sizes depending on the number of users and how long log files are kept.
On average, most users rarely need more than about a gigabyte of free disk space in `/var`.

[NOTE]
====
Sometimes, a lot of disk space is required in `/var/tmp`.
When new software is installed, the packaging tools extract a temporary copy of the packages under `/var/tmp`.
Large software packages, like Firefox or LibreOffice may be tricky to install if there is not enough disk space under `/var/tmp`.
====

The `/usr` partition holds many of the files which support the system, including the FreeBSD Ports Collection and system source code.
At least 2 gigabytes of space is recommended for this partition.
Also, note that home directories for users are placed in `/usr/home` by default, but can be placed on another partition. 
By default, `/home` is a symbolic link to `/usr/home`.

When selecting partition sizes, keep the space requirements in mind.
Running out of space in one partition while barely using another can be a hassle.

As a rule of thumb, the swap partition should be about double the size of physical memory (RAM).
Systems with minimal RAM (less for larger-memory configurations) may perform better with more swap.
Configuring too little swap can lead to inefficiencies in the VM page scanning code and might create issues later if more memory is added.

On larger systems with multiple SCSI disks or multiple IDE disks operating on different controllers, it is recommended that swap be configured on each drive, up to four drives.
The swap partitions should be approximately the same size.
The kernel can handle arbitrary sizes, but internal data structures scale to 4 times the largest swap partition.
Keeping the swap partitions near the same size will allow the kernel to optimally stripe swap space across disks.
Large swap sizes may elicit a kernel warning message about the total configured swap.
The limit is raised by increasing the amount of memory allowed for keeping track of swap allocations, as instructed by the warning message.
It might be easier to recover from a runaway program before being forced to reboot.

By properly partitioning a system, fragmentation introduced in the smaller write-heavy partitions will not bleed over into the mostly read partitions.
Keeping the write-loaded partitions closer to the disk's edge will increase I/O performance in the partitions where it occurs the most.
While I/O performance in the larger partitions may be needed, shifting them more toward the edge of the disk will not lead to a significant performance improvement over moving `/var` to the edge.

[[bsdinstall-part-guided]]
=== Guided Partitioning Using UFS

When this method is selected, a menu will display the available disk(s).
If multiple disks are connected, choose the one where FreeBSD is to be installed.

[[bsdinstall-part-guided-disk]]
.Selecting from Multiple Disks
image::bsdinstall-part-guided-disk.png[Shows the list of disks on which FreeBSD can be installed]

Once the disk is selected, the next menu prompts to install to either the entire disk or to create a partition using free space.
If btn:[Entire Disk] is chosen, a general partition layout filling the whole disk is automatically created.
Selecting btn:[Partition] creates a partition layout from the unused space on the disk.

[[bsdinstall-part-entire-part]]
.Selecting Entire Disk or Partition
image::bsdinstall-part-entire-part.png[Menu asking the user if he wants to use all the available space on the disk or wants to make a partition]

After the btn:[Entire Disk] option is chosen, bsdinstall displays a dialog indicating that the disk will be erased.

[[bsdinstall-ufs-warning]]
.Confirmation
image::bsdinstall-ufs-warning.png[Menu indicating the user that all data on the disk will be deleted and asking for confirmation]

The next menu shows a list with the available partition scheme types.
GPT is usually the most appropriate choice for amd64 computers.
Older computers that are not compatible with GPT should use MBR.
The other partition schemes are generally used for uncommon or older computers.
More information is available in <<partition-schemes>>.

[[bsdinstall-ufs-scheme]]
.Select Partition Scheme
image::bsdinstall-part-manual-partscheme.png[Menu showing the user the different the different types of partition that exist and requesting one of them]

After the partition layout has been created, review it to ensure it meets the needs of the installation.
Selecting btn:[Revert] will reset the partitions to their original values. Pressing btn:[Auto] will recreate the automatic FreeBSD partitions.
Partitions can also be manually created, modified, or deleted.
When the partitioning is correct, select btn:[Finish] to continue with the installation.

[[bsdinstall-part-review]]
.Review Created Partitions
image::bsdinstall-part-review.png[Menu showing created partitions]

Once the disks are configured, the next menu provides the last chance to make changes before the selected drives are formatted.
If changes need to be made, select btn:[Back] to return to the main partitioning menu.
btn:[Revert & Exit] exits the installer without making any changes to the drive.
Otherwise, select btn:[Commit] to start the installation process.

[[bsdinstall-ufs-final-confirmation]]
.Final Confirmation
image::bsdinstall-final-confirmation.png[Menu indicating to the user that all changes will be written to disk and informing that if he decides to continue the existing data will be permanently deleted.]

To continue with the installation process, go to <<bsdinstall-fetching-distribution>>.

[[bsdinstall-part-manual]]
=== Manual Partitioning

Selecting this method opens the partition editor:

[[bsdinstall-part-manual-create]]
.Manually Create Partitions
image::bsdinstall-part-manual-create.png[Menu showing the Partition Editor.]

Highlight the installation drive (`ada0` in this example) and select btn:[Create] to display a menu of available partition schemes:

[[bsdinstall-part-manual-partscheme]]
.Manually Create Partitions
image::bsdinstall-part-manual-partscheme.png[Menu showing the different kind of partition schemes]

GPT is usually the most appropriate choice for amd64 computers.
Older computers that are not compatible with GPT should use MBR.
The other partition schemes are generally used for uncommon or older computers.

[[partition-schemes]]
.Partitioning Schemes
[cols="25h,~", frame="none", options="header"]
|===
<| Abbreviation
<| Description

|APM
|Apple Partition Map, used by PowerPC(R).

|BSD
|BSD label without an MBR, sometimes called _dangerously dedicated mode_ as non-BSD disk utilities may not recognize it.

|GPT
|link:https://en.wikipedia.org/wiki/GUID_Partition_Table[GUID Partition Table].

|MBR
|link:https://en.wikipedia.org/wiki/Master_boot_record[Master Boot Record].
|===

After the partitioning scheme has been selected and created, select btn:[Create] again to create the partitions.
The kbd:[Tab] key is used to move the cursor between fields.

[[bsdinstall-part-manual-addpart]]
.Manually Create Partitions
image::bsdinstall-part-manual-addpart.png[Menu requesting type, size, mountpoint and label for the new partition.]

A standard FreeBSD GPT installation uses at least three partitions, including either UFS or ZFS:

* `freebsd-boot` or `efi` - Holds the FreeBSD boot code.
* `freebsd-ufs` - A FreeBSD UFS file system.
* `freebsd-zfs` - A FreeBSD ZFS file system. More information about ZFS is available in crossref:zfs[zfs,The Z File System (ZFS)].
* `freebsd-swap` - FreeBSD swap space.

Refer to man:gpart[8] for descriptions of the available GPT partition types.

Multiple file system partitions can be created. Some people prefer a traditional layout with separate partitions for `/`, `/var`, `/tmp`, and `/usr`.

[TIP]
====
Note that `/tmp` can be added later as a memory-based file system (man:tmpfs[5]) on systems with sufficient memory.
====

See <<bsdinstall-part-manual-splitfs>> for an example.

The `Size` may be entered with common abbreviations: _K_ for kilobytes, _M_ for megabytes, or _G_ for gigabytes.

[TIP]
====
Proper sector alignment provides the best performance, and making partition sizes even multiples of 4K bytes helps to ensure alignment on drives with either 512-byte or 4K-byte sectors.
Generally, using partition sizes that are even multiples of 1M or 1G is the easiest way to make sure every partition starts at an even multiple of 4K.
There is one exception: the _freebsd-boot_ partition should be no larger than 512K due to current boot code limitations.
====

A `Mountpoint` is needed if the partition will contain a file system.
If only a single UFS partition will be created, the mountpoint should be `/`.

The `Label` is a name by which the partition will be known.
Drive names or numbers can change if the drive is connected to a different controller or port, but the partition label does not change.
Referring to labels instead of drive names and partition numbers in files like `/etc/fstab` makes the system more tolerant to hardware changes.
GPT labels appear in `/dev/gpt/` when a disk is attached.
Other partitioning schemes have different label capabilities and their labels appear in different directories in `/dev/`.

[TIP]
====
Use a unique label on every partition to avoid conflicts from identical labels.
A few letters from the computer's name, use, or location can be added to the label.
For instance, use `labroot` or `rootfslab` for the UFS root partition on the computer named `lab`.
====

[[bsdinstall-part-manual-splitfs]]
.Creating Traditional Split File System Partitions
[example]
====
For a traditional partition layout where the `/`, `/var`, `/tmp`, and `/usr` directories are separate file systems on their own partitions, create a GPT partitioning scheme, then create the partitions as shown.
Partition sizes shown are typical for a 20G target disk.
If more space is available on the target disk, larger swap or `/var` partitions may be useful.
Labels shown here are prefixed with `ex` for "example", but readers should use other unique label values as described above.

By default, FreeBSD's `gptboot` expects the first UFS partition to be the `/` partition.

[.informaltable]
[cols="1,1,1,1", frame="none", options="header"]
|===
| Partition Type
| Size
| Mountpoint
| Label

|`freebsd-boot`
|`512K`
|
|

|`freebsd-ufs`
|`2G`
|`/`
|`exrootfs`

|`freebsd-swap`
|`4G`
|
|`exswap`

|`freebsd-ufs`
|`2G`
|`/var`
|`exvarfs`

|`freebsd-ufs`
|`1G`
|`/tmp`
|`extmpfs`

|`freebsd-ufs`
|accept the default (remainder of the disk)
|`/usr`
|`exusrfs`
|===
====

After the custom partitions have been created, select btn:[Finish] to continue with the installation and go to <<bsdinstall-fetching-distribution>>.

[[bsdinstall-part-zfs]]
=== Guided Partitioning Using Root-on-ZFS

This partitioning mode only works with whole disks and will erase the contents of the entire disk.
The main ZFS configuration menu offers a number of options to control the creation of the pool.

[[bsdinstall-zfs-menu]]
.ZFS Partitioning Menu
image::bsdinstall-zfs-menu.png[Menu showing the different options to configure the ZFS pool]

Here is a summary of the options in this menu:

* `Install` - Proceed with the installation with the selected options.
* `Pool Type/Disks` - Configure the `Pool Type` and the disk(s) that will constitute the pool. The automatic ZFS installer currently only supports the creation of a single top level vdev, except in stripe mode. To create more complex pools, use the instructions in <<bsdinstall-part-shell>> to create the pool.
* `Rescan Devices` - Repopulate the list of available disks.
* `Disk Info` - This menu can be used to inspect each disk, including its partition table and various other information such as the device model number and serial number, if available.
* `Pool Name` - Establish the name of the pool. The default name is _zroot_.
* `Force 4K Sectors?` - Force the use of 4K sectors. By default, the installer will automatically create partitions aligned to 4K boundaries and force ZFS to use 4K sectors. This is safe even with 512 byte sector disks, and has the added benefit of ensuring that pools created on 512 byte disks will be able to have 4K sector disks added in the future, either as additional storage space or as replacements for failed disks. Press the kbd:[Enter] key to chose to activate it or not.
* `Encrypt Disks?` - Encrypting the disks allows the user to encrypt the disks using GELI. More information about disk encryption is available in crossref:disks[disks-encrypting-geli,“Disk Encryption with geli”]. Press the kbd:[Enter] key to choose whether to activate it or not.
* `Partition Scheme` - Choose the partition scheme. GPT is the recommended option in most cases. Press the kbd:[Enter] key to chose between the different options.
* `Swap Size` - Establish the amount of swap space.
* `Mirror Swap?` - Whether to mirror the swap between the disks. Be aware that enabling mirror swap will break crash dumps. Press the kbd:[Enter] key to activate it or not.
* `Encrypt Swap?` - Whether to encrypt the swap. This will encrypt the swap with a temporary key each time the system boots, and discards it on reboot. Press the kbd:[Enter] key to choose to activate it or not. More information about swap encryption in crossref:disks[swap-encrypting,“Encrypting Swap”].

Select kbd:[T] to configure the `Pool Type` and the disk(s) that will constitute the pool.

[[bsdinstall-zfs-vdev_type]]
.ZFS Pool Type
image::bsdinstall-zfs-vdev_type.png[Menu requesting the Virtual Device type. Ex: stripe, mirror, raidz1]

Here is a summary of the `Pool Type` that can be selected in this menu:

* `stripe` - Striping provides maximum storage of all connected devices, but no redundancy. If just one disk fails the data on the pool is lost irrevocably.
* `mirror` - Mirroring stores a complete copy of all data on every disk. Mirroring provides good read performance because data is read from all disks in parallel. Write performance is slower as the data must be written to all disks in the pool. Allows all but one disk to fail. This option requires at least two disks.
* `raid10` - Striped mirrors. Provides the best performance, but the least storage. This option needs at least an even number of disks and a minimum of four disks.
* `raidz1` - Single Redundant RAID. Allow one disk to fail concurrently. This option needs at least three disks.
* `raidz2` - Double Redundant RAID. Allows two disks to fail concurrently. This option needs at least four disks.
* `raidz3` - Triple Redundant RAID. Allows three disks to fail concurrently. This option needs at least five disks.

Once a `Pool Type` has been selected, a list of available disks is displayed, and the user is prompted to select one or more disks to make up the pool.
The configuration is then validated to ensure that enough disks are selected.
If validation fails, select btn:[<Change Selection>] to return to the list of disks or btn:[<Back>] to change the `Pool Type`.

[[bsdinstall-zfs-disk_select]]
.Disk Selection
image::bsdinstall-zfs-disk_select.png[Menu requesting how many disks will be added to the pool]

[[bsdinstall-zfs-vdev_invalid]]
.Invalid Selection
image::bsdinstall-zfs-vdev_invalid.png[Menu indicating that not enough disks have been selected.]

If one or more disks are missing from the list, or if disks were attached after the installer was started, select btn:[- Rescan Devices] to repopulate the list of available disks.

[[bsdinstall-zfs-rescan-devices]]
.Rescan Devices
image::bsdinstall-zfs-rescan-devices.png[Device rescan]

To avoid accidentally erasing the wrong disk, the btn:[- Disk Info] menu can be used to inspect each disk, including its partition table and various other information such as the device model number and serial number, if available.

[[bsdinstall-zfs-disk_info]]
.Analyzing a Disk
image::bsdinstall-zfs-disk_info.png[Menu showing the information of the partitions.]

Select kbd:[N] to configure the `Pool Name`.
Enter the desired name, then select btn:[<OK>] to establish it or btn:[<Cancel>] to return to the main menu and leave the default name.

[[bsdinstall-zfs-pool-name]]
.Pool Name
image::bsdinstall-zfs-pool-name.png[Menu requesting the name of the pool.]

Select kbd:[S] to set the amount of swap.
Enter the desired amount of swap, then select btn:[<OK>] to establish it or btn:[<Cancel>] to return to the main menu and let the default amount.

[[bsdinstall-zfs-swap-amount]]
.Swap Amount
image::bsdinstall-zfs-swap-amount.png[Menu requesting the amount of swap memory]

Once all options have been set to the desired values, select the btn:[>>> Install] option at the top of the menu.
The installer then offers a last chance to cancel before the contents of the selected drives are destroyed to create the ZFS pool.

[[bsdinstall-zfs-warning]]
.Last Chance
image::bsdinstall-zfs-warning.png[Menu indicating to the user that the data will be lost]

If GELI disk encryption was enabled, the installer will prompt twice for the passphrase to be used to encrypt the disks.
Initialization of the encryption then begins.

[[bsdinstall-zfs-geli_password]]
.Disk Encryption Password
image::bsdinstall-zfs-geli_password.png[Menu requesting the password to encrypt the devices.]

[[bsdinstall-zfs-init-encription]]
.Initializing Encryption
image::bsdinstall-zfs-init-encription.png[Menu showing that the encryption is initializing.]

The installation then proceeds normally.
To continue with the installation, go to <<bsdinstall-fetching-distribution>>.

[[bsdinstall-part-shell]]
=== Shell Mode Partitioning

When creating advanced installations, the bsdinstall partitioning menus may not provide the level of flexibility required.
Advanced users can select the btn:[Shell] option from the partitioning menu in order to manually partition the drives, create the file system(s), populate `/tmp/bsdinstall_etc/fstab`, and mount the file systems under `/mnt`.
Once this is done, type `exit` to return to bsdinstall and continue the installation.

[[bsdinstall-fetching-distribution]]
== Fetching Distribution Files

Installation time will vary depending on the distributions chosen, installation media, and speed of the computer.
A series of messages will indicate the progress.

First, the installer formats the selected disk(s) and initializes the partitions.
Next, in the case of a `bootonly media` or `mini memstick`, it downloads the selected components:

[[bsdinstall-distfile-fetching]]
.Fetching Distribution Files
image::bsdinstall-distfile-fetching.png[Menu showing the download of the different components.]

Next, the integrity of the distribution files is verified to ensure they have not been corrupted during download or misread from the installation media:

[[bsdinstall-distfile-verify]]
.Verifying Distribution Files
image::bsdinstall-distfile-verifying.png[Menu showing the verification of the different components.]

Finally, the verified distribution files are extracted to the disk:

[[bsdinstall-distfile-extract]]
.Extracting Distribution Files
image::bsdinstall-distfile-extracting.png[Menu showing the extraction of the different components.]

Once all requested distribution files have been extracted, bsdinstall displays the first post-installation configuration screen.
The available post-configuration options are described in the next section.

[[bsdinstall-post]]
== Network Interfaces, Accounts, Time Zone, Services and Hardening

[[bsdinstall-post-root]]
=== Setting the `root` Password

First, the `root` password must be set.
While entering the password, the characters being typed are not displayed on the screen.
The password must be entered twice to prevent typing errors.

[[bsdinstall-post-set-root-passwd]]
.Setting the `root` Password
image::bsdinstall-post-root-passwd.png[Menu showing requesting the password for the root user.]

[[bsdinstall-config-network-dev]]
=== Configuring Network Interfaces

Next, a list of the network interfaces found on the computer is shown.
Select the interface to configure.

[[bsdinstall-configure-net-interface]]
.Choose a Network Interface
image::bsdinstall-configure-network-interface.png[Menu showing the different network interfaces to configure.]

If an Ethernet interface is selected, the installer will skip ahead to the menu shown in <<bsdinstall-configure-net-ipv4>>.
If a wireless network interface is chosen, the system will instead scan for wireless access points:

[[bsdinstall-wireless-scan]]
.Scanning for Wireless Access Points
image::bsdinstall-configure-wireless-scan.png[Menu showing wireless network scanning.]

Wireless networks are identified by a Service Set Identifier (SSID); a short, unique name given to each network.
SSIDs found during the scan are listed, followed by a description of the encryption types available for that network.
If the desired SSID does not appear in the list, select btn:[Rescan] to scan again.
If the desired network still does not appear, check for problems with antenna connections or try moving the computer closer to the access point.
Rescan after each change is made.

[[bsdinstall-wireless-accesspoints]]
.Choosing a Wireless Network
image::bsdinstall-configure-wireless-accesspoints.png[Menu showing the different wireless networks to connect to.]

Next, enter the encryption information for connecting to the selected wireless network.
WPA2 encryption is strongly recommended over older encryption types such as WEP, which offer little security.
If the network uses WPA2, input the password, also known as the Pre-Shared Key (PSK).
For security reasons, the characters typed into the input box are displayed as asterisks.

[[bsdinstall-wireless-wpa2]]
.WPA2 Setup
image::bsdinstall-configure-wireless-wpa2setup.png[Menu requesting the wireless network password.]

Next, choose whether or not an IPv4 address should be configured on the Ethernet or wireless interface:

[[bsdinstall-configure-net-ipv4]]
.Choose IPv4 Networking
image::bsdinstall-configure-network-interface-ipv4.png[Menu indicating if IPv4 wants to be configured for the selected interface.]

There are two methods of IPv4 configuration.
DHCP will automatically configure the network interface correctly and should be used if the network provides a DHCP server.
Otherwise, the addressing information needs to be input manually as a static configuration.

[NOTE]
====
Do not enter random network information as it will not work.
If a DHCP server is not available, obtain the information listed in <<bsdinstall-collect-network-information, Required Network Information>> from the network administrator or Internet service provider.
====

If a DHCP server is available, select btn:[Yes] in the next menu to automatically configure the network interface.
The installer will appear to pause for a minute or so as it finds the DHCP server and obtains the addressing information for the system.

[[bsdinstall-net-ipv4-dhcp]]
.Choose IPv4 DHCP Configuration
image::bsdinstall-configure-network-interface-ipv4-dhcp.png[Menu indicating if DHCP wants to be configured for the selected interface.]

If a DHCP server is not available, select btn:[No] and input the following addressing information in this menu:

[[bsdinstall-net-ipv4-static]]
.IPv4 Static Configuration
image::bsdinstall-configure-network-interface-ipv4-static.png[Menu requesting data to configure IPv4 network.]

* `IP Address` - The IPv4 address assigned to this computer. The address must be unique and not already in use by another device on the local network.
* `Subnet Mask` - The subnet mask for the network.
* `Default Router` - The IP address of the network's default gateway.

The next screen will ask if the interface should be configured for IPv6. If IPv6 is available and desired, choose btn:[Yes] to select it.

[[bsdinstall-net-ipv6]]
.Choose IPv6 Networking
image::bsdinstall-configure-network-interface-ipv6.png[Menu indicating if IPv6 wants to be configured for the selected interface.]

IPv6 also has two methods of configuration.
StateLess Address AutoConfiguration (SLAAC) will automatically request the correct configuration information from a local router.
Refer to http://tools.ietf.org/html/rfc4862[rfc4862] for more information.
Static configuration requires manual entry of network information.

If an IPv6 router is available, select btn:[Yes] in the next menu to automatically configure the network interface.
The installer will appear to pause for a minute or so as it finds the router and obtains the addressing information for the system.

[[bsdinstall-net-ipv6-slaac]]
.Choose IPv6 SLAAC Configuration
image::bsdinstall-configure-network-interface-slaac.png[Menu indicating if SLAAC wants to be configured for the selected interface.]

If an IPv6 router is not available, select btn:[No] and input the following addressing information in this menu:

[[bsdinstall-net-ipv6-static]]
.IPv6 Static Configuration
image::bsdinstall-configure-network-interface-ipv6-static.png[Menu requesting data to configure IPv6 network.]

* `IPv6 Address` - The IPv6 address assigned to this computer. The address must be unique and not already in use by another device on the local network.
* `Default Router` - The IPv6 address of the network's default gateway.

The last network configuration menu is used to configure the Domain Name System (DNS) resolver, which converts hostnames to and from network addresses.
If DHCP or SLAAC was used to autoconfigure the network interface, the `Resolver Configuration` values may already be filled in.
Otherwise, enter the local network's domain name in the `Search` field.
`DNS #1` and `DNS #2` are the IPv4 and/or IPv6 addresses of the DNS servers.
At least one DNS server is required.

[[bsdinstall-net-dns-config]]
.DNS Configuration
image::bsdinstall-configure-network-ipv4-dns.png[Menu requesting data to configure DNS for the network.]

Once the interface is configured, select a mirror site that is located in the same region of the world as the computer on which FreeBSD is being installed.
Files can be retrieved more quickly when the mirror is close to the target computer, reducing installation time.

[TIP]
====
Selecting `ftp://ftp.freebsd.org (Main Site)` will automatically route you to the nearest mirror.
====

[[bsdinstall-netinstall-mirror]]
.Choosing a Mirror
image::bsdinstall-netinstall-mirrorselect.png[Menu requesting a network mirror.]

[[bsdinstall-timezone]]
=== Setting the Time Zone

The next series of menus are used to determine the correct local time by selecting the geographic region, country, and time zone.
Setting the time zone allows the system to automatically correct for regional time changes, such as daylight savings time, and perform other time zone related functions properly.

The example shown here is for a machine located in the mainland time zone of Spain, Europe.
The selections will vary according to the geographical location.

[[bsdinstall-timezone-region]]
.Select a Region
image::bsdinstall-timezone-region.png[Menu requesting the timezone region.]

The appropriate region is selected using the arrow keys and then pressing kbd:[Enter].

[[bsdinstall-timezone-country]]
.Select a Country
image::bsdinstall-timezone-country.png[Menu requesting the timezone country.]

Select the appropriate country using the arrow keys and press kbd:[Enter].

[[bsdinstall-timezone-zone]]
.Select a Time Zone
image::bsdinstall-timezone-zone.png[Menu requesting the timezone zone.]

The appropriate time zone is selected using the arrow keys and pressing kbd:[Enter].

[[bsdinstall-timezone-confirmation]]
.Confirm Time Zone
image::bsdinstall-timezone-confirm.png[Menu requesting confirmation of the selected timezone.]

Confirm the abbreviation for the time zone is correct.

[[bsdinstall-timezone-date]]
.Select Date
image::bsdinstall-timezone-date.png[Menu requesting the system date.]

The appropriate date is selected using the arrow keys and then pressing btn:[Set Date].
Otherwise, the date selection can be skipped by pressing btn:[Skip].

[[bsdinstall-timezone-time]]
.Select Time
image::bsdinstall-timezone-time.png[Menu requesting the system time.]

The appropriate time is selected using the arrow keys and then pressing btn:[Set Time].
Otherwise, the time selection can be skipped by pressing btn:[Skip].

[[bsdinstall-sysconf]]
=== Enabling Services

The next menu is used to configure which system services will be started whenever the system boots.
All of these services are optional.
Only start the services that are needed for the system to function.

[[bsdinstall-config-serv]]
.Selecting Additional Services to Enable
image::bsdinstall-config-services.png[Menu showing the different services available.]

Here is a summary of the services that can be enabled in this menu:

* `local_unbound` - Enable the DNS local unbound. It is necessary to keep in mind that this is a configuration only meant for use as a local caching forwarding resolver. If the objective is to set up a resolver for the entire network, install package:dns/unbound[].
* `sshd` - The Secure Shell (SSH) daemon is used to remotely access a system over an encrypted connection. Only enable this service if the system should be available for remote logins.
* `moused` - Enable this service if the mouse will be used from the command-line system console.
* `ntpdate` - Enable automatic clock synchronization at boot time. Note that the functionality of this program is now available in the man:ntpd[8] daemon and the man:ntpdate[8] utility will soon be retired.
* `ntpd` - The Network Time Protocol (NTP) daemon for automatic clock synchronization. Enable this service if you wish to synchronise your system clock with a remote time server or pool.
* `powerd` - System power control utility for power control and energy saving.
* `dumpdev` - Crash dumps are useful when debugging issues with the system, so users are encouraged to enable them.

[[bsdinstall-hardening]]
=== Enabling Hardening Security Options

The next menu is used to configure which security options will be enabled.
All of these options are optional.
But their use is encouraged.

[[bsdinstall-hardening-options]]
.Selecting Hardening Security Options
image::bsdinstall-hardening.png[Menu shoring the different hardening security options.]

Here is a summary of the options that can be enabled in this menu:

* `hide_uids` - Hide processes running as other users (UID). This prevents unprivileged users from seeing running processes from other users.
* `hide_gids` - Hide processes running as other groups (GID). This prevents unprivileged users from seeing running processes from other groups.
* `hide_jail` - Hide processes running in jails. This prevents unprivileged users from seeing processes running inside jails.
* `read_msgbuf` - Disable reading kernel message buffer for unprivileged users. Prevent unprivileged users from using man:dmesg[8] to view messages from the kernel's log buffer.
* `proc_debug` - Disable process debugging facilities for unprivileged users. Disables a variety of unprivileged inter-process debugging services, including some procfs functionality, `ptrace()`, and `ktrace()`. Please note that this will also prevent debugging tools such as man:lldb[1], man:truss[1] and man:procstat[1], as well as some built-in debugging facilities in certain scripting languages like PHP.
* `random_pid` - Randomize the PID of processes.
* `clear_tmp` - Clean `/tmp` when the system starts up.
* `disable_syslogd` - Disable opening the syslogd network socket. By default, FreeBSD runs syslogd in a secure way with `-s`. This prevents the daemon from listening for incoming UDP requests on port 514. With this option enabled, syslogd will instead run with `-ss`, which prevents syslogd from opening any port. For more information, see man:syslogd[8].
* `disable_sendmail` - Disable the sendmail mail transport agent.
* `secure_console` - Make the command prompt request the `root` password when entering single-user mode.
* `disable_ddtrace` - DTrace can run in a mode that affects the running kernel. Destructive actions may not be used unless explicitly enabled. Use `-w` to enable this option when using DTrace. For more information, see man:dtrace[1].
* `enable_aslr` - Enable address layout randomization. For more information about address layout randomization the link:https://en.wikipedia.org/wiki/Address_space_layout_randomization[Wikipedia article] can be consulted.

[[bsdinstall-addusers]]
=== Add Users

The next menu prompts to create at least one user account.
It is recommended to log into the system using a user account rather than as `root`.
When logged in as `root`, there are essentially no limits or protection on what can be done.
Logging in as a normal user is safer and more secure.

Select btn:[Yes] to add new users.

[[bsdinstall-add-user1]]
.Add User Accounts
image::bsdinstall-adduser1.png[Menu requesting if a user want to be added to the system.]

Follow the prompts and input the requested information for the user account.
The example shown in <<bsdinstall-add-user2>> creates the `asample` user account.

[[bsdinstall-add-user2]]
.Enter User Information
image::bsdinstall-adduser2.png[Menu requesting different information for the new user.]

Here is a summary of the information to input:

* `Username` - The name the user will enter to log in. A common convention is to use the first letter of the first name combined with the last name, as long as each username is unique for the system. The username is case sensitive and should not contain any spaces.
* `Full name` - The user's full name. This can contain spaces and is used as a description for the user account.
* `Uid` - User ID. This is typically left blank so the system automatically assigns a value.
* `Login group` - The user's group. This is typically left blank to accept the default.
* `Invite _user_ into other groups?` - Additional groups to which the user will be added as a member. If the user needs administrative access, type `wheel` here.
* `Login class` - Typically left blank for the default.
* `Shell` - Type in one of the listed values to set the interactive shell for the user. Refer to crossref:basics[shells,Shells] for more information about shells.
* `Home directory` - The user's home directory. The default is usually correct.
* `Home directory permissions` - Permissions on the user's home directory. The default is usually correct.
* `Use password-based authentication?` - Typically `yes` so that the user is prompted to input their password at login.
* `Use an empty password?` - Typically `no` as empty or blank passwords are insecure.
* `Use a random password?` - Typically `no` so that the user can set their own password in the next prompt.
* `Enter password` - The password for this user. Typed-in characters will not be shown on the screen.
* `Enter password again` - The password must be typed again for verification.
* `Lock out the account after creation?` - Typically `no` so that the user can log in.

After entering all the details, a summary is shown for review.
If a mistake was made, enter `no` to correct it.
Once everything is correct, enter `yes` to create the new user.

[[bsdinstall-add-user3]]
.Exit User and Group Management
image::bsdinstall-adduser3.png[Menu showing the information of the new user and requesting if everything is correct.]

If there are more users to add, answer the `Add another user?` question with `yes`.
Enter `no` to finish adding users and continue the installation.

For more information on adding users and user management, see crossref:basics[users-synopsis,Users and Basic Account Management].

[[bsdinstall-final-conf]]
=== Final Configuration

After everything has been installed and configured, a final chance is provided to modify settings.

[[bsdinstall-final-config]]
.Final Configuration
image::bsdinstall-finalconfiguration.png[Menu showing different options to perform before finishing the installation. Ex: Add user, Time Zone, etc.]

Use this menu to make any changes or to do any additional configuration before completing the installation.

* `Add User` - Described in <<bsdinstall-addusers>>.
* `Root Password` - Described in <<bsdinstall-post-root>>.
* `Hostname` - Described in <<bsdinstall-hostname>>.
* `Network` - Described in <<bsdinstall-config-network-dev>>.
* `Services` - Described in <<bsdinstall-sysconf>>.
* `System Hardening` - Described in <<bsdinstall-hardening>>.
* `Time Zone` - Described in <<bsdinstall-timezone>>.
* `Handbook` - Download and install the FreeBSD Handbook.

Once configuration is complete, select btn:[Exit].

[[bsdinstall-final-modification-shell]]
.Manual Configuration
image::bsdinstall-final-modification-shell.png[Menu showing that the installation has finished. And asking if you want to open a shell to make manual changes.]

bsdinstall will prompt for any additional configuration that needs to be done before rebooting into the new system.
Select btn:[Yes] to exit to a shell within the new system or btn:[No] to proceed to the last step of the installation.

[[bsdinstall-final-main]]
.Complete the Installation
image::bsdinstall-mainexit.png[Menu showing that the installation has finished and asking whether to reboot the system or access the Live CD.]

If further configuration or special setup is needed, select btn:[Live CD] to boot the install media into Live CD mode.

If the installation is complete, select btn:[Reboot] to reboot the computer and start the new FreeBSD system.
Do not forget to remove the FreeBSD install media or the computer might boot from it again.

As FreeBSD boots, informational messages are displayed.
After the system finishes booting, a login prompt is displayed.
At the `login:` prompt, enter the username added during the installation.
Avoid logging in as `root`.
Refer to crossref:basics[users-superuser,The Superuser Account] for instructions on how to become the superuser when administrative access is needed.

The messages that appear during boot can be reviewed by pressing kbd:[Scroll-Lock] to turn on the scroll-back buffer.
The kbd:[PgUp], kbd:[PgDn], and arrow keys can be used to scroll back through the messages.
When finished, press kbd:[Scroll-Lock] again to unlock the display and return to the console.
To review these messages once the system has been up for some time, type `less /var/run/dmesg.boot` from a command prompt.
Press kbd:[q] to return to the command line after viewing.

If sshd was enabled in <<bsdinstall-config-serv>>, the first boot might be a bit slower as the system generates SSH host keys.
Subsequent boots will be faster.
The fingerprints of the keys are then displayed as in the following example:

[source,shell]
....
Generating public/private rsa1 key pair.
Your identification has been saved in /etc/ssh/ssh_host_key.
Your public key has been saved in /etc/ssh/ssh_host_key.pub.
The key fingerprint is:
10:a0:f5:af:93:ae:a3:1a:b2:bb:3c:35:d9:5a:b3:f3 root@machine3.example.com
The key's randomart image is:
+--[RSA1 1024]----+
|    o..          |
|   o . .         |
|  .   o          |
|       o         |
|    o   S        |
|   + + o         |
|o . + *          |
|o+ ..+ .         |
|==o..o+E         |
+-----------------+
Generating public/private dsa key pair.
Your identification has been saved in /etc/ssh/ssh_host_dsa_key.
Your public key has been saved in /etc/ssh/ssh_host_dsa_key.pub.
The key fingerprint is:
7e:1c:ce:dc:8a:3a:18:13:5b:34:b5:cf:d9:d1:47:b2 root@machine3.example.com
The key's randomart image is:
+--[ DSA 1024]----+
|       ..     . .|
|      o  .   . + |
|     . ..   . E .|
|    . .  o o . . |
|     +  S = .    |
|    +  . = o     |
|     +  . * .    |
|    . .  o .     |
|      .o. .      |
+-----------------+
Starting sshd.
....

Refer to crossref:security[openssh,"OpenSSH"] for more information about fingerprints and SSH.

FreeBSD does not install a graphical environment by default.
Refer to crossref:x11[x11,The X Window System] for more information about installing and configuring a graphical window manager.

Proper shutdown of a FreeBSD computer helps protect data and hardware from damage.
_Do not turn off the power before the system has been properly shut down!_ If the user is a member of the `wheel` group, become the superuser by typing `su` at the command line and entering the `root` password.
Then, type `shutdown -p now` and the system will shut down cleanly, and, if the hardware supports it, turn itself off.

[[bsdinstall-install-trouble]]
== Troubleshooting

This section covers basic installation troubleshooting, such as common problems people have reported.

Check the Hardware Notes listed on the link:https://www.FreeBSD.org/releases/[FreeBSD Release Information] page for the version of FreeBSD to make sure the hardware is supported.

[NOTE]
====
Some installation problems can be avoided or alleviated by updating the firmware on various hardware components, most notably the motherboard.
Motherboard firmware is usually referred to as the BIOS.
Most motherboard and computer manufacturers have a website for upgrades and upgrade information.

Manufacturers generally advise against upgrading the motherboard BIOS unless there is a good reason for doing so, like a critical update.
The upgrade process _can_ go wrong, leaving the BIOS incomplete and the computer inoperative.
====

If the system hangs while probing hardware during boot or behaves strangely during the installation process, ACPI may be the culprit.
FreeBSD makes extensive use of the system ACPI service on the i386 and amd64 platforms to aid in system configuration if it is detected during boot.
Unfortunately, some bugs still exist in both the ACPI driver and within system motherboards and BIOS firmware.
ACPI can be disabled by setting the `hint.acpi.0.disabled` hint in the third stage boot loader:

[source,shell]
....
set hint.acpi.0.disabled="1"
....

This is reset each time the system is booted, so it is necessary to add `hint.acpi.0.disabled="1"` to the file `/boot/loader.conf`.
More information about the boot loader can be found in crossref:boot[boot-synopsis,“Synopsis”].

[[using-live-cd]]
== Using the Live CD

The welcome menu of bsdinstall, shown in <<bsdinstall-choose-mode>>, provides a btn:[Live CD] option.
This is useful for those who are still wondering whether FreeBSD is the right operating system for them and want to test some of the features before installing.

The following points should be noted before using the btn:[Live CD]:

* To gain access to the system, authentication is required. The username is `root` and the password is blank.
* As the system runs directly from the installation media, performance will be significantly slower than that of a system installed on a hard disk.
* This option only provides a command prompt and not a graphical interface.