NB from 2.0 : there is no need to change the keyboard layout on the first boot anymore. Sysinst has already modified the /etc/wscons.conf file for you.
First verify that your setup for your partition is fine, always a good idea to see what your OS needs as disk space to run :
> df
Check your corresponding /etc/fstab file (add softdep setting now if you want to).
> vi /etc/fstab
Check what is running by default :
> top
Check which internet socket are open :
> netstat -f inet
First just read your /etc/rc.conf. It gather all your system custom configuration.
> more /etc/rc.conf
Pretty empty heh ? then all the settings come from the default file :
> more /etc/defaults/rc.conf
Now you know how to turn on or off the base components of your OS. For example if you have a GENERIC_LAPTOP kernel running, you can turn on the Advanced Power Management Deamon :
apmd=YES
You may also have some devices to read floppy, cd , dvd, etc.
Let say that you have one floppy drive and one cdrom reader for example.
To be able to use them now edit /etc/fstab to add entries for cdrom and floppy. Simply add those lines :
/dev/cd0 /mnt/cdrom cd9660 ro,noauto 0 0 /dev/fd0 /mnt/floppy msdos rw,noauto 0 0
Then you have to create those directories :
> mkdir /mnt/cdrom /mnt/floppy
Do the same for any device you may want to mount. "man fstab" is your friend :-). And remember putting all your mounted devices in /mnt will prevent a mess in your root directory (especially true if you have multiple HDD)
Now you need to setup a hostname for your computer.
The easiest way to do that is by creating the file /etc/myname, and put the hostname in.
> echo "MyHostname" > /etc/myname
You might also need to add the hostname to your /etc/hosts file
> vi /etc/hosts
::1 MyHostName localhost localhost. 127.0.0.1 MyHostName localhost localhost.
Then you need to setup your network card (also called "interface"). Once again edit your rc.conf :
> vi /etc/rc.conf
If you are connected to a DHCP server, and want to use the network information it can provide :
dhclient=YES dhclient_flags=”<interface>”
<interface> means the network interface that appear in dmesg. For me “ne0”.
Otherwise you can provide static network information by creating a specific file for ifconfig:
> vi /etc/ifconfig.<interface>
and inside put the parameter you would put like using ifconfig on the command line :
inet 192.168.0.42 netmask 0xffffff00
You can test your network configuration anytime by calling :
> ifconfig -a
Once you have activated the interface, you can go to another machine connected to the network and try to ping your new NetBSD computer.
Now to access internet from your new NetBSD computer you need to define the gateway. For example :
> echo "192.168.1.1" > /etc/mygate
Then you have to define the dns server to resolv internet names. Edit /etc/resolv.conf :
> vi /etc/resolv.conf
and add the DNS server(s) you want to use to resolve internet names.
name server 192.168.1.1
Now that you know what this is about, you can turn on or off the part of the system you want to use. For example I dont use sendmail, so I can remove it from /etc/rc.conf by editing it
> vi /etc/rc.conf
and adding this line
sendmail=NO
but I might use postfix from time to time just for smtp, and also to get all the maintenance messages sent to root... So go to your /etc/mailer.conf, comment the sendmail lines, and uncomment the postfix lines. now back to your /etc/rc.conf, and add :
postfix=YES
Now I advise you to create a new user, for you and your every-day work. Using the system always with a root account is a bad idea, as one little mistake can destroy everything...
So first enable ksh by default for all the new created users
> vi /etc/usermgmt.conf
change the related line to be :
shell /bin/ksh
Now you can add a new user with his own group, who will be able to su to root and define his password:
> useradd -G wheel -g <username> -m <username> > passwd <username>
Then exit and login again as the new user. If everything works fine, you can call "su" to authenticate as root again to continue to setup your OS.
On many applications and systems nowadays, you need to be identify by an SSL Key.
Let's start by creating one RSA key :
> ssh-keygen -t rsa
I would advise to setup a passphrase and store the key in the default location ( .ssh subdirectory ). Later on we will setup the user session to run the ssh-agent automatically at startup.
Now lets get a bit more fancy :-)
I like having 4 virtual terminal, but it might be usefull to be able to use the max amount, that is 8 of them.
WARNING : If you plan to run X, you should NOT RUN GETTY on the same terminal. I usually keep the last one for X.
First you have to edit /etc/wscons.conf :
> vi /etc/wscons.conf
and add the corresponding line at the right place :
screen 1 - - screen 2 - - screen 3 - - screen 4 - - screen 5 - - screen 6 - - screen 7 - -
then to be able to log in those terminals, you have to edit /etc/ttys :
> vi /etc/ttys
Usually I change console to off, and I keep ttyE0 to off not to mix console output and shell, then I add the needed lines :
console "/usr/libexec/getty Pc" vt100 off secure ttyE0 "/usr/libexec/getty Pc" vt220 off secure ttyE1 "/usr/libexec/getty Pc" vt220 on secure ttyE2 "/usr/libexec/getty Pc" vt220 on secure ttyE3 "/usr/libexec/getty Pc" vt220 on secure ttyE4 "/usr/libexec/getty Pc" vt220 on secure ttyE5 "/usr/libexec/getty Pc" vt220 on secure ttyE6 "/usr/libexec/getty Pc" vt220 on secure ttyE7 "/usr/libexec/getty Pc" vt220 off secure
reboot and give it a try :-)
Do you want to setup X ? just run :
> xf86cfg
It should detect your hardware, and setup a default configuration for you. After that you can customize your X setup.
Then exit and save the configuration. Now test it :
> startx
The server X will run with all the default settings. If you want to customize the setup, copy xinitrc to your local folder :
> cp /etc/X11/xinit/xinitrc ~/.xinitrc
If everything runs fine, you can now setup XDM. First be sure of the terminal you want to run X on (careful ttys start at 0 but vt starts at 1) :
> vi /etc/X11/xdm/Xservers
:0 local /usr/X11R6/bin/X vt08 -nolisten tcp
Now for the Desktop configuration, you need to turn it on in your /etc/rc.conf :
> vi /etc/rc.conf
xdm=YES
Now on your next start up xdm will be running on the 8th virtual terminal.
For the Server Configuration, you can still run X when you need it by using the 'startx' command.
We will go a bit further later on when we will have our desktop manager :-).
And now what if you want to be able to install software ? or customise your installation even more ? Then try this usefull script : sysupdate.
To retrieve it from your machine, maybe the simplest way is just to use telnet :
> telnet download.gna.org 80 > sysupdate GET http://download.gna.org/netbsd-intro/sysupdate
And remove the HTTP headers...
Using this script you can quite easily download and update via CVS the source for the OS (/usr/src) for the X server (/usr/xsrc) or the pkgsrc tree (/usr/pkgsrc)
Just look at the first lines, you will see where you can easily customize the variables to match your needs.
For the next step, just checkout pkgsrc like that :
> ./sysupdate pkgsrc
Here are the packages you would like to have in any case :
pkgtools/pkg_install : install it first to have the latest verison of the packages install tools
devel/cpuflags : install it first to optimize building from sources for your cpu...
shells/standalone-tcsh : install it if you want to get rid of ksh :). You can make it the default for all users if you want to.
security/auditpackages : install it to know if the package you are trying to install has a security flaw in it.
pkgtools/pkgfind : really usefull to find the package you need.
pkgtools/pkg_chk : really usefull to know which ones of your packages needs to be updated
net/wget : really usefull to grab files from the web
www/links : text based web browser, cause you always need to browse the web to get informations.
To install a package is pretty easy. For example for pkg_install :
> cd /usr/pkgsrc/pkgtools/pkg_install > make install
For the root user I like to have a better window manager than twm. Let's install fluxbox :
> cd /usr/pkgsrc/wm/fluxbox > make update
I used make update here in case of fluxbox needed a sub-dependency to be updated, it will not stop the process and will just do it.
Now you can modify ~/.xinitrc :
> vi ~/.xinitrc
Remove any other window manager ( like twm ). Just make sure that the last line actually runs fluxbox. Of course you can still run some other usefull apps before that. For example :
xclock -geometry 50x50-1+1 & xterm -geometry 80x50+494+51 & xterm -geometry 80x20+494-0 & xterm -geometry 80x66+0+0 & exec fluxbox
This way the server will exit when you exit the window manager.
For the power user the idea is to get the ssh-agent setup on the startup of his session. Then we will use XFCE4 along with xdm.
First we need to create the ~/.xsession file to startup the agent. Mine looks like that :
#!/bin/sh if [ -d $HOME/.ssh ] then EXEC="exec ssh-agent" else EXEC="exec" fi if [ -x $HOME/.xinitrc ] then $EXEC $HOME/.xinitrc else $EXEC xterm -geometry 80x24+0-60 -ls fi
If you have a key in the default .ssh directory, it will start the agent along with your .xinitrc.
Now we need to run ssh-add to add the key to the agent, and ask for the password. Edit your .xinitrc :
> vi .xinitrc
after the Xresources setup sections, it should look like that :
if [ X$SSH_AUTH_SOCK != X ]; then ssh-add < /dev/null & fi exec startxfce4
Just keep in mind that XCFE4 has a session manager which can automatically rerun apps from the last saved session.
Now on every login ssh-askpass will popup and ask you for your passphrase if needed. Your agent will be running in the background to authentify you without annoying you ;-)
Now that we have a nicely setup X we can install java.
As you are told when you do :
> cd /usr/pkgsrc/lang/sun-jdk15 > make update
You will have to have the linux compatibility enabled (enabled by default in the GENERIC Kernel) and the linux procfs mounted (you already knw how to do that).
You will also need to increase the default limits for the user, and setup the rights paths.
This is how I setup my .cshrc for it (using csh or tcsh) :
#java setup
limit datasize 656020
setenv JAVA_HOME /usr/pkg/java/sun-1.5
setenv PATH ${PATH}:${JAVA_HOME}/bin
setenv CLASSPATH ${JAVA_HOME}/jre/lib/rt.jar
and for the .profile if you are using sh or ksh :
#java setup TODO
Now your java installaiton should work. You can give it a try :
> java -version