Annotation of doc/en/books/usersguide/installation/chapter.sgml, revision 1.2
1.1 justin 1: <!--
2: $DragonFly$
3: -->
4: <chapter id="installation-cd">
5: <chapterinfo>
6: <authorgroup>
7: <author>
8: <firstname>Markus</firstname>
9: <surname>Schatzl</surname>
10: <contrib>Written by </contrib>
11: </author> <!-- lists@neuronenwerk.de 05 May 2004 -->
12: <author>
13: <firstname>Justin</firstname>
14: <surname>Sherrill</surname>
15: </author> <!-- justin@dragonflybsd.org 05 May 2004 -->
16: </authorgroup>
17: </chapterinfo>
18: <title>Installation from CD</title>
19:
20: <sect1 id="installation-cd-synopsis">
21: <title>CD Installation Overview</title>
22: <para>This document describes the installation of DragonFly BSD on a plain i386
23: machine. This process uses a bootable DragonFly CD, usually referred to as a
24: 'live CD'.</para>
25:
26: <para>This CD is available at one of the current mirrors, which distribute the images
27: by various protocols. The authorative list can be found at the
28: <ulink url="http://www.dragonflybsd.org/main/download.cgi">DragonFly website</ulink>.</para>
29:
1.2 ! justin 30: <para>This document may be superseded by the /README file located on the live CD,
! 31: which may reflect changes made after this document was last updated. Check that
! 32: README for any last-minute changes and for an abbreviated version of this installation
! 33: process.</para>
! 34:
1.1 justin 35: <para>The DragonFly development team is working on an automatic installation
36: tool, which simplifies the partitioning and installation processes. Until this
37: tool is in place, the manual process here is required. Some experience with
38: BSD-style tools is recommended.</para>
39:
40: <caution>
41: <para>While this guide covers installing to
42: a computer with an existing non-DragonFly operating system, take no chances! Back up
43: any data on your disk drives that you want to save.</para>
44: </caution>
45:
46: <para>When installing to an old machine, it may not be possible to boot from
47: a CD. Use a bootmanager on a floppy in those cases, such as
48: <ulink url="http://btmgr.sourceforge.net/">Smart Bootmanager</ulink>.</para>
1.2 ! justin 49:
! 50: <caution>
! 51: <para>Always be sure of the target disk for any command. Unless otherwise
! 52: specified, each command here assumes the first disk in the IDE chain is
! 53: the target. (ad0) Adjust commands as needed.</para>
! 54: </caution>
! 55:
1.1 justin 56: </sect1>
57:
58: <sect1 id="installation-cd-preinstall">
59: <title>CD Installation - Making room</title>
60:
61: <sect2>
62: <title>DragonFly as the only operating system</title>
63: <para>If DragonFly is to be the only operating system on the target computer, preparing
64: the disk is a short and simple process. Boot with the live CD, and log in as root
65: to reach a command prompt.</para>
66:
67: <para>First, the master boot record (MBR) must be cleared of any old information. This
68: command clears all old data off your disk by writing zeros (if=/dev/zero) onto the
69: system's master ata drive (of=/dev/ad0).</para>
70:
71: <!-- put in big fat note about disk naming -->
72:
73: <screen>
1.2 ! justin 74: &prompt.root; <userinput>dd if=/dev/zero of=/dev/<replaceable>ad0</replaceable> bs=32k count=16</userinput>
1.1 justin 75: </screen>
76:
1.2 ! justin 77: <para>The now-empty disk must be formatted. </para>
! 78:
! 79: <important>
! 80: <para>This will destroy any existing data on a disk. Do this only if
! 81: you plan to dedicate this disk to DragonFly.</para>
! 82: </important>
1.1 justin 83:
84: <screen>
1.2 ! justin 85: &prompt.root; <userinput>fdisk -I <replaceable>ad0</replaceable></userinput>
! 86: &prompt.root; <userinput>fdisk -B <replaceable>ad0</replaceable></userinput>
1.1 justin 87: </screen>
1.2 ! justin 88:
1.1 justin 89: </sect2>
90:
91: <sect2>
92: <title>Multiple operating systems on one hard disk</title>
93: <para>This example assumes that the target computer for installation has at least
94: one operating system installed that needs to survive the installation process.
95: A new partition for DragonFly needs to be created from the existing
96: partition(s) that otherwise fill the disk. There must be unused space within
97: the existing partition in order to resize it.</para>
98:
99: <important>
100: <para>The new partition is created from empty space in an existing partition.
101: For example, an 18 gigabyte disk that has 17 gigabytes of existing data in the existing
102: partition will only have 1 gigabyte available for the new partition.</para>
103: </important>
104:
105: <para>Partition resizing needs to be accomplished with a third-party tool. Commercial
106: programs such as <ulink url="http://www.symantec.com/partitionmagic/">Partition Magic</ulink>
107: can accomplish these tasks. Free tools exist that can be adapted to this task, such as
108: 'GNU parted', found on the
109: <ulink url="http://www.knopper.net/knoppix-mirrors/index-en.html">Knoppix CD</ulink>,
110: or <ulink url="http://paud.sourceforge.net">PAUD</ulink>.
111: </para>
112:
113: <para>Create a new partition of at least 5-6 gigabytes. It is possible to
1.2 ! justin 114: install within a smaller amount of disk space, but this will create
! 115: problems not covered by this document. The newly created partition
1.1 justin 116: does not need to be formatted; the rest of the
117: installation process treats that new partiton as a new disk.</para>
118: </sect2>
119:
120: <sect2>
121: <title>Multiple operating systems, multiple hard disks</title>
122: <para>Installing DragonFly to a separate disk removes the need
123: for partition resizing, and is generally safer when trying to preserve
124: an existing operating system installation.</para>
125:
126: <para>This type of installation is very similar to installing DragonFly
1.2 ! justin 127: as the only operating system. The only difference is the disk named
! 128: in each command.</para>
1.1 justin 129:
130: </sect2>
131: </sect1>
132:
133: <sect1 id="installation-cd-disk">
134: <title>CD Installation - Disk setup</title>
135:
136: <sect2>
137: <title>Disk formatting</title>
1.2 ! justin 138: <para>The slice layout on the newly formatted disk or partition needs
! 139: to be set up, using this command. </para>
1.1 justin 140:
141: <screen>
142: &prompt.root; <userinput>fdisk -u</userinput>
143: </screen>
144:
145: <!-- reword -->
146: <para>If there are multiple operating systems on the disk, pick the correct
147: partition judging by what partitions were created earlier with a resizing tool.</para>
148: </sect2>
149:
150: <sect2>
151: <title>Boot block installation</title>
152: <para>The 'ad0' here refers to the first disk on the first IDE bus of a computer.
153: Increment the number if the target disk is farther down the chain. For example,
154: the master disk on the second IDE controller would be 'ad2'.</para>
155:
156: <!-- write list here of adx to drive mapping, and scsi too -->
157:
158: <screen>
1.2 ! justin 159: &prompt.root; <userinput>boot0cfg -B <replaceable>ad0</replaceable></userinput>
! 160: &prompt.root; <userinput>boot0cfg -v <replaceable>ad0</replaceable></userinput>
1.1 justin 161: </screen>
162:
163: <para><userinput>-s SLICE</userinput>, where SLICE is a number, controls which
164: slice on disk is used by boot0cfg to start from. By default, this number is 1, and
165: will only need modification if a different slice contains DragonFly.</para>
166:
1.2 ! justin 167: <para>Use <userinput>-o packet</userinput> as an option to boot0cfg if the DragonFly
! 168: partition is located beyond cylinder 1023 on the disk. This location problem usually
! 169: only happens when another operating system is taking up more than the
! 170: first 8 gigabytes of disk space. This problem cannot happen if DragonFly is
! 171: installed to a dedicated disk </para>
! 172:
1.1 justin 173: </sect2>
174:
175: <sect2>
176: <title>Disklabel</title>
177: <para>If DragonFly is installed anywhere but the first partition of the disk,
178: the device entry for that partition will have to be created. Otherwise, the
179: device entry is automatically created. Refer to this different partition
1.2 ! justin 180: instead of the 'ad0s1a' used in later examples.</para>
1.1 justin 181:
182: <screen>
1.2 ! justin 183: &prompt.root; <userinput>cd /dev; ./MAKEDEV <replaceable>ad0s2</replaceable></userinput>
1.1 justin 184: </screen>
185:
186: <para>The partition needs to be created on the DragonFly disk.</para>
187:
188: <screen>
1.2 ! justin 189: &prompt.root; <userinput>disklabel -B -r -w <replaceable>ad0s1</replaceable> auto</userinput>
1.1 justin 190: </screen>
191:
192: <para>Using /etc/disklabel.ad0s1 as an example, issue the following command to
193: edit the disklabel for the just-created partition.</para>
194:
195: <screen>
1.2 ! justin 196: &prompt.root; <userinput>disklabel -e <replaceable>ad0s1</replaceable></userinput>
1.1 justin 197: </screen>
198:
199:
200: <informaltable>
201: <tgroup cols="3">
202: <thead>
203: <row>
204: <entry>Partition</entry>
205: <entry>Size</entry>
206: <entry>Mountpoint</entry>
207: </row>
208: </thead>
209:
210: <tbody>
211:
212: <row>
213: <entry>ad0s2a
214: <entry>256m
215: <entry>/
216: </row>
217:
218: <row>
219: <entry>ad0s2b
220: <entry>1024m
221: <entry>swap
222: </row>
223:
224: <row>
225: <entry>ad0s2c
226: <entry>leave alone
227: <entry>This represents the whole slice.
228: </row>
229:
230: <row>
231: <entry>ad0s2d
232: <entry>256m
233: <entry>/var
234: </row>
235:
236: <row>
237: <entry>ad0s2e
238: <entry>256m
239: <entry>/tmp !
240: </row>
241:
242: <row>
243: <entry>ad0s2f
244: <entry>8192m
245: <entry>/usr - This should be at least 4096m
246: </row>
247:
248: <row>
249: <entry>ad0s2g
250: <entry>*
251: <entry>/home - This holds 'everything else'
252: </row>
253:
254: </tbody>
255: </tgroup>
256: </informaltable>
257:
258: </sect2>
259:
260: <sect2>
261: <title>Partition Format</title>
262: <para>newfs will format each individual partition. </para>
263:
264: <screen>
1.2 ! justin 265: &prompt.root; <userinput>newfs /dev/<replaceable>ad0s1a</replaceable></userinput>
! 266: &prompt.root; <userinput>newfs -U /dev/<replaceable>ad0s1d</replaceable></userinput>
! 267: &prompt.root; <userinput>newfs -U /dev/<replaceable>ad0s1e</replaceable></userinput>
! 268: &prompt.root; <userinput>newfs -U /dev/<replaceable>ad0s1f</replaceable></userinput>
! 269: &prompt.root; <userinput>newfs -U /dev/<replaceable>ad0s1g</replaceable></userinput>
1.1 justin 270: </screen>
271:
272: <note>
1.2 ! justin 273: <para>The -U option is not used for the root partition,
! 274: since / is usually relatively small. Softupdates can cause it to
! 275: run out of space while under a lot of disk activity, such as a buildworld.</para>
1.1 justin 276: </note>
277:
1.2 ! justin 278: <note>
1.1 justin 279: <para>The command listing skips directly from ad0s1a to ad0s1d. This is
280: because /dev/ad0s1b is used as swap and does not require formatting;
1.2 ! justin 281: ad0s1c refers to the entire disk and should not be formatted.</para>
1.1 justin 282: </note>
283: </sect2>
284: </sect1>
285:
1.2 ! justin 286: <sect1 id="installation-cd-to-disk">
! 287: <title>Installing to Disk</title>
! 288: <para>Since the Live CD contains all needed data to create a running DragonFly system,
! 289: the simplest installation possible is to copy the Live CD data to the newly formatted
! 290: disk/partition created in previous steps.
! 291: </para>
! 292:
! 293: <para>These commands mount the newly created disk space and create the
! 294: appropriate directories on it.</para>
! 295:
! 296: <screen>
! 297: &prompt.root; <userinput>mount /dev/<replaceable>ad0s1a</replaceable> /mnt</userinput>
! 298: &prompt.root; <userinput>mkdir /mnt/var</userinput>
! 299: &prompt.root; <userinput>mkdir /mnt/tmp</userinput>
! 300: &prompt.root; <userinput>mkdir /mnt/usr</userinput>
! 301: &prompt.root; <userinput>mkdir /mnt/home</userinput>
! 302: &prompt.root; <userinput>mount /dev/<replaceable>ad0s1d</replaceable> /mnt/var</userinput>
! 303: &prompt.root; <userinput>mount /dev/<replaceable>ad0s1e</replaceable> /mnt/tmp</userinput>
! 304: &prompt.root; <userinput>mount /dev/<replaceable>ad0s1f</replaceable> /mnt/usr</userinput>
! 305: &prompt.root; <userinput>mount /dev/<replaceable>ad0s1g</replaceable> /mnt/home</userinput>
! 306: </screen>
! 307:
! 308: <para>cpdup duplicates data from one volume to another. These commands copy
! 309: data from the Live CD to the newly created directories on the mounted disk.
! 310: Each step can take some time, depending on disk speed.</para>
! 311:
! 312: <screen>
! 313: &prompt.root; <userinput>cpdup / /mnt</userinput>
! 314: &prompt.root; <userinput>cpdup /var /mnt/var</userinput>
! 315: &prompt.root; <userinput>cpdup /etc /mnt/etc</userinput>
! 316: &prompt.root; <userinput>cpdup /dev /mnt/dev</userinput>
! 317: &prompt.root; <userinput>cpdup /usr /mnt/usr</userinput>
! 318: </screen>
! 319:
! 320: <note>
! 321: <para>Nothing is copied to the /tmp directory that was created
! 322: in the previous step. This is not an error, since /tmp is intended only
! 323: for temporary storage.</para>
! 324: </note>
! 325:
! 326: </sect1>
1.1 justin 327:
328: <sect1 id="installation-cd-postinstall">
329: <title>CD Installation - Post-install cleanup</title>
1.2 ! justin 330:
! 331: <para>/tmp and /var/tmp are both often used as temporary directories. Since
! 332: use is not consistent from application to application, it is worthwhile to
! 333: create /tmp as a link to /var/tmp so space is not wasted in duplication.
! 334: </para>
! 335:
! 336: <screen>
! 337: &prompt.root; <userinput>chmod 1777 /mnt/tmp</userinput>
! 338: &prompt.root; <userinput>rm -fr /mnt/var/tmp</userinput>
! 339: &prompt.root; <userinput>ln -s /tmp /mnt/var/tmp</userinput>
! 340: </screen>
! 341:
! 342: <note>
! 343: <para>/tmp will not work until the computer is rebooted.</para>
! 344: </note>
! 345:
! 346: <para>The file /etc/fstab describes the disk partition layout. However,
! 347: the version copied to the target disk only reflects the Live CD layout.
! 348: The installed /mnt/fstab.example can be used as a starting point for
! 349: creating a new /etc/fstab.</para>
! 350:
! 351: <screen>
! 352: &prompt.root; <userinput>vi /mnt/etc/fstab.example</userinput>
! 353: &prompt.root; <userinput>mv /mnt/etc/fstab.example /mnt/etc/fstab</userinput>
! 354: </screen>
! 355:
! 356: <para>A corrupted disklabel will render a disk useless. While this is
! 357: thankfully very rare, having a backup of the new install's disklabel may
! 358: stave off disaster at some point in the future. This is optional.
! 359: (Adjust the slice name to reflect the actual installation.)</para>
! 360:
! 361: <screen>
! 362: &prompt.root; <userinput>disklabel <replaceable>ad0s1</replaceable> > /mnt/etc/disklabel.backup</userinput>
! 363: </screen>
! 364:
! 365: <note>
! 366: <para>Nothing is copied to the /tmp directory that was created
! 367: in the previous step. This is not an error, since /tmp is intended only
! 368: for temporary storage.</para>
! 369: </note>
! 370:
! 371: <para>Remove some unnecessary files copied over from the Live CD.</para>
1.1 justin 372:
1.2 ! justin 373: <screen>
! 374: &prompt.root; <userinput>rm /mnt/boot/loader.conf</userinput>
! 375: &prompt.root; <userinput>rm /mnt/boot.catalog</userinput>
! 376: &prompt.root; <userinput>rm -r /mnt/rr_moved</userinput>
! 377: </screen>
! 378:
! 379: <para>The system can now be rebooted. Be sure to remove the Live CD from the
! 380: CDROM drive so that the computer can boot from the newly-installed disk.</para>
! 381:
! 382: <screen>
! 383: &prompt.root; <userinput>reboot</userinput>
! 384: </screen>
! 385:
! 386: <note>
! 387: <para>Use the reboot command so that the disk can be unmounted cleanly.
! 388: Hitting the power or reset buttons, while it won't hurt the Live CD,
! 389: can leave the mounted disk in a inconsistent state. </para>
! 390: </note>
! 391:
! 392: <para>If the system refuses to boot, there are several options to try:</para>
1.1 justin 393:
1.2 ! justin 394: <itemizedlist>
! 395: <listitem>
! 396:
! 397: <para>Old bootblocks can interfere with the initialization-process. To
! 398: avoid this, zero-out the MBR. "of" should be changed to the correct disk
! 399: entry if ad0 is not the targeted installation disk.</para>
1.1 justin 400:
1.2 ! justin 401: <screen>
! 402: &prompt.root; <userinput>dd if=/dev/zero of=/dev/<replaceable>ad0</replaceable> bs=32 count=16</userinput>
! 403: </screen>
! 404:
! 405: </listitem>
! 406: <listitem>
! 407:
! 408: <para>It is possible that the DragonFly slice is beyond cylinder 1023 on the
! 409: hard disk, and can't be detected. Packet mode can fix this problem.</para>
! 410:
! 411: <screen>
! 412: &prompt.root; <userinput>boot0cfg -o packet <replaceable>ad0</replaceable></userinput>
! 413: </screen>
! 414:
! 415: </listitem>
! 416: <listitem>
! 417:
! 418: <para>If you can select CHS or LBA mode in your BIOS, try changing
! 419: the mode to LBA.</para>
! 420:
! 421: </listitem>
! 422: </itemizedlist>
! 423:
! 424: <para>After a successful boot from the newly installed hard drive, the timezone
! 425: should be set. Use the command <command>tzsetup</command> to set the appropriate
! 426: time zone.
! 427: </para>
! 428:
! 429: <screen>
! 430: &prompt.root; <userinput>tzsetup</userinput>
! 431: </screen>
1.1 justin 432:
1.2 ! justin 433: </sect1>
1.1 justin 434:
435:
436:
437:
438: <sect1 id="installation-system-setup">
439: <title>CD Installation - New system setup</title>
440:
1.2 ! justin 441: <para>Once the new DragonFly system is booting from disk, there are a number of
! 442: steps that may be useful before working further. The file /etc/rc.conf controls a
! 443: number of options for booting the system.
! 444: </para>
1.1 justin 445:
1.2 ! justin 446: <sect2>
! 447: <title>Setting up rc.conf</title>
! 448: <para>Depending on location, a different keyboard map may be needed. This is
! 449: only necessary for computers outside of North America.</para>
1.1 justin 450:
1.2 ! justin 451: <screen>
! 452: &prompt.root; <userinput>kbdmap</userinput>
! 453: </screen>
1.1 justin 454:
1.2 ! justin 455: <para>Pick the appropriate keyboard map and remember the name. Place this
! 456: name in /etc/rc.conf. For example:</para>
1.1 justin 457:
1.2 ! justin 458: <screen>
! 459: <userinput>keymap="german.iso.kbd"</userinput>
! 460: </screen>
1.1 justin 461:
1.2 ! justin 462: <para>The file /etc/rc.conf matches the one on the Live CD. Since it is now
! 463: on an installed system are no longer running in a read-only environment, some
! 464: changes should be made. Changes to this file will take effect after the
! 465: next boot of the machine.</para>
! 466:
! 467: <para>These lines can be removed.</para>
! 468:
! 469: <programlisting>syslogd_enable="NO"
! 470: xntpd_enable="NO"
! 471: cron_enable="NO"</programlisting>
! 472:
! 473: <para>For a system which uses USB, this line will need to be modified to
! 474: a value of "YES":</para>
! 475:
! 476: <programlisting>usbd_enable="NO"</programlisting>
! 477:
! 478: <!-- link to man pages for this-->
! 479:
! 480: <para>inetd controls various small servers like telnet or ftp. By default,
! 481: all servers are off, and must be individually uncommented in /etc/inetd.conf
! 482: to start them. This is optional.</para>
! 483:
! 484: <programlisting>inetd_enable="YES" # Run the network daemon dispatcher (YES/NO).
! 485: inetd_program="/usr/sbin/inetd" # path to inetd, if you want a different one.
! 486: inetd_flags="-wW" # Optional flags to inetd</programlisting>
1.1 justin 487:
1.2 ! justin 488: </sect2>
! 489:
! 490: <sect2>
! 491: <title>Network Setup</title>
! 492: <para>For acquiring an IP address through DHCP, place this entry in /etc/rc.conf,
! 493: using the appropriate card name. (ep0 is used as an example here.)</para>
! 494:
! 495: <screen>
! 496: <userinput>ifconfig_<replaceable>ep0</replaceable>="DHCP"</userinput>
! 497: </screen>
1.1 justin 498:
1.2 ! justin 499: <para>For a fixed IP, /etc/rc.conf requires a few more lines of data.
! 500: (Again, ep0 is used as an example here.) Supply the correct local values
! 501: for IP, netmask, and default router. The hostname should reflect what is
! 502: entered in DNS for this computer.</para>
! 503:
! 504: <screen>
! 505: <userinput>ifconfig_<replaceable>ep0</replaceable>="inet <replaceable>123.234.345.456</replaceable> netmask <replaceable>255.255.255.0</replaceable>"</userinput>
! 506: <userinput>hostname="<replaceable>myhostname</replaceable>"</userinput>
! 507: <userinput>defaultrouter="<replaceable>654.543.432.321</replaceable>"</userinput>
! 508: </screen>
! 509: </sect2>
! 510: </sect1>
1.1 justin 511:
512: </chapter>