0% found this document useful (0 votes)
225 views

Netbsd Install

NetBSD is a highly portable open source operating system that supports many hardware architectures. This document provides instructions for installing NetBSD, including downloading the installation media, performing a basic system configuration, and installing additional packages like KDE3 for a familiar desktop environment. Additional steps cover mounting and unmounting removable media like CDs, configuring networking using dhclient, and checking system configuration files like rc.conf.

Uploaded by

Andre
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
225 views

Netbsd Install

NetBSD is a highly portable open source operating system that supports many hardware architectures. This document provides instructions for installing NetBSD, including downloading the installation media, performing a basic system configuration, and installing additional packages like KDE3 for a familiar desktop environment. Additional steps cover mounting and unmounting removable media like CDs, configuring networking using dhclient, and checking system configuration files like rc.conf.

Uploaded by

Andre
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

get started

NetBSD
install
Patrick Pippen

NetBSD is one of the four major BSD systems available within the open source world
today. It prides itself on being secure, and highly portable. This makes it a excellent
multi-architecture system for uses as high-end servers to powerful desktops systems
to handy handhelds and embedded devices.

H
onestly, it is the only open source operating system password:
with a portable package management system. It is We recommend creating a non-root account and using su(1)
designed to take advantage of the latest high end for
hardware systems from Alpha, Motorola PowerPC, root access.
Sparc, and PC computing platforms, yet it still maintains support #
for even those older computer systems. And it even supports
more computer platforms than I wish to list in this article. Note: su(1): http://netbsd.gw.com/cgi-bin/man-cgi?su+1+
This is a concise description of NetBSD and since this NetBSD-current.
article is about installation and configuration of NetBSD. Let's It good system management to not use root for your daily
get started! day-to-day tasks of browsing the web. So, lets create a regular
user account for you to do such daily computing and make
Installation this account apart of the wheel group.
NetBSD is not as difficult to install as you may think, it comes
with an easy to use menu driven program called sysinst to # useradd -m -G wheel username
make installation quick and simple. In reality it's not that
difficult if you take the time to read through the NetBSD Guide After creating a regular user account for you to use. You
and follow the instructions within it. After some time you'll be need to set a password for this user as well. Note: Make
surprise how fast you can get it up and running. sure that you change bitweiler to your desired user name
instead.
Getting the Media
NetBSD can be installed from a variety of media. Since this # passwd username
issue comes with a DVD of NetBSD 4.0, I will assume you are
using installing from the DVD itself. If you do not have the DVD, Next let's go ahead and setup system time.
NetBSD ISO images can be downloaded and burned to a CD
from FTP, HTTP and even BitTorrent that are listed on the official # date 200809191610
website. Though I encourage you to purchase a CD as it is the
project's main source of revenue. Which sets the current date to August 19, 2008 4:10pm
Basic Network Configuration
Basic system configuration NetBSD uses /etc/rc.conf for system configuration on
Log in using root as the user name and the password you set system startup. Understanding this file is very important the
for root during the installation process. rc.conf (5) manual page will give you a list of all available
options that can be added to this file. The necessary
NetBSD/i386 (Amnesiac) (ttyE0) information needed in your rc.conf file, the installation process
login: root should have all ready set some of the necessary values.

10 BSD 1/2009
NetBSD install

Listing 1. Getting an inital pkgsrc tree and setting up a caching DNS server. (note: after installation)

