Hari's Corner

Humour, comics, tech, law, software, reviews, essays, articles and HOWTOs intermingled with random philosophy now and then

My NetBSD experiment - NetBSD post-installation notes: Part 1

Filed under: Tutorials and HOWTOs by Hari
Posted on Sat, Jun 23, 2012 at 21:38 IST (last updated: Sat, Jun 23, 2012 @ 22:32 IST)

My geekier side, having asserted itself this weekend, I have once again plunged myself into a *BSD once again. This time, I had chosen NetBSD, being a nice, clean Free UNIX of the BSD family and geeky enough. Having downloaded the image for the USB image media (one hates burning CDs these days, even if they're cheap) for the latest version 5.1.2, I proceeded at once to install it beside Vista on my old laptop. :)

This will be a kind of step-by-step/semi-tutorial/semi-notes on my own explorations with NetBSD. Note that I write purely from my own experience - you are referred to the NetBSD documentation for authoritative information. I thought I'd create this for two reasons:

  1. To document my own progress with NetBSD so that I won't forget anything important.
  2. To consolidate some information that you have to really dig for or otherwise won't find on the NetBSD official documentation.

Writing the installation media

With Linux or similar OS, use dd. The syntax is simple enough. First unzip the gzipped file and then write it to the USB media.

gunzip amd64memstick-5.1.2.fs.gz
dd if=amd64memstick-5.1.2.fs of=/dev/sdxy -ibs=4M

Where amd64memstick-5.1.2.fs is the image to write, /dev/sdxy is the path of your USB device.

With Windows you should probably download and use a disk image writer program.

Installation tips

NetBSD is a hardcore UNIX, through and through. Though the installer is simple enough for somebody who's experienced with the Debian expert mode installer, Slackware or any other Linux distro that does no hand-holding, it can scare off potential users. Just a few specific things about the installation.

Here I'll document some of the steps I took after install.

Network Configuration (wireless)

My first step is always to configure the network and get internet access. In this case, I was lucky that NetBSD auto-detected my wireless card being wpi0, and thus worked out of the box. Others might not be so lucky in which case, the ethernet cable is a handy, if inconvenient, fallback.

Since I use WPA2/PSK on my home network, first thing I did was to create the /etc/wpa_supplicant.conf file.

network={
     ssid="mynetworkname"
     psk="mynetworkpassword"
     key_mgmt=WPA-PSK
     scan_ssid=1
}

Now proceed to configure the interface and enable wpa_supplicant in /etc/rc.conf. I added the following lines. Obviously the driver and interface will differ for those who a different brand network card.

wpa_supplicant=YES
wpa_suppiicant_flags="-Dbsd -iwpi0 -c/etc/wpa_supplicant.conf"
ifconfig_wpi0="192.168.1.25 netmask 255.255.255.0"
defaultroute=192.168.1.1

And also the /etc/resolv.conf file (obviously this depends on your network setup. For a DSL home router, I simply point to the router):

nameserver 192.168.1.1

Note: You can obviously use DHCP and avoid manually entering IP addresses. But I just happen to prefer this method. Network is configured a tad quicker with a static IP.

Note 2: For faster browsing I usually also enable BIND9 locally and use the 127.0.0.1 as my nameserver. This speeds up browsing and network access by reducing the nameserver lookup time. For this simply add the following lines to /etc/rc.conf:

named=YES

and put nameserver 127.0.0.1 as the first line in /etc/resolv.conf.

Now finally invoke wpa_supplicant and restart the networking daemon, or alternatively reboot your system to get network up and running.

Finally to test internet access, ping an external domain name like google.com.

Note: Add your machine name, i.e. the hostname to /etc/hosts to the IP 127.0.0.1 so that X.org will start up quicker and also other applications that depend on the hostname being set will work as expected.

Adding a normal user

Having configured the network, my second step is to create a regular user account for day to day use. The program is useradd and its syntax is simple enough:

useradd -m -p mypassword myname

Note that passwords have to be a mix of upper and lowercase characters (as a minimum security precaution) otherwise NetBSD won't accept it.

And more

In the next part, I'll go through setting up a basic workstation with GUI - just enough to get you started and browse the web. Installing KDE and its goodies will come later.

No comments yet

There are no comments for this article yet.

Comments closed

The blog owner has closed further commenting on this entry.