# NetBSD on SDF VPS

## Contents

- Basics
- Networking
- pkgsrc
- References

## Basics

Upon logging in to your VPS for the first time, one of the first things you will want to do is change the default root password by typing `passwd` at the prompt. Don't forget this password as there is currently no way to recover it.

It is customary on UNIX systems for the system clock to be set to UTC. To set the local time zone, find your zone file in `/usr/share/zoneinfo/` and link to it at `/etc/localtime` as follows:

    ln -fs /usr/share/zoneinfo/Europe/Helsinki /etc/localtime

It is also a good habit to create a regular user account for working, using `su` to obtain root privileges as needed. To create a regular user account which is part of the administrative `wheel` group:

    adduser -m -G wheel <username>

This user will be in the `wheel` group and will be able to perform administrative tasks by runing `su` to obtain superuser privileges using the root password.

## Networking

In your control panel at vps.sdf.org, note YOUR_IP (e.g. 192.94.73.255) on the top line, and YOUR_HOSTNAME (e.g. netbsd99).

Start your server, and log in via the console. (default= root:root)

Open /etc/rc.conf in an editor and, replacing the text YOUR_HOSTNAME and YOUR_IP with your own actual host name and IP number, add:

    hostname=YOUR_HOSTNAME.sdf.org
    defaultroute=192.94.73.1
    auto_ifconfig=yes
    ifconfig_xennet0="inet YOUR_IP netmask 0xffffff00"

Then put this in /etc/resolv.conf:

    nameserver 192.94.73.120

Add this to /etc/hosts:

    YOUR_IP 	YOUR_HOSTNAME.sdf.org 	YOUR_HOSTNAME

Run/Type:

    /etc/rc.d/network restart.

## pkgsrc

On NetBSD you can now mount a pre-build (and still in progress) pkgsrc DESTDIR. Following the procedures below will effectively install the 2000+ included packages on your virtual NetBSD system.

Note that at the moment the pre-built pkgsrc assumes that its path is /images/pkg_neb501 - otherwise some programs won't work (will not be able to use their shared libraries). The instructions below will show how to make this work.

Simply:

    mkdir -p /images/pkg_neb501
    rmdir /usr/pkg
    ln -s /images/pkg_neb501 /usr/pkg
    rm -rf /var/db/pkg
    ln -s /images/pkg_neb501/db/pkg /var/db/pkg
    mount -t nfs 192.94.73.120:/images/pkg_neb501 /images/pkg_neb501
    export PATH=$PATH:/usr/pkg/bin:/usr/pkg/sbin

It is read only.

To set this up on boot:

    mkdir -p /images/pkg_neb501
    rmdir /usr/pkg
    ln -s /images/pkg_neb501 /usr/pkg
    rm -rf /var/db/pkg
    ln -s /images/pkg_neb501/db/pkg /var/db/pkg

(These commands are only necessary if you didn't execute the procedure above.)

    echo "nfs_client=YES" >> /etc/rc.conf
    echo "rpcbind=YES" >> /etc/rc.conf
    echo "192.94.73.120 vps" >> /etc/hosts
    echo "vps:/images/pkg_neb501 /images/pkg_neb501 nfs ro" >> /etc/fstab
    echo "export PATH=$PATH:/usr/pkg/bin:/usr/pkg/sbin" >> /etc/profile

Note that you cannot use both this pre-build pkgsrc and pre-built packages from netbsd.org - it may be possible to set the system up so you can, however this is best left to the experienced NetBSD administrator.

## References

- The NetBSD Guide

$Id: VPS_NetBSD.html.bak,v 1.1 2019/12/06 20:50:52 thegiant Exp $