$ export CVSROOT="[email protected]:/cvsroot"
$ export CVS_RSH="ssh"
$ cd /usr
$ cvs checkout -r pkgsrc-2008Q2 -P pkgsrc
Now that you have it, available packages for NetBSD can be found in /usr/pkgsrc.
Let's install a few to give you a fill of it's simplistic usage.
$ cd /usr/pkgsrc/net/maradns
$ make install clean
$ make clean-depends
Okay, I guess we should go ahead and set up a recursive(caching)DNS server for this machine as well.
This is the chroot directory maradns will run from.
$ mkdir -p /etc/maradns/logger
$ vi /etc/mararc
This is maradns configuration file, below are it's config options.
(Note: the documentation has more configuration options than are mention here.)
hide_disclaimer = "YES"
no_fingerprint = 1 # disable MaraDNS fingerprint
verbose_level = 3 # be verbose about query errors and log them.
ipv4_bind_addresses = "192.168.15.1, 127.0.0.1" # address to listen on
chroot_dir = "/etc/maradns"
recursive_acl = "192.168.15.0/24, 127.0.0.1" # addresses that can access this server.
upstream_servers["."] = "12.12.12.12" # your ISP's name server
csv2 = {}
csv2["domain.com."] = "db.domain.com" # our authoritative local zone file
debug_msg_level = 0 # so no info about maradns will be made public.
The default for debug_msg_level is 1 and in my opinion, it shouldn't give out information to
the public about itself when making queries. The default gives out maradns version number.
Consult the mararc man page for more variables that can be set.
Let's create our local zone file which will be in /etc/maradns directory.
vi /etc/maradns/db.domain.com
papa.% 192.168.15.100 # client machine
tango.% 192.168.15.120 # client machine
zulu.% 192.168.15.1 # our dns cache machine
The '%' will append domain.com to the above names when processing it's mara's shortcut for
the lazy at heart.To add MX records you just need to add to the zone file these lines for
each MX record serve.
domain.com. MX 10 mail.domain.com.
mail.domain.com. 192.168.15.130
This sets up mail for domain.com being mailed to mail.domain.com which has the ip address of
192.168.15.130. To be able to do reverse DNS lookups add to the zone file a PTR records.
Which would look like this for our example domain.
100.15.168.192.in-addr-arpa. PTR papa.domain.com.
120.15.168.192.in-addr-arpa. PTR tango.domain.com.
130.15.168.192.in-addr-arpa. PTR mail.domain.com.
1.15.168.192.in-addr-arpa. PTR zulu.domain.com.
To test it do: $ /usr/local/sbin/maradns
Switch to another termial or xterm to see if it running and do a netstat -an
(output edited for brevity)
Active Internet connections (including servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
udp 0 0 127.0.0.1.53 *.*
Look for this line, yes I see that the state isn't LISTEN udp services don't be in LISTEN
state. To make this run on boot we need to edit the /etc/rc.local file and add this line.
/etc/rc.local
/usr/local/bin/duende /usr/local/sbin/maradns > /var/log/maradns.log 2>&1
The /var/log/maradns.log 2>&1 isn't really needed but I added it to catch any info that stdout
and stderr might give out that you might would like to see. Be sure to create the
/var/log/maradns.log file before rebooting.
$ touch /var/log/maradns.log
Administration
Contents and permissions of /etc/maradns
$ls -l /etc/maradns
total 10
-rw-r--r-- 1 root wheel 59 Feb 28 16:44 db.domain.com
drwxr-xr-x 2 root wheel 512 Feb 19 08:23 logger
Next do some simple queries using askmara.
$ askmara Ngoogle.com.
$ askmara Nbsdnexus.com.
Maradns logs queries to /var/log/messages let's take a peek.(Again edited for brevity.)
$ more /var/log/messages|egrep dns
Jan 21 05:18:39 zulu /usr/local/sbin/maradns: Query from: 127.0.0.1 Ngoogle.com.
Jan 21 05:18:39 zulu /usr/local/sbin/maradns: Log: Message received, processing
Jan 21 05:19:03 zulu /usr/local/sbin/maradns: Query from: 127.0.0.1 Nbsdforums.com.
Jan 21 05:19:03 zulu /usr/local/sbin/maradns: Log: Message received, processing
If a weird crash or something unsuspected happens to your server check your
/var/log/maradns.log file which should be empty if everything is fine with your setup.
$ ls -l /var/log/maradns.log
-rw-r--r-- 1 root wheel 0 Mar 2 17:03 /var/log/maradns.log

www.bsdmag.org 11
get started
To read the manual page on # mount /floppy Back to installing a couple more
rc.conf. # mount /usb packages now. Go to /usr/pkgsrc/meta-
pkgs/kde3 so you can have a familiar
# man rc.conf Just remember when your finished using and comfortable desktop environment.
these devices you have to unmount it or No need to worry about dependency
The first modifications to your system use eject to umount and eject the cdrom checking NetBSD's pkgsrc system takes
should be to check make sure they exist media to safely remove the cd. care of all the worries for you and install
within your /etc/rc.conf. everything that's needed.
# umount /cdrom
• Set “rc_configured=yes” (the # umount /floppy $ cd /usr/pkgsrc/meta-pkgs/kde3
installation process may have # umount /usb $ make install clean
already did this.) (:optionally you can use the eject $ make clean-depends
• Set “dhclient=yes” command to umount and eject your cdrom
• Set “hostname=yourhostname” drive.) Afterwards you should add to your
• If this computer is connected to a # eject /dev/cd0a regular user account directory a .xinitrc
local network or a router. Set “defa file with the following contents.
ultroute=192.168.1.1” for example. Configuring the X server is easily done
Note:without the quotation marks with the root user just running xf86cfg to # su username
though. configure X, but do not start X just yet. # cd /home/username
$ echo startkde > .xinitrc
From here you can edit the /etc/ # xf86cfg # ln -s .xinitrc .xsession
resolv.conf file.
You'll need to be able resolve host Getting those extra packages All so make sure that the root user adds
names and ip addresses of remote host Even though NetBSD comes with these line to your /etc/rc.conf file.
systems to do so you just have access plenty of tools and is usable with just
to a local or remote DNS server. Add it to the base system, you probably would xfs=yes
this file using this syntax. like a working desktop system to really
see what NetBSD is all about. And Also make sure to add this to your /etc/
nameserver 164.253.3.75 as I mentioned before, pkgsrc is the rc.local file, so kdm starts automatically
most portable package management on system startup.
Mounting removable media system that I ever seen on any open $ echo /usr/X11r6/bin/kdm
There's really nothing difficult about source operating system. It currently Reboot and your NetBSD box is
mounting a CD-ROM, floppy, or USB works with FreeBSD, OpenBSD, ready to rock hard. From here you can
devices. It just takes reading the all so DragonflyBSD, Mac OS X, Linux, login through the kdm the X graphical
helpful mount manual page which even Solaris, plus a few more operating login manager.
gives examples of how to use mount systems. Pkgsrc originally came from What I've always love about NetBSD,
and it's options. Invoking mount by itself FreeBSD's ports system and was is that I don't have to buy a new computer
shows you want you the file systems that developed for NetBSD only, then it every couples of years or throw away
you have currently mounted. gradually progressed to support more older computers.
operating systems. I can keep the machines I've got and
# mkdir /cdrom Okay, I know your ready to dive into NetBSD works with it perfectly. I could not
# mkdir /floppy this package management system, so possibly cover everything in this article.
# mkdir /usb let's get going. Now that you got your system up and
Because binary packages aren't running I suggest you read through the
Then add to your /etc/fstab file so that always available for different applications, documentation. A Special thanks goes to
you can easily mount your removable it is best to get pkgsrc from a CVS the NetBSD & Pkgsrc
devices at anytime. repository . Using the sh or ksh shells developers for making such a great
we set it like so: see Listing 1. (Note: use open source operating system and
/dev/cd0a /cdrom cd9660 ro,noauto 0 0 setenv if your using the csh, “C shell”.) package management tools.
/dev/fd0a /floppy msdos
rw,noauto 0 0 Firewall configuration
/dev/sd0e /usb msdos rw,noauto 0 0 Simply don't allow outside IP addresses
to hit the server on port 53 UDP. Allow
On the ‘Net
No need to reboot you can now mount them to hit this server on ports between
your cdrom, floppy, an usb devices and 15000 – 19095 UDP where the source • http://www.netbsd.org/docs/guide/en/
start using it right away with these simple port from remote server is 53 UDP. Allow • http://www.netbsd.org/docs/pkgsrc/
commands. UDP connections from your clients on • http://wiki.netbsd.se/Main_Page
• http://wiki.netbsd.se/Main_Page
the lan that use the server's cache to hit
# mount /cdrom port 53 UDP.

12 BSD 1/2009
NetBSD install

01 03
Language selection Choosing to install to a hard drive media
To start the installation, boot your computer from the DVD. The Since this is a fresh install we are going to choose to Install
installer will load the kernel and show you which devices were NetBSD to hard disk option on the menu. It will also warning
found and are supported. you about backing up important data before taking this step.
After that you'll find yourself within the NetBSD installation Seriously, you should do it, unless you don't care about the
program sysinst. data on the hard disk. Which brings us to the next screen. To
To make a selection on the menu you can use the cursor confirm installing the program to the hard disk select Yes.
keys or just press the letter displayed left of each choice and Next, it shows a list of available hard drives we can install to.
confirm your choice by pressing the Return (Enter) Key. Since I only have one hard drive to install it only shows that
disk named, wd0. If you have more than one disk it would be
labeled wd1 as the second hard drive on your machine. If your
using SCSI or external USB drives it will be labeled sd0 as the
first and sd1 as the second. Sysinst will ask if you want a full,
minimal or custom installation. The default is full so we'll just go
with that. NetBSD will now offer to install a boot selector to your
hard drive so make sure you select yes to this option.

02 04

Selection of Keyboard layout Setting up the hard drive partitioning scheme


Start by selecting your language you prefer for the installation Now we can move on to creating the disklabel for this disk
procedure naturally I choose US-English, next you will select to create partitions or use the existing partition sizes, which
your keyboard layout this will bring you to the main menu of NetBSD is okay with, so select use existing partition sizes.
the installation program. If your experience tells you something different you can go
ahead and set the partition sizes to your liking.

www.bsdmag.org 13
get started

05 07
Installing a bootblock Selecting the installation media
After defining the disklabel the menu prompts you to name Now sysinst asks where it can find the installation media,
your disk which I called NBSD. since we are using the DVD media select the first option for
This our last chance to abort the installation before the CD-ROM/DVD and press return on your keyboard. During
anything is written to hard drive. So let's continue by selecting this step sysinst will install all selected sets and create device
yes. The next menu will ask us to select a bootblock, which the nodes and will display a message letting you know that
default Use BIOS Console is usually what we want. everything went well. Now hit enter to continue once we get to
this screen:

06 08

Install the base system Selection of system


Give yourself a big pat on the shoulder, you have just completed
password encryption algorithm
the most difficult part of the installation. On to the second half
of the installation process, which is extracting and installing Now lets get down to some of the basic system configuring,
operating system sets (kern, base, etc, comp....) Sysinst now starting with setting up the timezone specific to your area.
asks which verbosity level you would like to use while installing Using the cursor to scroll up and down the menu, then hitting
the sets. Since it's your first time it is best to stick with the enter to select your timezone, I chose US/Central for my
recommended verbosity level: Progress bar. So we can see timezone. The next thing you'll be asked is what encryption
what is going on during the installation of the sets. algorithm should be used for your password file. I recommend
for you to use the Blowfish algorithm.

14 BSD 1/2009
NetBSD install

09 11
Setting up the System manager password Selection of a default
After choosing your encryption algorithm, it will ask you to set
command shell for system manage
your root password. NetBSD does not start any services by
default when booting up after installation. I went ahead and choose ksh (Korn Shell) during this
installation and you should as well, those more experienced
with Unix shells are free to choose a root shell of your
preference. After choosing your shell, you can now hit enter.
Once you see this screen:

10 12

Choosing a password for the system manager Completing the installation


Still it is recommended that you go ahead and set your root That's it! NetBSD is now installed and you will be able to log
password here for security reasons. So, enter it once then into it right after you remove the DVD and reboot your machine.
sysinst will ask you to re-enter it again. Next you are asked to Come on now that didn't take hours of time did it?
choose a command shell. Traditionally BSD systems ship with
the csh (C shell) as system manager shell. You can choose
that one if you prefer. If you don't have any experience with Unix
shells then select sh as your command interpreter, you can
always change it later.

www.bsdmag.org 15

You might also like