Annotation of doc/en/books/usersguide/installation/chapter.sgml, revision 1.1

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:         <contrib>Marked up by </contrib>
        !            16:       </author> <!-- justin@dragonflybsd.org  05 May 2004 -->
        !            17:     </authorgroup>
        !            18:   </chapterinfo>
        !            19:   <title>Installation from CD</title>
        !            20: 
        !            21:   <sect1 id="installation-cd-synopsis">
        !            22:     <title>CD Installation Overview</title>
        !            23:       <para>This document describes the installation of DragonFly BSD on a plain i386
        !            24:       machine. This process uses a bootable DragonFly CD, usually referred to as a
        !            25:       'live CD'.</para>
        !            26: 
        !            27:       <para>This CD is available at one of the current mirrors, which distribute the images
        !            28:       by various protocols. The authorative list can be found at the
        !            29:       <ulink url="http://www.dragonflybsd.org/main/download.cgi">DragonFly website</ulink>.</para>
        !            30: 
        !            31:       <para>The DragonFly development team is working on an automatic installation
        !            32:       tool, which simplifies the partitioning and installation processes. Until this
        !            33:       tool is in place, the manual process here is required.  Some experience with
        !            34:       BSD-style tools is recommended.</para>
        !            35: 
        !            36:       <caution>
        !            37:         <para>While this guide covers installing to
        !            38:         a computer with an existing non-DragonFly operating system, take no chances!  Back up
        !            39:         any data on your disk drives that you want to save.</para>
        !            40:       </caution>
        !            41: 
        !            42:       <para>When installing to an old machine, it may not be possible to boot from
        !            43:       a CD. Use a bootmanager on a floppy in those cases, such as
        !            44:       <ulink url="http://btmgr.sourceforge.net/">Smart Bootmanager</ulink>.</para>
        !            45:   </sect1>
        !            46: 
        !            47:   <sect1 id="installation-cd-preinstall">
        !            48:     <title>CD Installation - Making room</title>
        !            49: 
        !            50:       <sect2>
        !            51:         <title>DragonFly as the only operating system</title>
        !            52:         <para>If DragonFly is to be the only operating system on the target computer, preparing
        !            53:         the disk is a short and simple process.  Boot with the live CD, and log in as root
        !            54:         to reach a command prompt.</para>
        !            55: 
        !            56:         <para>First, the master boot record (MBR) must be cleared of any old information.  This
        !            57:         command clears all old data off your disk by writing zeros (if=/dev/zero) onto the
        !            58:         system's master ata drive (of=/dev/ad0).</para>
        !            59: 
        !            60:         <!-- put in big fat note about disk naming -->
        !            61: 
        !            62:         <screen>
        !            63:         &prompt.root; <userinput>dd if=/dev/zero of=/dev/ad0 bs=32k count=16</userinput>
        !            64:         </screen>
        !            65: 
        !            66:         <para>The now-empty disk must be formatted.  While the following two commands can be issued
        !            67:         as one, </para>
        !            68: 
        !            69:         <screen>
        !            70:         &prompt.root; <userinput>fdisk -I ad0</userinput>
        !            71:         &prompt.root; <userinput>fdisk -B ad0</userinput>
        !            72:         </screen>
        !            73:       </sect2>
        !            74: 
        !            75:       <sect2>
        !            76:         <title>Multiple operating systems on one hard disk</title>
        !            77:         <para>This example assumes that the target computer for installation has at least
        !            78:         one operating system installed that needs to survive the installation process.
        !            79:         A new partition for DragonFly needs to be created from the existing
        !            80:         partition(s) that otherwise fill the disk.  There must be unused space within
        !            81:         the existing partition in order to resize it.</para>
        !            82: 
        !            83:         <important>
        !            84:           <para>The new partition is created from empty space in an existing partition.
        !            85:           For example, an 18 gigabyte disk that has 17 gigabytes of existing data in the existing
        !            86:           partition will only have 1 gigabyte available for the new partition.</para>
        !            87:         </important>
        !            88: 
        !            89:         <para>Partition resizing needs to be accomplished with a third-party tool.  Commercial
        !            90:         programs such as <ulink url="http://www.symantec.com/partitionmagic/">Partition Magic</ulink>
        !            91:         can accomplish these tasks.  Free tools exist that can be adapted to this task, such as
        !            92:         'GNU parted', found on the
        !            93:         <ulink url="http://www.knopper.net/knoppix-mirrors/index-en.html">Knoppix CD</ulink>,
        !            94:         or <ulink url="http://paud.sourceforge.net">PAUD</ulink>.
        !            95:         </para>
        !            96: 
        !            97:         <para>Create a new partition of at least 5-6 gigabytes.  It is possible to
        !            98:         install within a smaller amount of disk space, but this will create some
        !            99:         problems that this document does not cover.  The newly created partition
        !           100:         does not need to be formatted; the rest of the
        !           101:         installation process treats that new partiton as a new disk.</para>
        !           102:       </sect2>
        !           103: 
        !           104:       <sect2>
        !           105:         <title>Multiple operating systems, multiple hard disks</title>
        !           106:         <para>Installing DragonFly to a separate disk removes the need
        !           107:         for partition resizing, and is generally safer when trying to preserve
        !           108:         an existing operating system installation.</para>
        !           109: 
        !           110:         <para>This type of installation is very similar to installing DragonFly
        !           111:        as the only operating system.  The only difference is the disk named
        !           112:        in each command.</para>
        !           113: 
        !           114: 
        !           115:       <caution>
        !           116:         <para>Always be sure of the target disk for any command.</para>
        !           117:       </caution>
        !           118: 
        !           119:       </sect2>
        !           120:   </sect1>
        !           121: 
        !           122:   <sect1 id="installation-cd-disk">
        !           123:     <title>CD Installation - Disk setup</title>
        !           124: 
        !           125:       <sect2>
        !           126:         <title>Disk formatting</title>
        !           127:         <para>The newly created partition, whether part of an existing disk or on a 
        !           128:         completely new drive, needs to be formatted.  The following command can 
        !           129:         interactively format your disk.</para>
        !           130:       
        !           131:           <screen>
        !           132:           &prompt.root; <userinput>fdisk -u</userinput>
        !           133:           </screen>
        !           134: 
        !           135:         <!-- reword -->
        !           136:         <para>If there are multiple operating systems on the disk, pick the correct 
        !           137:         partition judging by what partitions were created earlier with a resizing tool.</para>
        !           138:       </sect2>
        !           139: 
        !           140:       <sect2>
        !           141:         <title>Boot block installation</title>
        !           142:           <para>The 'ad0' here refers to the first disk on the first IDE bus of a computer.  
        !           143:           Increment the number if the target disk is farther down the chain.  For example, 
        !           144:           the master disk on the second IDE controller would be 'ad2'.</para>
        !           145:  
        !           146:           <!-- write list here of adx to drive mapping, and scsi too -->
        !           147:   
        !           148:           <screen>
        !           149:           &prompt.root; <userinput>boot0cfg -B ad0</userinput>
        !           150:           &prompt.root; <userinput>boot0cfg -v ad0</userinput>
        !           151:           </screen>
        !           152: 
        !           153:           <para><userinput>-s SLICE</userinput>, where SLICE is a number, controls which 
        !           154:           slice on disk is used by boot0cfg to start from.  By default, this number is 1, and 
        !           155:           will only need modification if a different slice contains DragonFly.</para>
        !           156:   
        !           157:        </sect2>
        !           158: 
        !           159:       <sect2>
        !           160:         <title>Disklabel</title>
        !           161:           <para>If DragonFly is installed anywhere but the first partition of the disk, 
        !           162:           the device entry for that partition will have to be created.  Otherwise, the 
        !           163:           device entry is automatically created.  Refer to this different partition 
        !           164:          instead of the 'ad0s1a' used in later examples.</para>
        !           165: 
        !           166:           <screen>
        !           167:           &prompt.root; <userinput>cd /dev; ./MAKEDEV ad0s2</userinput>
        !           168:           </screen>
        !           169: 
        !           170:           <para>The partition needs to be created on the DragonFly disk.</para>
        !           171: 
        !           172:           <screen>
        !           173:           &prompt.root; <userinput>disklabel -B -r -w ad0s1 auto</userinput>
        !           174:           </screen>
        !           175: 
        !           176:           <para>Using /etc/disklabel.ad0s1 as an example, issue the following command to 
        !           177:           edit the disklabel for the just-created partition.</para>
        !           178: 
        !           179:           <screen>
        !           180:           &prompt.root; <userinput>disklabel -e ad0s1</userinput>
        !           181:           </screen>
        !           182: 
        !           183:   
        !           184:           <informaltable>
        !           185:             <tgroup cols="3">
        !           186:               <thead>
        !           187:                 <row>
        !           188:                   <entry>Partition</entry>
        !           189:                   <entry>Size</entry>
        !           190:                   <entry>Mountpoint</entry>
        !           191:                 </row>
        !           192:               </thead>
        !           193: 
        !           194:               <tbody>
        !           195: 
        !           196:                  <row>
        !           197:                   <entry>ad0s2a
        !           198:                   <entry>256m
        !           199:                   <entry>/
        !           200:                 </row>
        !           201:           
        !           202:                  <row>
        !           203:                   <entry>ad0s2b
        !           204:                   <entry>1024m
        !           205:                   <entry>swap
        !           206:                 </row>
        !           207:           
        !           208:                  <row>
        !           209:                   <entry>ad0s2c
        !           210:                   <entry>leave alone
        !           211:                   <entry>This represents the whole slice.
        !           212:                 </row>
        !           213:           
        !           214:                  <row>
        !           215:                   <entry>ad0s2d
        !           216:                   <entry>256m
        !           217:                   <entry>/var
        !           218:                 </row>
        !           219:           
        !           220:                  <row>
        !           221:                   <entry>ad0s2e
        !           222:                   <entry>256m
        !           223:                   <entry>/tmp !
        !           224:                 </row>
        !           225:           
        !           226:                  <row>
        !           227:                   <entry>ad0s2f
        !           228:                   <entry>8192m
        !           229:                   <entry>/usr - This should be at least 4096m
        !           230:                 </row>
        !           231:           
        !           232:                  <row>
        !           233:                   <entry>ad0s2g
        !           234:                   <entry>*
        !           235:                   <entry>/home - This holds 'everything else'
        !           236:                 </row>
        !           237: 
        !           238:               </tbody>
        !           239:             </tgroup>
        !           240:           </informaltable>
        !           241: 
        !           242:       </sect2>
        !           243:       
        !           244:       <sect2>
        !           245:         <title>Partition Format</title>
        !           246:           <para>newfs will format each individual partition.  </para>
        !           247: 
        !           248:           <screen>
        !           249:           &prompt.root; <userinput>newfs /dev/ad0s1a</userinput>
        !           250:           &prompt.root; <userinput>newfs -U /dev/ad0s1d</userinput>
        !           251:           &prompt.root; <userinput>newfs -U /dev/ad0s1e</userinput>
        !           252:           &prompt.root; <userinput>newfs -U /dev/ad0s1f</userinput>
        !           253:           &prompt.root; <userinput>newfs -U /dev/ad0s1g</userinput>
        !           254:           </screen>
        !           255: 
        !           256:           <note>
        !           257:             <para>The root partition does not need softupdates; the 
        !           258:             -U option is not used.</para>
        !           259:           </note>
        !           260: 
        !           261:             <note>
        !           262:             <para>The command listing skips directly from ad0s1a to ad0s1d.  This is 
        !           263:             because /dev/ad0s1b is used as swap and does not require formatting; 
        !           264:             ad0s1c refers to the entire disk and does not need to be formatted.</para>
        !           265:           </note>
        !           266:       </sect2>
        !           267:   </sect1>
        !           268: 
        !           269: 
        !           270: <!--
        !           271: What follows here are Markus Schatzl's original notes, saved here 
        !           272: for rewriting/markup.  This entire section may be superseded if a 
        !           273: DragonFly installer is completed before 1.0 is released.
        !           274: -->
        !           275: 
        !           276: <!--
        !           277: * Mounting the filesystems and copying the CD
        !           278: 
        !           279: Get the fresh partitions into your system and copy the contents of the CD to disk.
        !           280: 
        !           281:        [Mounting:]
        !           282:        ''# mount /dev/ad0s2a /mnt''
        !           283: 
        !           284:        ''# mkdir /mnt/var''
        !           285: 
        !           286:        ''# mkdir /mnt/tmp''
        !           287: 
        !           288:        ''# mkdir /mnt/usr''
        !           289: 
        !           290:        ''# mkdir /mnt/home''
        !           291: 
        !           292:        ''# mount /dev/ad0s2d /mnt/var''
        !           293: 
        !           294:        ''# mount /dev/ad0s2e /mnt/tmp''
        !           295: 
        !           296:        ''# mount /dev/ad0s2f /mnt/usr''
        !           297: 
        !           298:        ''# mount /dev/ad0s2g /mnt/home''
        !           299: 
        !           300:        [Getting the files:]
        !           301:        ''# cpdup / /mnt''
        !           302: 
        !           303:        ''# cpdup /var /mnt/var''
        !           304: 
        !           305:        ''# cpdup /etc /mnt/etc''
        !           306: 
        !           307:        ''# cpdup /dev /mnt/dev''
        !           308: 
        !           309:        ''# cpdup /usr /mnt/usr''
        !           310: 
        !           311:   <sect1 id="installation-cd-postinstall">
        !           312:     <title>CD Installation - Post-install cleanup</title>
        !           313: 
        !           314:   Most of the installation-work is accomplished now, but there are still some things to be done.
        !           315: 
        !           316:   If you made a /tmp-partition, it is reasonable to link /var/tmp to /tmp.
        !           317: 
        !           318:        [Linking /tmp:]
        !           319:        ''# chmod 1777 /mnt/tmp''
        !           320:        ''# rm -fr /mnt/var/tmp''
        !           321:        ''# ln -s /tmp /mnt/var/tmp''
        !           322: 
        !           323:   To mount the right filesystems, set up fstab to reflect your configuration. Best modify /mnt/fstab.example and move it to fstab then. You maybe want to mount your /tmp directory on MFS, so it is truly temporary.
        !           324: 
        !           325:        [Bringing fstab in place:]
        !           326:        ''# vi /mnt/etc/fstab.example''
        !           327:        ''# mv /mnt/etc/fstab.example /mnt/etc/fstab''
        !           328: 
        !           329:   Backing up your current disklabel is a good idea, should you ever need it again (e.g. corrupted disk, lost partition table).
        !           330: 
        !           331:        [Save the disklabel:]
        !           332:        ''# disklabel ad0s2 > /mnt/etc/disklabel.ad0s2''
        !           333: 
        !           334:   Last there are some files only required by the CD which you got to remove to get your system started from the harddisk.
        !           335: 
        !           336:        [Remove CD-files:]
        !           337:        ''# rm /mnt/boot/loader.conf''
        !           338:        ''# rm /mnt/boot.catalog''
        !           339:        ''# rm -r /mnt/rr_moved''
        !           340: 
        !           341:   At this moment it should be possible to reboot and start off the disk. Don't just hit the reset-button, because you can't be sure that the disk is already sync'ed. Remove the CD before your machine boots anew.
        !           342: 
        !           343:        [Reboot correctly:]
        !           344:        ''# reboot''
        !           345: 
        !           346:   **Problems?
        !           347: 
        !           348:   If you encounter complications on booting from disk, try these things:
        !           349: 
        !           350:        1. Old bootblocks can interfere with the initialization-process. To avoid this, zero-out the MBR.
        !           351:        #) If you can select CHS or LBA mode in your BIOS, try changing the mode to LBA.
        !           352:        #) Your DragonFly slice is maybe beyond cylinder 1023. Try ''boot0cfg -o packet ad0'' in this case.
        !           353: 
        !           354: 
        !           355: </sect1>
        !           356: 
        !           357: 
        !           358:   <sect1 id="installation-system-setup">
        !           359:     <title>CD Installation - New system setup</title>
        !           360: 
        !           361: If your system works correctly from the harddisk, you should concern yourself with setting up a base configuration. This includes setting the hostname, choosing a keymap, configuring the network, setting up cron and so on.
        !           362: 
        !           363:        [Getting the right keymap:]
        !           364:        ''# kbdmap''
        !           365: 
        !           366: Choose your favourite one, remember the name and place an additional line in /etc/rc.conf to load it at startup (e.g. ''echo 'keymap="german.iso.kbd"' >> /etc/rc.conf'').
        !           367: 
        !           368: To set the hostname, proceed the same way and insert a line like ''hostname="elektra"'' into /etc/rc.conf. Having done this, tell /etc/hosts about.
        !           369: 
        !           370: Have an overall look at /etc/rc.conf to enable cron, usbd and the like.
        !           371: 
        !           372: It is a good idea to set your timezone, because some progs which do a time-related syscall would be unhappy with a result of Dec 1969. Just in case.
        !           373: 
        !           374:        [Set up the timezone:]
        !           375:        ''# tzsetup''
        !           376: 
        !           377: If you're a lazy bone like me and hate to ''pwd'' all the time to know where you are, modify the line ''set prompt 0 "'hostname -s'# "'' in .cshrc to ''set prompt = "'hostname -s':%/# "''.
        !           378: 
        !           379: *Initital network setup
        !           380: 
        !           381: Should your network-interface(s) not work properly, try to load some modules from /modules via ''kldload''.
        !           382: 
        !           383: To configure DHCP, place a line like ''ifconfig__ep0="DHCP"'' in /etc/rc.conf; if you need a fixed IP, something like ''ifconfig__ep0="inet 132.199.32.25  netmask 255.255.255.0"'' is what you want.
        !           384: 
        !           385: *Enable USB
        !           386: 
        !           387: Since USB is not fully loaded when DragonFly is started from CD, you have to activate is after an HD-install. This is mainly because USB is still under development and could prevent the CD from booting cleanly.
        !           388: 
        !           389:        [Initialize USB:]
        !           390:        ''# kldload ehci.ko''
        !           391: 
        !           392:        ''# rcforce usbd''
        !           393: 
        !           394: If you run out of device-nodes because you hav a lot of USB-devices, you maybe have to create additional ones.
        !           395: 
        !           396:        [Create some more USB device-nodes:]
        !           397:        ''# cd /dev; ./MAKEDEV da4 da5''
        !           398: 
        !           399: Don't forget to set ''usbd__enable'' to YES int /etc/rc.conf.
        !           400: 
        !           401: </sect1>
        !           402: 
        !           403: *Using CVSup to obtain the CVS and ports
        !           404: 
        !           405: You can use CVSup to get the DragonFly repository, the FreeBSD ports-tree and anything else you find in any CVS-archive. CVSup is a port, but included on the CD. There are some examples provided in /usr/share/examples/cvsup; if you want to know more about it, try "man cvsup".
        !           406: 
        !           407: I will describe only how to obtain the DragonFly CVS-repository, the DragonFly supfile, the FreeBSD ports and the respective supfile, since this is what you really want.
        !           408: If you've done the initial setup and you are blessed with a permanent connection to the internet, you may want to create a cronjob to keep it up to date. But please do not run such an unattended job more than once a day.
        !           409: 
        !           410: Have a look at the supfiles first, since there's the additional option to use a 'checked out' copy of the source tree instead of syncing with the tree itself. This makes sense if you don't plan to do development work or are low on disk space. If you choose to do so, a ''cvsup SUPFILE'' suffices to get everything you need.
        !           411: 
        !           412:        [get the pository (in /home/dcvs):]
        !           413:        ''# cvsup /usr/share/examples/cvsup/DragonFly-supfile''
        !           414: 
        !           415:        [install the source from the CVS hierarchy:]
        !           416:        ''# cd /usr''
        !           417: 
        !           418:        ''# cvs -R -d /home/dcvs checkout src''
        !           419: 
        !           420:        ''# cvs -R -d /home/dcvs checkout dfports''
        !           421: 
        !           422:        [get the FreeBSD ports tree:]
        !           423:        ''# cvsup -h cvsup.freebsd.org /usr/share/examples/cvsup/FreeBSD-ports-supfile''
        !           424: 
        !           425: * Doing buildworlds and buildkernel
        !           426: 
        !           427: To rebuild the system from the files obtained by CVS, do a build- and installworld.
        !           428: 
        !           429:        [Build the world:]
        !           430:        ''# cd /usr/src''
        !           431: 
        !           432:        ''# make buildworld''
        !           433: 
        !           434:        ''# make installworld''
        !           435: 
        !           436: If kernel-compiling is what your heart yearns for, proceed like described below. Create your custom kernel-config in /usr/src/sys/i386/conf/<YOURKERNEL>. If you do so, remember to keep a working kernel in /. /kernel.old is overwritten when you ''make installkernel''; /kernel.GENERIC or /kernel.bak is a good thing to have if something goes wrong.
        !           437: 
        !           438:        [Rebuild the kernel]
        !           439:        ''# cd /usr/src''
        !           440: 
        !           441:        ''# make buildkernel KERNCONF=GENERIC''
        !           442: 
        !           443:        ''# make installkernel KERNCONF=GENERIC''
        !           444: 
        !           445: *README
        !           446: 
        !           447: In any case you should consult the /README file, since by now it's the most up-to-date documentation-file for setting up DragonFly BSD. Some things mentioned there are not part of this writeup. If changes occur, you will likely find it in the README.
        !           448: 
        !           449: <sect1 id="install-bootmanager">
        !           450:     <title>Booting the system</title>
        !           451: 
        !           452:   ***Floppies
        !           453: 
        !           454:   You may need a DOS-formatted floppy-disk somewhere in the middle of the installation process. To save you the hassle in case you don't know how, here the proceeding:
        !           455: 
        !           456:        [Create a floppy:]
        !           457:        ''# fdformat /dev/fd0.1440''
        !           458:        ''# disklabel -B -r -w /dev/fd0.1440 fd1440''
        !           459:        ''# newfs_msdos /dev/fd0''
        !           460: 
        !           461: 
        !           462: 
        !           463:   ***Windows
        !           464: 
        !           465:   Should you run Windows, you can use the Win NT/2000/XP bootmanager. I'm not a dedicated friend of Windows, but I think I found out how it works. It requires a bit of fiddling, though.
        !           466: 
        !           467:        [Back up the old MBR first:]
        !           468:        ''# dd if=/dev/ad0 of=/root/win.mbr bs=512 count=1''
        !           469: 
        !           470:   Done that, install Dragonfly regularly as follows in the next paragraphs. You also have to install the DragonFly loader as usual. When you've rebooted DFly for the first time and you're sure it boots the way you want it, back up the new MBR too as described above. Then restore your old MBR and copy the DragonFly MBR to a floppy/USB-stick or so.
        !           471: 
        !           472:        [Restore Windows' MBR:]
        !           473:        ''# dd if=/root/win.mbr of=/dev/ad0 bs=512 count=1''
        !           474: 
        !           475:   Boot Windows and copy the file from disk into the C:\ folder. Now tell boot.ini what you want it to do.
        !           476: 
        !           477:        [Append the following line at boot.ini:]
        !           478:        ''c:\dfly.mbr="DragonFly BSD"''
        !           479: 
        !           480:   Don't forget to increase the timeout, should it be on zero.
        !           481: 
        !           482:   Users of Win98 better choose the DragonFly bootmanager; this works quite well.
        !           483: 
        !           484:   ***Unix-like systems
        !           485: 
        !           486:   If you want to use the DragonFly bootmanager, you can zero-out your MBR as shown above, else tell your LILO/GRUB/whatever about the partition when you're done.
        !           487: 
        !           488: -->
        !           489: 
        !           490: 
        !           491: </chapter>