install revision 1.16 1 $NetBSD: install,v 1.16 1998/01/09 18:47:23 perry Exp $
2
3 Installing NetBSD is a relatively complex process, but if you have
4 this document in hand it shouldn't be too much trouble.
5
6 There are several ways to install NetBSD onto a disk. The easiest way
7 in terms of preliminary setup is to use the NetBSD miniroot that can
8 be booted off your local disk's swap partition. Alternatively, if your
9 Sparcstation is hooked up in a network you can find a server and arrange
10 for a diskless setup which is a convenient way to install on a machine
11 whose disk does not currently hold a usable operating system (see the
12 section `Installing NetBSD by using a diskless setup' below).
13
14
15 Installing NetBSD by using the NetBSD miniroot.
16
17 The miniroot is a self-contained NetBSD filesystem holding all utilities
18 necessary to install NetBSD on a local disk. It is distributed as a plain
19 file designed to be transferred to a raw disk partition from which it can
20 be booted using the appropriate PROM command. Usually, the miniroot will
21 be loaded into the swap partition of a disk. If needed, you can use any
22 other unused partition, but remember that the partition will then not
23 available during the installation process.
24
25 Loading the miniroot onto your raw partition is simple. On NetBSD as well
26 as SunOS you use a command like:
27
28 # dd if=miniroot-_VER.fs of=/dev/rsd0b bs=20b conv=sync
29
30 (here `/dev/rsd0b' is assumed to be your swap partition). There's a
31 potential problem here if /dev/rsd0b is actually in use as a swap
32 partition by your currently running system. If you don't have another
33 disk or partition to spare, you can usually get away with running this
34 command anyway after first booting into single-user mode to ensure a
35 quiet system.
36
37 After transferring the miniroot to disk, bring the system down by:
38
39 # halt
40
41 Then boot the miniroot by typing the appropriate command at the PROM:
42
43 > b sd(,,1)netbsd -s # for sun4 monitors
44 ok boot sd(,,1)netbsd -s # for version 1 OpenBOOT ROMs
45 ok boot disk:b netbsd -s # for version 2 OpenBOOT ROMs
46
47 If you've loaded the miniroot onto some other disk than `sd0' adapt
48 the boot specifier accordingly, e.g.:
49
50 ok boot disk1:b netbsd -s
51
52 to boot from SCSI disk target 1 from a version 2 OpenBOOT ROM.
53 If you have to use the old-style `sd(c,u,p)' syntax to boot from a
54 SCSI disk, you can calculate the parameters as follows:
55
56 `c' - specifies the controller number
57 `u' - the hexadecimal number obtained from evaluating
58 the expression `(8 * TARGET) + LUN'
59 `p' - the partition number from which to boot (0=`a', 1=`b', etc).
60
61
62 The monitor boot command will cause the NetBSD kernel contained in the
63 miniroot image to be booted. After the initial probe messages you'll be
64 asked to start the install or upgrade procedure. Proceed to the section
65 `Running the installation scripts' below.
66
67
68 Installing NetBSD by using a diskless setup.
69
70 First, you must setup a diskless client configuration on a server. If
71 you are using a NetBSD system as the boot-server, have a look at the
72 diskless(8) manual page for guidelines on how to proceed with this.
73 If the server runs another operating system, you'll have to consult
74 documentation that came with it (on SunOS systems, add_client(8) is a
75 good start).
76
77 Your Sparcstation expects to be able to download a second stage bootstrap
78 program via TFTP after having acquired its IP address through RevARP when
79 instructed to boot "over the net". It will look for a filename composed of
80 the machine's IP address followed by the machine's architecture, separated
81 by a period. For example, a sun4c machine which has been assigned IP
82 address 130.115.144.11, will make an TFTP request for `8273900B.SUN4C'.
83 Normally, this file is a symbolic link to an appropriate second-stage
84 boot program, which should be located in a place where the TFTP daemon
85 can find it (remember, many TFTP daemons run in a chroot'ed environment).
86 You can find the boot program in `/usr/mdec/boot.net' in the NetBSD/sparc
87 distribution.
88
89 [ Note that the only difference between `/usr/mdec/boot.net' and
90 `/usr/mdec/boot' is in the a.out header, which has been magically
91 transformed in a way that makes it usable on all versions of
92 Sparc PROMs.
93 ]
94
95
96 After the boot program has been loaded into memory and given control by
97 the PROM, it starts locating the machine's remote root directory through
98 the BOOTPARAM protocol. First a BOOTPARAM WHOAMI request is broadcast
99 on the local net. The answer to this request (if it comes in) contains
100 the client's name. This name is used in next step, a BOOTPARAM GETFILE
101 request -- sent to the server that responded to the WHOAMI request --
102 requesting the name and address of the machine that will serve the client's
103 root directory, as well as the path of the client's root on that server.
104
105 Finally, this information (if it comes in) is used to issue a REMOTE MOUNT
106 request to the client's root filesystem server, asking for an NFS file
107 handle corresponding to the root filesystem. If successful, the boot
108 program starts reading from the remote root filesystem in search of the
109 kernel which is then read into memory.
110
111
112 As noted above in the section `Preparing your System for NetBSD Installation',
113 you have several options when choosing a location to store the installation
114 filesets. However, the easiest way is to put the *.tar.gz files you want
115 to install into the root directory for your client on the server.
116
117 Next, unpack `base.tar.gz' and `etc.tar.gz' on the server in the root
118 directory for your machine. If you elect to use a separately NFS-mounted
119 filesystem for `/usr' with your diskless setup, make sure the "./usr" base
120 files in base.tar.gz end up in the correct location. One way to do this is
121 to temporarily use a loopback mount on the server, re-routing <root>/usr to
122 your server's exported NetBSD "/usr" directory. Also put the kernel and the
123 install/upgrade scripts into the root directory.
124
125 A few configuration files need to be edited:
126
127 <root>/etc/hosts
128 Add the IP addresses of both server and client.
129
130 <root>/etc/myname
131 This files contains the client's hostname; use the same
132 name as in <root>/etc/hosts.
133
134 <root>/etc/fstab
135 Enter the entries for the remotely mounted filesystems.
136 For example:
137 server:/export/root/client / nfs rw 0 0
138 server:/export/exec/sun4.netbsd /usr nfs rw 0 0
139
140 Now you must populate the the `/dev' directory for your client. If you server
141 runs SunOS 4.x, you can simply change your working directory to `<root>/dev'
142 and run the MAKEDEV script: `sh MAKEDEV all'.
143
144 On SunOS 5.x systems, MAKEDEV can also be used, but there'll be error
145 messages about unknown user and groups. These errors are inconsequential
146 for the purpose of installing NetBSD. However, you may want to correct them
147 if you plan to use the diskless setup regularly. In that case, you may re-run
148 MAKEDEV on your NetBSD machine once it has booted.
149
150 Boot your workstation from the server by entering the appropriate `boot'
151 command at the monitor prompt. Depending on the PROM version in your machine,
152 this command takes one of the following forms:
153
154 > b le()netbsd -s # for sun4 monitors
155 ok boot le()netbsd -s # for version 1 OpenBOOT ROMs
156 ok boot net netbsd -s # for version 2 OpenBOOT ROMs
157
158 This will boot the NetBSD kernel in single-user mode.
159
160 [[
161 NOTE: the latter two examples assume you operate the OpenBOOT ROM in
162 "new command mode". If your machine comes up and gives you a `>' prompt
163 instead of `ok', type:
164
165 >n # enter native OpenBOOT mode
166 ok setenv sunmon-compat? false # make it permanent
167 ok
168 ]]
169
170 If you use a diskless setup with a separately NFS-mounted /usr filesystem,
171 mount /usr by hand now:
172
173 netbsd# mount /usr
174
175 At this point, it's worth checking the disk label and partition sizes on
176 the disk you want to install NetBSD onto. NetBSD understands SunOS-style
177 disklabels, so if your disk was previously used by SunOS there will be
178 a usable label on it. Use `disklabel -e <disk>' (where <disk> is the
179 device name assigned by the NetBSD kernel, e.g. `sd0') to view and
180 modify the partition sizes. See the section `Preparing your System for
181 NetBSD Installation' above for suggestions about disk partition sizes.
182
183 If you are installing on a SCSI disk that does *not* have a SunOS or
184 NetBSD label on it, you may still be able to use disklabel(8) but you'll
185 have to create all partitions from scratch. If your disk is listed in
186 `/etc/disktab', you may use the entry (which in most cases only defines
187 a `c' partition to describe the whole disk) to put an initial label on
188 the disk. Then proceed with `disklabel -e <disk>' to create a partition
189 layout that suits your needs.
190
191 NOTE: Because of the built-in compatibility with SunOS-style labels,
192 ALWAYS MAKE SURE ALL YOUR PARTITIONS START AND END ON CYLINDER BOUNDARIES.
193
194
195 Here follows an example of what you'll see while in the dislabel editor.
196 Do not touch any of the parameters except for the `label: ' entry and
197 the actual partition size information at the bottom (the lines starting
198 with `a:', `b:', ...).
199
200 The size and offset fields are given in sector units. Be sure to make
201 these numbers multiples of the of the number of sectors per cylinder:
202 the kernel might be picky about these things, but aside from this you'll
203 have the least chance of wasting disk space.
204 Partitions on which you intend to have a mountable filesystem, should
205 be given fstype `4.2BSD'. Remember, the `c' partition should describe
206 the whole disk.
207 The `(Cyl. x - y)' info that appears after the hash (`#') character is
208 treated as a comment and need not be filled in when altering partitions.
209
210 Special note: the line containing `8 partitions:' is best left alone,
211 even if you define less then eight partitions. If this line displays
212 a different number and the program complains about it (after you leave
213 the editor), then try setting it to `8 partitions:'.
214
215
216 <BEGIN SAMPLE DISKLABEL SCREEN>
217 netbsd# disklabel sd2
218 # /dev/rsd2c:
219 type: SCSI
220 disk: SCSI disk
221 label: Hold Your Breath
222 flags:
223 bytes/sector: 512
224 sectors/track: 64
225 tracks/cylinder: 7
226 sectors/cylinder: 448
227 cylinders: 1429
228 rpm: 3600
229 interleave: 1
230 trackskew: 0
231 cylinderskew: 0
232 headswitch: 0 # milliseconds
233 track-to-track seek: 0 # milliseconds
234 drivedata: 0
235
236 8 partitions:
237 # size offset fstype [fsize bsize cpg]
238 a: 50176 0 4.2BSD 0 0 0 # (Cyl. 0 - 111)
239 b: 64512 50176 swap # (Cyl. 112 - 255)
240 c: 640192 0 unknown # (Cyl. 0 - 1428)
241 d: 525504 114688 4.2BSD 0 0 0 # (Cyl. 256 - 1428)
242 <END SAMPLE DISKLABEL SCREEN>
243
244
245 If you are upgrading a NetBSD installation, start the upgrade script:
246
247 netbsd# sh upgrade.sh
248
249 else, start the installation script:
250
251 netbsd# sh install.sh
252
253
254 Running the installation scripts.
255
256 The installation scripts will do most of the work of transferring the
257 system from the distribution sets onto your disk. You will frequently be
258 asked for confirmation before the script proceeds with each phase of the
259 installation process.
260
261 Occasionally, you'll have to provide a piece of information such as the
262 name of the disk you want to install on or IP addresses and domain names
263 you want to assign. If your system has more than one disk, you may want
264 to look at the output of the dmesg(8) command to see how your disks
265 have been identified by the kernel.
266
267 The installation script goes through the following phases:
268
269 - determination of the disk to install NetBSD on
270 - checking of the partition information on the disk
271 - creating and mounting the NetBSD filesystems
272 - setup of IP configuration
273 - extraction of the distribution tar files
274 - installation of boot programs
275
276
277 Now try a reboot. Initially I'd suggest you "boot sd()netbsd -bs", then
278 try multiuser after that. If you boot single-user the NetBSD incantation
279 to make the root filesystem writable is
280
281 netbsd# mount -u /dev/sd0a /
282
283 The Sun monitor might have been setup to instruct the boot program to load
284 a file called "vmunix". On OpenBOOT ROM systems you can change it to load
285 "netbsd" instead using the following commands:
286
287 On version 1 OpenBOOT ROMs:
288 >n
289 ok setenv boot-from sd(0,0,0)netbsd
290 ok
291
292 On version 2 OpenBOOT ROMs:
293 ok setenv boot-file netbsd
294 ok setenv boot-device /sbus/esp/sd@0,0
295
296
297 Congratulations, you have successfully installed NetBSD _VER. When you
298 reboot into NetBSD, you should log in as "root" at the login prompt.
299 There is no initial password, but if you're using the machine in a
300 networked environment, you should create yourself an account and
301 protect it and the "root" account with good passwords.
302
303 Some of the files in the NetBSD _VER distribution might need to be
304 tailored for your site. In particular, the /etc/sendmail.cf file will
305 almost definitely need to be adjusted, and other files in /etc will
306 probably need to be modified. If you are unfamiliar with UN*X-like
307 system administration, it's recommended that you buy a book that
308 discusses it.
309
310