Introduction

You will be installing NetBSD 4.0 from cd, and familiarizing yourself with the system. There are a number of differences between linux and BSD that must be noted. In particular, very few applications are installed with NetBSD by default, so steps must be taken to get a system that allows web browsing and upgrading of its encryption software. We will install the system, use dhcp, and use ftp to upgrade/install programs and learn about controlling basic internet services.

Questions:

Installing from cd takes about 4 minutes :)
What is the size of the install cd for NetBSD 4.0?

Preconditions

You need to have (for this lab) the back row servers bridged (so you will be able to access the internet, to download the required software packages to complete the lab). We will use them as routers next week, but for now we just want to get on the net.

Steps

Questions:

It warns you about a 4 step procedure to do the install.
Write out the 4 steps:
1.

2.

3.

4.

Questions:

sysinst describes your disk next. Write out the details:


This is a little mysterious at first, but all BSD installs want you to define the sizes of partitions, and invite you to isolate /usr, /var, and /home on their own partitions. Swap is created for you, / is created for you. Set a size of 5GB for each additional partition by highlighting it (arrow navigation) and entering a size. Accept the sizes.

This next part is called the disklabel.
It is where the partition table and mount points are defined.

Questions:

Write out the disklabel that is about to be written, from partition a: to g:



What are the partitions that will contain data?

Questions:

What is the command that runs that is doing the formatting?

Questions:

What command runs when you select the shell?

What file does sysinst advise you to edit on the 'installation complete' page?

What file contains its default values?

This operating system is fully functional, but contains few applications unlike linux. It does not have a web browser, or perl (yet).
Select reboot from the menu.
When your newly installed system (with no password) boots, login as root. Since you are at the console, you get access.

Questions:

Write out the result of the 'df' command:




When your newly installed system (with no password) boots, it will need an IP.
Run this command: /sbin/dhclient
This will turn on the ISC dhcp client for unix, and you will get an IP. Please write out the complete output from the dhclient program (version, interface, mac address, messages, final address):







RC.CONF:

It is critical to understand that nothing starts on BSD unless it is present in the file /etc/rc.conf (remember that rc always stands for runtime commands), or in the file /etc/defaults/rc.conf if it exists.
None of the start scripts in /etc/rc.d/ (see below) will work either.
Run a shell command like the one in /etc/rc.conf:

Questions:

test -r /etc/defaults/rc.conf;echo $?

(note: the command is actually $? the question mark is literal)

What is the output of this?

What does it mean?


Open the file /etc/defaults/rc.conf.
What are the settings for the following services?

    ipfilter		______
    ipnat		______
    ipmon		______
    dhclient		______
    inetd		______
    cron		______
    sshd		______
    

To turn on any service, put its name in /etc/rc.conf with =YES after it. We don't edit /etc/defaults/rc.conf, we copy the lines out and paste them into /etc/rc.conf and change them there.
use vi for this where foo is some service name:

Note: you must put the new entries in rc.conf at the BOTTOM of the file, not the top

Commands:

    vi /etc/defaults/rc.conf
    /foo
    yy
    :e /etc/rc.conf
    p
    :wq
    

Explaination of the vi commands you just used

/searchterm
Search the document for 'searchterm'
yy
copy the current line
:e filename
edit 'filename'
p
Paste
:wq
Write (Save) changes, and Quit

This procedure guarantees a 'no typo' edit of this file. Errors in rc.conf are showstoppers. You can cause a system to not boot if it is not right.
Turn on sshd and dhclient and reboot.

Questions:

Log in again and write down the pid #s of dhclient and sshd:


RC.D

Look at the contents of /etc/rc.d - this is a collection of start/stop scripts that can be used to control services on your server. Nothing will run or affect anything unless there is an rc.conf entry!

RC.LOCAL

This file is checked for commands on boot after everything in rc.conf. It is a critical system file that you usually use for daemon start up if you have customized server applications and don't want to use the /etc/rc.d scripts.

TIME:

You must get in the habit of always locking your system time to NTP.

Questions:

Write out the result of the command "whereis ntpdate":


Run the command with the argument "time.nrc.ca" and write out the output:


Write the line to install the command in root's crontab so that it runs once an hour:


Write the line to put in /etc/rc.local (see below, maybe come back to this question later) so that it runs on boot.

LYNX:

Lynx is a terminal web browser, it is very useful for retrieiving files from websites, when you do not have a full graphical environment.

Commands:

    ftp lynx.isc.org
	user ftp
	pass bleh
    cd release
    get lynx2.8.6.tar.gz
    quit
	untar and change into the lynx directory.
    ./configure
    make 
    make install
    whereis lynx
    

PERL:

You can now use the web. Next you will install perl.
Get back into /usr/local.

lynx perl.com

Surf around and grab the stable.tar.gz unix source code. select 'D'ownload, and save the file. Untar and cd into the perl directory.
Read the file INSTALL and follow the instructions.

Questions:

Write out the commands you typed to install perl:







Write out the location of the perl binary on your system:

STANDARD LOGIN:

Add a user that can log in successfully.
NetBSD will not create the home directory for you, unless you specifically tell it to.

Questions:

Write the command with arguments that will incorporate all necessary functions into the useradd command.


Attempt to log in to your system remotely, using ssh, as the user you just added, and get a root shell (using su).
Don't edit /etc/ssh/sshd_config to PermitRootLogin (we'll deal with that later).
What message do you get when you try to su?


What group must a user be in to su to root?


Add your self to this group, what is the command?


Are you asked for a password if you are in the group and there is no root password?


Please set a root password on the system.

Last updated: 2008-01-08
Updated by: Allan Jude

Written by: Allan Jude (2007)