xref: /netbsd-src/share/man/man8/afterboot.8 (revision 1ffa7b76c40339c17a0fb2a09fac93f287cfc046)
1.\"	$NetBSD: afterboot.8,v 1.6 2003/03/21 16:49:18 jmmv Exp $
2.\"
3.\" Copyright (c) 2002-2003 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"	This product includes software developed by the NetBSD
17.\"	Foundation, Inc. and its contributors.
18.\" 4. Neither the name of The NetBSD Foundation nor the names of its
19.\"    contributors may be used to endorse or promote products derived
20.\"    from this software without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
23.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
26.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32.\" POSSIBILITY OF SUCH DAMAGE.
33.\"
34.\"	$OpenBSD: afterboot.8,v 1.72 2002/02/22 02:02:33 miod Exp $
35.\"
36.\" Originally created by Marshall M. Midden -- 1997-10-20, m4@umn.edu
37.\" Adapted to NetBSD by Julio Merino -- 2002-05-10, jmmv@hispabsd.org
38.\"
39.Dd March 10, 2003
40.Dt AFTERBOOT 8
41.Os
42.Sh NAME
43.Nm afterboot
44.Nd things to check after the first complete boot
45.Sh DESCRIPTION
46.Ss Starting Out
47This document attempts to list items for the system administrator
48to check and set up after the installation and first complete boot of the
49system.
50The idea is to create a list of items that can be checked off so that you have
51a warm fuzzy feeling that something obvious has not been missed.
52A basic knowledge of
53.Ux
54is assumed.
55.Pp
56Complete instructions for correcting and fixing items is not provided.
57There are manual pages and other methodologies available for doing that.
58For example, to view the man page for the
59.Xr ls 1
60command, type:
61.Bd -literal -offset indent
62.Ic man 1 ls
63.Ed
64.Pp
65Administrators will rapidly become more familiar with
66.Nx
67if they get used to using the manual pages.
68.Ss Security alerts
69By the time that you have installed your system, it is quite likely that
70bugs in the release have been found.
71All significant and easily fixed problems will be reported at
72.Pa http://www.netbsd.org/Security/ .
73It is recommended that you check this page regularly.
74.Ss Login
75Login as
76.Dq Ic root .
77You can do so on the console, or over the network using
78.Xr ssh 1 .
79If you wish to allow root logins over the network (if you have
80enabled the ssh daemon), edit the
81.Pa /etc/ssh/sshd_config
82file and set
83.Cm PermitRootLogin
84to
85.Dq yes
86(see
87.Xr sshd 8 ) .
88The default is to not permit root logins over the network
89after fresh install in
90.Nx .
91Note defaults on other operating systems might be different.
92.Pp
93Upon successful login on the console, you may see the message
94.Dq We recommend creating a non-root account... .
95For security reasons, it is bad practice to login as root during
96regular use and maintenance of the system.
97Instead, administrators are encouraged to add a
98.Dq regular
99user, add said user to the
100.Dq wheel
101group, then use the
102.Ic su
103and
104.Ic sudo
105commands when root privileges are required.
106This process is described in more detail later.
107.Ss Root password
108Change the password for the root user.
109(Note that throughout the documentation, the term
110.Dq superuser
111is a synonym for the root user.)
112Choose a password that has numbers, digits, and special characters (not space)
113as well as from the upper and lower case alphabet.
114Do not choose any word in any language.
115It is common for an intruder to use dictionary attacks.
116Type the command
117.Ic /usr/bin/passwd
118to change it.
119.Pp
120It is a good idea to always specify the full path name for both the
121.Xr passwd 1
122and
123.Xr su 1
124commands as this inhibits the possibility of files placed in your execution
125.Ev PATH
126for most shells.
127Furthermore, the superuser's
128.Ev PATH
129should never contain the current directory
130.Po Dq \&.
131.Pc .
132.Ss System date
133Check the system date with the
134.Xr date 1
135command.
136If needed, change the date, and/or change the symbolic link of
137.Pa /etc/localtime
138to appropriate time zone in the
139.Pa /usr/share/zoneinfo
140directory.
141.Pp
142Examples:
143.Bl -tag -width date
144.It Cm date 200205101820
145Set the current date to May 10th, 2002 6:20pm.
146.It Cm ln -fs /usr/share/zoneinfo/Europe/Helsinki /etc/localtime
147Set the time zone to Eastern Europe Summer Time.
148.El
149.Ss Console settings
150One of the first things you will likely need to do is to setup your
151keyboard map (and maybe some other aspects about the system console).
152To change your keyboard encoding, edit the
153.Va Dq encoding
154variable found in
155.Pa /etc/wscons.conf .
156.Pp
157.Xr wscons.conf 5
158contains more information about this file.
159.Ss Check hostname
160Use the
161.Ic hostname
162command to verify that the name of your machine is correct.
163See the man page for
164.Xr hostname 1
165if it needs to be changed.
166You will also need to change the contents of the
167.Va Dq hostname
168variable in
169.Pa /etc/rc.conf
170or edit the
171.Pa /etc/myname
172file
173to have it stick around for the next reboot. Note that
174hostname is supposed to be FQDN commonly and should
175not be confused with YP
176.Xr domainname 1 .
177.Ss Verify network interface configuration
178The first thing to do is an
179.Ic ifconfig -a
180to see if the network interfaces are properly configured.
181Correct by editing
182.Pa /etc/ifconfig. Ns Ar interface
183(where
184.Ar interface
185is the interface name, e.g.,
186.Dq le0 )
187and then using
188.Xr ifconfig 8
189to manually configure it
190if you do not wish to reboot.
191Read the
192.Xr ifconfig.if 5
193man page for more information on the format of
194.Pa /etc/ifconfig. Ns Ar interface
195files.
196The loopback interface will look something like:
197.Bd -literal -offset indent
198lo0: flags=8009<UP,LOOPBACK,MULTICAST> mtu 32972
199	inet 127.0.0.1 netmask 0xff000000
200	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
201	inet6 ::1 prefixlen 128
202.Ed
203.Pp
204an Ethernet interface something like:
205.Bd -literal -offset indent
206le0: flags=9863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST>
207	inet 192.168.4.52 netmask 0xffffff00 broadcast 192.168.4.255
208	inet6 fe80::5ef0:f0f0%le0 prefixlen 64 scopeid 0x1
209.Ed
210.Pp
211and, a PPP interface something like:
212.Bd -literal -offset indent
213ppp0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST>
214        inet 203.3.131.108 --> 198.181.0.253 netmask 0xffff0000
215.Ed
216.Pp
217See
218.Xr mrouted 8
219for instructions on configuring multicast routing.
220.Pp
221See
222.Xr dhcpd 8
223for instructions on configuring interfaces with DHCP.
224.Ss Check routing tables
225Issue a
226.Ic netstat -rn
227command.
228The output will look something like:
229.Bd -literal -offset indent
230Routing tables
231
232Internet:
233Destination    Gateway           Flags  Refs     Use  Mtu  Interface
234default        192.168.4.254     UGS      0 11098028    -  le0
235127            127.0.0.1         UGRS     0        0    -  lo0
236127.0.0.1      127.0.0.1         UH       3       24    -  lo0
237192.168.4      link#1            UC       0        0    -  le0
238192.168.4.52   8:0:20:73:b8:4a   UHL      1     6707    -  le0
239192.168.4.254  0:60:3e:99:67:ea  UHL      1        0    -  le0
240
241Internet6:
242Destination        Gateway       Flags  Refs  Use     Mtu  Interface
243::/96              ::1           UGRS     0     0   32972  lo0 =>
244::1                ::1           UH       4     0   32972  lo0
245::ffff:0.0.0.0/96  ::1           UGRS     0     0   32972  lo0
246fc80::/10          ::1           UGRS     0     0   32972  lo0
247fe80::/10          ::1           UGRS     0     0   32972  lo0
248fe80::%le0/64      link#1        UC       0     0    1500  le0
249fe80::%lo0/64      fe80::1%lo0   U        0     0   32972  lo0
250ff01::/32          ::1           U        0     0   32972  lo0
251ff02::%le0/32      link#1        UC       0     0    1500  le0
252ff02::%lo0/32      fe80::1%lo0   UC       0     0   32972  lo0
253
254.Ed
255.Pp
256The default gateway address is stored in the
257.Va Dq defaultroute
258variable
259.Pa /etc/rc.conf ,
260or in the file
261.Pa /etc/mygate .
262If you need to edit this file, a painless way to reconfigure the network
263afterwards is to issue
264.Bd -literal -offset indent
265.Ic /etc/rc.d/network restart
266.Ed
267.Pp
268Or, you may prefer to manually configure using a series of
269.Ic route add
270and
271.Ic route delete
272commands (see
273.Xr route 8 ) .
274If you run
275.Xr dhclient 8
276you will have to kill it by running
277.Bd -literal -offset indent
278.Ic /etc/rc.d/dhclient stop
279.Pp
280.Ed
281after you flush the routes.
282.Pp
283If you wish to route packets between interfaces, add the directive
284.Dl net.inet.ip.forwarding=1
285and/or
286.Dl net.inet6.ip6.forwarding=1
287.Pp
288to
289.Pa /etc/sysctl.conf ,
290or compile a new kernel with the
291.Cm GATEWAY
292option.
293Packets are not forwarded by default, due to RFC requirements.
294.Pp
295You can add new
296.Dq virtual interfaces
297by adding the required entries to
298.Pa /etc/ifconfig.if .
299.Ss Secure Shell (ssh)
300By default, all services are disabled (and ssh is no exception). You
301may wish to enable it so you can remotely control your system.
302Set "sshd=yes" in
303.Pa /etc/rc.conf
304and then starting the server with the command
305.Bd -literal -offset indent
306.Ic /etc/rc.d/sshd start
307.Ed
308.Pp
309The first time the server is started, it will generate a new keypair,
310which will be stored inside the directory
311.Pa /etc/ssh .
312.Ss BIND Name Server (DNS)
313If you are using the BIND Name Server, check the
314.Pa /etc/resolv.conf
315file.
316It may look something like:
317.Bd -literal -offset indent
318domain some.thing.dom
319nameserver 192.168.0.1
320nameserver 192.168.4.55
321search some.thing.dom. thing.dom.
322.Ed
323.Pp
324For further details, see
325.Xr resolv.conf 5 .
326Note the name service lookup order is set via
327.Xr nsswitch.conf 5
328mechanism.
329.Pp
330If using a caching name server add the line "nameserver 127.0.0.1" first.
331To get a local caching name server to run
332you will need to set "named=yes" in
333.Pa /etc/rc.conf
334and create the
335.Pa named.conf
336file in the appropriate place for
337.Xr named 8 ,
338usually in
339.Pa /etc/namedb .
340The same holds true if the machine is going to be a
341name server for your domain.
342In both these cases, make sure that
343.Xr named 8
344is running
345(otherwise there are long waits for resolver timeouts).
346.Ss YP Setup
347Check the YP domain name with the
348.Xr domainname 1
349command.
350If necessary, correct it by editing the
351.Pa /etc/defaultdomain
352file or by setting the
353.Va Dq domainname
354variable in
355.Pa /etc/rc.conf .
356The
357.Pa /etc/rc.d/network
358script reads this file on bootup to determine and set the domain name.
359You may also set the running system's domain name with the
360.Xr domainname 1
361command.
362To start YP client services, simply run
363.Ic ypbind ,
364then perform the remaining
365YP activation as described in
366.Xr passwd 5
367and
368.Xr group 5 .
369.Pp
370In particular, to enable YP passwd support, you'd need to update
371.Pa /etc/nsswitch.conf
372to include
373.Dq nis
374for the
375.Dq passwd
376entry. A traditional way to accomplish the same thing is to
377add following entry to local passwd database via
378.Xr vipw 8 :
379.Bd -literal -offset indent
380.Li +:*::::::::
381.Pp
382.Ed
383Note this entry has to be the very last one. This traditional way
384works with the default
385.Xr nsswitch.conf 5
386setting of
387.Dq passwd ,
388which is
389.Dq compat .
390.Pp
391You can find more information by starting with
392.Xr yp 8 .
393.Ss Check disk mounts
394Check that the disks are mounted correctly by
395comparing the
396.Pa /etc/fstab
397file against the output of the
398.Xr mount 8
399and
400.Xr df 1
401commands.
402Example:
403.Bd -literal -offset indent
404.Li # Ic cat /etc/fstab
405/dev/sd0a / ffs rw 1 1
406/dev/sd0b none swap sw 0 0
407/dev/sd0e /usr ffs rw 1 2
408/dev/sd0f /var ffs rw 1 3
409/dev/sd0g /tmp ffs rw 1 4
410/dev/sd0h /home ffs rw 1 5
411.Li # Ic mount
412/dev/sd0a on / type ffs (local)
413/dev/sd0e on /usr type ffs (local)
414/dev/sd0f on /var type ffs (local)
415/dev/sd0g on /tmp type ffs (local)
416/dev/sd0h on /home type ffs (local)
417.Li # Ic df
418Filesystem  1024-blocks     Used    Avail Capacity  Mounted on
419/dev/sd0a         22311    14589     6606    69%    /
420/dev/sd0e        203399   150221    43008    78%    /usr
421/dev/sd0f         10447      682     9242     7%    /var
422/dev/sd0g         18823        2    17879     0%    /tmp
423/dev/sd0h          7519     5255     1888    74%    /home
424.Li # Ic pstat -s
425Device      512-blocks     Used    Avail Capacity  Priority
426/dev/sd0b       131072    84656    46416    65%    0
427.Ed
428.Pp
429Edit
430.Pa /etc/fstab
431and use the
432.Xr mount 8
433and
434.Xr umount 8
435commands as appropriate.
436Refer to the above example and
437.Xr fstab 5
438for information on the format of this file.
439.Pp
440You may wish to do NFS mounts now too, or you can do them later.
441.Ss Concatenated disks (ccd)
442If you are using
443.Xr ccd 4
444concatenated disks, edit
445.Pa /etc/ccd.conf .
446You may wish to take a look to
447.Xr ccdconfig 8
448for more information about this file.
449Use the
450.Ic ccdconfig -U
451command to unload and the
452.Ic ccdconfig -C
453command to create tables internal to the kernel for the concatenated disks.
454You then
455.Xr mount 8 ,
456.Xr umount 8 ,
457and edit
458.Pa /etc/fstab
459as needed.
460.Ss CHANGING /etc FILES
461The system should be usable now, but you may wish to do more
462customization, such as adding users, etc.
463Many of the following sections may be skipped
464if you are not using that package (for example, skip the
465.Sx Kerberos
466section if you won't be using Kerberos).
467We suggest that you
468.Ic cd /etc
469and edit most of the files in that directory.
470.Pp
471Note that the
472.Pa /etc/motd
473file is modified by
474.Pa /etc/rc.d/motd
475whenever the system is booted.
476To keep any custom message intact, ensure that you leave two blank lines
477at the top, or your message will be overwritten.
478.Ss Sushi
479Since
480.Nx 1.6 ,
481a new tool for configuring the system has been
482included, called
483.Xr sushi 8 .
484It will allow you to setup many aspects of the
485system from interactive menus. You can launch it typing:
486.Bd -literal -offset indent
487.Ic sushi
488.Ed
489.Ss Add new users
490There are
491.Xr useradd 8
492and
493.Xr groupadd 8
494scripts.
495You may use
496.Xr vipw 8
497to add users to the
498.Pa /etc/passwd
499file
500and edit
501.Pa /etc/group
502by hand to add new groups.
503The manual page for
504.Xr su 1 ,
505tells you to make sure to put people in
506the
507.Sq wheel
508group if they need root access (non-Kerberos).
509For example:
510.Bd -literal -offset indent
511wheel:*:0:root,myself
512.Ed
513.Pp
514Follow instructions for
515.Xr kerberos 8
516if using
517Kerberos
518for authentication.
519.Ss rc.conf, rc.local
520Check for any local changes needed in the files
521.Pa /etc/rc.conf ,
522and
523.Pa /etc/rc.local .
524.Pp
525.Xr rc.conf 5
526contains configuration for various daemons included with
527the system.
528Script
529.Pa /etc/rc.local
530is run as the last thing during multiuser boot, and is provided
531to allow any other local hooks necessary for the system.
532.Pp
533You can take a look to
534.Pa /etc/defaults/rc.conf
535to see a list of default system variables, which you can override in
536.Pa /etc/rc.conf .
537Note you are
538.Em not
539supposed to change
540.Pa /etc/defaults/rc.conf
541directly, edit only
542.Pa /etc/rc.conf .
543See
544.Xr rc.conf 5
545for further information.
546.Pp
547The directory
548.Pa /etc/rc.d
549contains a serie of scripts used at startup/shutdown, called by
550.Pa /etc/rc .
551.Pp
552If you've installed X, you may want to turn on
553.Xr xdm 1 ,
554the X Display Manager.
555To do this, set the variable xdm to yes, i.e. "xdm=yes", in
556.Pa /etc/rc.conf .
557.Ss Printers
558Edit
559.Pa /etc/printcap
560and
561.Pa /etc/hosts.lpd
562to get any printers set up.
563Consult
564.Xr lpd 8
565and
566.Xr printcap 5
567if needed.
568.Ss Tighten up security
569In
570.Pa /etc/inetd.conf
571comment out any extra entries you do not need, and only add things
572that are really needed. Note that by default all services are disabled
573for security reasons.
574.Ss Kerberos
575If you are going to use
576.Xr kerberos 8
577for authentication, and you already have a
578Kerberos
579master, change directory to
580.Pa /etc/kerberosIV
581or
582.Pa /etc/kerberosV
583and configure.
584Remember to get a
585.Pa srvtab
586from the master so that the remote commands work.
587.Ss Mail Aliases
588Check
589.Pa /etc/mail/aliases
590and update appropriately if you want e-mail to be routed
591to non-local address or to different users.
592.Pp
593Run
594.Xr newaliases 1
595after changes.
596.Ss Sendmail
597.Nx
598ships with a default
599.Pa /etc/mail/sendmail.cf
600file that will work for simple installations; it was generated from
601.Pa netbsd-proto.mc
602in
603.Pa /usr/share/sendmail/cf .
604Please see
605.Pa /usr/share/sendmail/README
606and
607.Pa /usr/share/doc/smm/08.sendmailop/op.me
608for information on generating your own sendmail configuration files.
609.Pa /etc/mailer.conf
610is configured to use Sendmail binaries by default.
611.Ss Postfix
612.Nx
613comes also with Postfix in the base system. You may wish to
614setup it in favor of sendmail. Take a look to
615.Pa /etc/postfix/main.cf
616and enable the daemon in
617.Pa /etc/rc.conf
618using "postfix=yes".
619It is very important to configure
620.Pa /etc/mailer.conf
621to point to Postfix binaries.
622.Ss DHCP server
623If this is a
624DHCP
625server, edit
626.Pa /etc/dhcpd.conf
627and
628.Pa /etc/dhcpd.interfaces
629as needed.
630You will have to make sure
631.Pa /etc/rc.conf
632has "dhcpd=yes"
633or run
634.Xr dhcpd 8
635manually.
636.Ss Bootparam server
637If this is a
638Bootparam
639server, edit
640.Pa /etc/bootparams
641as needed.
642You will have to turn it on in
643.Pa /etc/rc.conf
644by adding "bootparamd=yes".
645.Ss NFS server
646If this is an NFS server, make sure
647.Pa /etc/rc.conf
648has:
649.Bd -literal -offset indent
650nfs_server=yes
651mountd=yes
652rpcbind=yes
653.Ed
654.Pp
655Edit
656.Pa /etc/exports
657and get it correct. After this, you can start the server by issuing:
658.Bd -literal -offset indent
659.Ic /etc/rc.d/nfsd start
660.Ed
661which will also start dependancies.
662.Ss HP remote boot server
663Edit
664.Pa /etc/rbootd.conf
665if needed for remote booting.
666If you do not have HP computers doing remote booting, do not enable this.
667.Ss Daily, weekly, monthly scripts
668Look at and possibly edit the
669.Pa /etc/daily.conf , /etc/weekly.conf ,
670and
671.Pa /etc/monthly.conf
672configuration files. You can check which values you can set by looking
673to their matching files in
674.Pa /etc/defaults .
675Your site specific things should go into
676.Pa /etc/daily.local , /etc/weekly.local ,
677and
678.Pa /etc/monthly.local .
679.Pp
680These scripts have been limited so as to keep the system running without
681filling up disk space from normal running processes and database updates.
682(You probably do not need to understand them.)
683.Ss Other files in /etc
684Look at the other files in
685.Pa /etc
686and edit them as needed.
687(Do not edit files ending in
688.Pa .db
689\(em like
690.Pa pwd.db , spwd.db ,
691nor
692.Pa localtime ,
693nor
694.Pa rmt ,
695nor any directories.)
696.Ss Crontab (background running processes)
697Check what is running by typing
698.Ic crontab -l
699as root
700and see if anything unexpected is present.
701Do you need anything else?
702Do you wish to change things?
703e.g., if you do not
704like root getting standard output of the daily scripts, and want only
705the security scripts that are mailed internally, you can type
706.Ic crontab -e
707and change some of the lines to read:
708.Bd -literal -offset indent
70930  1  *  *  *   /bin/sh /etc/daily 2>&1 > /var/log/daily.out
71030  3  *  *  6   /bin/sh /etc/weekly 2>&1 > /var/log/weekly.out
71130  5  1  *  *   /bin/sh /etc/monthly 2>&1 > /var/log/monthly.out
712.Ed
713.Pp
714See
715.Xr crontab 5 .
716.Ss Next day cleanup
717After the first night's security run, change ownerships and permissions
718on files, directories, and devices; root should have received mail
719with subject: "<hostname> daily insecurity output.".
720This mail contains
721a set of security recommendations, presented as a list looking like this:
722.Bd -literal -offset indent
723var/mail:
724        permissions (0755, 0775)
725etc/daily:
726        user (0, 3)
727.Ed
728.Pp
729The best bet is to follow the advice in that list.
730The recommended setting is the first item in parentheses, while
731the current setting is the second one.
732This list is generated by
733.Xr mtree 8
734using
735.Pa /etc/mtree/special .
736Use
737.Xr chmod 1 ,
738.Xr chgrp 1 ,
739and
740.Xr chown 8
741as needed.
742.Ss Packages
743Install your own packages.
744The
745.Nx
746package collection includes a large set of Third-Party
747software. A lot of it is available as binary packages that you can
748download from
749.Pa ftp://ftp.netbsd.org
750or a mirror, and install using
751.Xr pkg_add 1 .
752See
753.Pa http://www.netbsd.org/Documentation/software/
754and
755.Xr packages 7
756for more details.
757.Pp
758Copy vendor binaries and install them.
759You will need to install any shared libraries, etc.
760(Hint:
761.Ic man -k compat
762to find out how to install and use compatibility mode.)
763.Pp
764There is also other Third-Party Software that is available
765in source form only, either because it has not been ported to
766.Nx
767yet, because licensing restrictions make binary redistribution
768impossible, or simply because you want to build your own binaries.
769This group is called pkgsrc. Sometimes checking the mailing lists for
770past problems that people have encountered will result in a fix posted.
771.Ss COMPILING A KERNEL
772First, review the system message buffer using the
773.Xr dmesg 8
774command to find out information on your system's devices as probed by the
775kernel at boot.
776In particular, note which devices were not configured.
777This information will prove useful when editing kernel configuration files.
778.Pp
779To compile a kernel inside a writable source tree, do the following:
780.Sm off
781.Bd -literal -offset indent
782.Li #\  Xo
783.Ic cd\ /usr/src/sys/arch/
784.Ar somearch
785.Ic /conf
786.Xc
787.Li #\  Xo
788.Ic vi\ \&
789.Ar SOMEFILE
790.No \ \ \ (to\ make\ any\ changes)
791.Xc
792.Li #\  Xo
793.Ic config\ \&
794.Ar SOMEFILE
795.Xc
796.Li #\  Xo
797.Ic cd\ ../compile/
798.Ar SOMEFILE
799.Xc
800.Li #\  Xo
801.Ic make
802.Xc
803.Ed
804.Sm on
805.Pp
806where
807.Ar somedir
808is a writable directory,
809.Ar somearch
810is the architecture (e.g.
811.Ic i386 ) ,
812and
813.Ar SOMEFILE
814should be a name indicative of a particular configuration (often
815that of the hostname).
816You can also do a
817.Ic make depend
818so that you will have dependencies there the next time you do a compile.
819.Pp
820If you are building your kernel again, before you do a
821.Ic make
822you should do a
823.Ic make depend
824after making changes (including updates or patches) to your kernel source,
825or a
826.Ic make clean
827after making changes to your kernel options.
828.Pp
829After either of these two methods, you can place the new kernel (called
830.Pa netbsd )
831in
832.Pa /
833(i.e.
834.Pa /netbsd )
835by issuing
836.Ic make install
837and the system will boot it next time.
838The old kernel is stored as
839.Pa /onetbsd
840so you can boot it in case of failure.
841.Pp
842If you are using toolchain to build your kernel, you will also need to
843build a new set of toolchain binaries. You can do it by entering
844.Pa /usr/src
845and issuing
846.Ic ./build.sh tools
847.Sh SEE ALSO
848.Xr chgrp 1 ,
849.Xr chmod 1 ,
850.Xr crontab 1 ,
851.Xr date 1 ,
852.Xr df 1 ,
853.Xr domainname 1 ,
854.Xr hostname 1 ,
855.Xr make 1 ,
856.Xr man 1 ,
857.Xr netstat 1 ,
858.Xr newaliases 1 ,
859.Xr passwd 1 ,
860.Xr su 1 ,
861.Xr ccd 4 ,
862.Xr aliases 5 ,
863.Xr crontab 5 ,
864.Xr exports 5 ,
865.Xr fstab 5 ,
866.Xr group 5 ,
867.Xr krb.conf 5 ,
868.Xr krb.realms 5 ,
869.Xr passwd 5 ,
870.Xr rc.conf 5 ,
871.Xr resolv.conf 5 ,
872.Xr hostname 7 ,
873.Xr packages 7 ,
874.Xr adduser 8 ,
875.Xr amd 8 ,
876.Xr bootparamd 8 ,
877.Xr ccdconfig 8 ,
878.Xr chown 8 ,
879.Xr config 8 ,
880.Xr dhcpd 8 ,
881.Xr ifconfig 8 ,
882.Xr inetd 8 ,
883.Xr kerberos 8 ,
884.Xr mount 8 ,
885.Xr mrouted 8 ,
886.Xr mtree 8 ,
887.Xr named 8 ,
888.Xr rbootd 8 ,
889.Xr rc 8 ,
890.Xr rmt 8 ,
891.Xr route 8 ,
892.Xr sushi 8 ,
893.Xr umount 8 ,
894.Xr vipw 8 ,
895.Xr ypbind 8
896.Sh HISTORY
897This document first appeared in
898.Ox 2.2 .
899It has been adapted to
900.Nx
901and first appeared in
902.Nx 2.0 .
903