I will also be putting in tips that are scattered over some of my other pages, finally getting them all in one place. I installed NetBSD on fairly vanilla hardware. The installation was fairly straightforward. There are differences, but anyone who has installed FreeBSD should have no problems. The first step was looking around to see how to set up dhcp if I missed it during installation. Like FreeBSD, it uses /etc/rc.conf. If you want your interface to use dhcp then you would set it up this way. Let's assume your interface is tlp0. Add the following to your /etc/rc.conf
dhclient=YES dhclient_flags="tlp0" |
You'll be able to either choose dhcp or set up a static address during installation. (When you've finished the basic installation, and are given choices of rebooting, etc, choose the utility menu which has an option to configure the network.) However, if for example, you began with dhcp and then decided to change tlp0 to a static address, you would do the following. Create a file called /etc/ifconfig.tlp0 and open it.
inet 192.168.1.104 netmask 255.255.255.0 |
This will enable the interface to be started at boot time. If you later decided to change it to dhcp, you can make the changes to rc.conf that I mentioned above, the dhclient=YES and the flags line.
(NOTE: This has changed in 2.x. Now, one can simply add the line to /etc/rc.conf. This may have even been the case in 1.x but I no longer have a 1.x box to use to test it). Like FreeBSD, it should be doublequoted, e.g
ifconfig_tlp0="inet 192.168.1.104 netmask 255.255.255.0" |
The hostname can be put into rc.conf or you can create a file called /etc/myname and put it in there. If you decide to use rc.conf the syntax is
hostname=myhost.myhost.com |
That of course, is assuming that your local hostname is myhost and your domain is myhost.com. This also goes for the default route. You can create a file called /etc/mygate or, preferably, put it in /etc/rc.conf. The syntax for /etc/rc.conf is
defaultroute=192.168.1.1 |
That assumes that your gateway is 192.168.1.1
SSHD is also not running at startup. To change this, add the following to /etc/rc.conf
sshd=YES |
ftp ftp.NetBSD.org cd pub/NetBSD/NetBSD-current/tar_files get pkgsrc.tar.gz |
Once that's done, you can untar it into /usr.
tar -xzvpf pkgsrc.tar.gz -C /usr |
It's upgraded the same way. Get the latest pkgsrc.tar.gz then remove your old collection.
cd /usr rm -rf pkgsrc |
From there, untar the new pkgsrc in the same way you did it the first time.
Once it has been installed, the first thing to do is install or update pkg_install
cd /usr/pkgsrc/pkgtools/pkg_install make clean make install |
Then, we want to install audit-packages (there will be warning if you install anything else first)
cd /usr/pkgsrc/security/audit-packages make install clean |
Once the audit-packages is installed, there are messages telling you how you might want to run the update daily, and audit the packages daily as well. However, assuming you're doing this manually
/usr/pkg/sbin/download-vulnerability-list /usr/pkg/sbin/audit-packages |
Once that is done, you can begin installing the packages you want in the usual way. Note that rather than /usr/local/etc, /usr/local/bin, etc, NetBSD uses /usr/pkg.
One thing you'll run into is that certain programs, opera for instance, and anything that uses openssl will stop with an error code--the message however, makes it clear what to do. You will have to add a line to your /etc/mk.conf that will begin with
ACCEPTABLE_LICENSES+= |
and whatever they tell you to put in, for example, opera-license, fee-based-commercial use, etc. I find the easiest way to do it, especially as the default csh doesn't have tab completion, is to simply, from whatever directory I'm in, eg /usr/pkgsrc/www/opera7 is to do
echo "ACCEPTABLE_LICENSES+=opera-license" >> /etc/mk.conf |
then repeat the make install clean.
(Note that as of NetBSD-3.x, you can choose a default shell of /bin/ksh which does have tab completion.)Some, though not all, packages have a make show-options target. If this is the case, in the package's directory, there will be an options.mk file. For example, if I use kinput2 a Japanese input method and, after doing a cd to /usr/pkgsrc/inputmethod/kinput2 I type
make show-options |
Any of the following general options may be selected: At least one of the following inputmethod options must be selected: canna Use Canna as Japanese conversion program. sj3 Use SJ3 for Kana-to-Kanji conversion. wnn4 Use wnn for Kana-to-Kanji conversion. These options are enabled by default: canna sj3 wnn4 These options are currently enabled: canna sj3 wnn4 |
make PKG_OPTIONS.kinput2="-sj3 -wnn4" install clean |
Any of the following general options may be selected: At least one of the following inputmethod options must be selected: canna Use Canna as Japanese conversion program. sj3 Use SJ3 for Kana-to-Kanji conversion. wnn4 Use wnn for Kana-to-Kanji conversion. These options are enabled by default: canna sj3 These options are currently enabled: canna sj3 |
However, suppose I want both canna and wnn4. In that case I would type
make PKG_OPTIONS.kinput2="wnn4 -sj3" install clean |
In other words, if you want to add a non-default option, you don't need a +=, you can simply use PKG_OPTION.pkgname="non-default_option" Nor do you need to specify a default option. If you don't want a default option, then you do specify it with a minus sign in front of it. If you just want all default options, nothing more and nothing less, you can simply type make install clean without worrying about the PKG_OPTIONS.pkgname variable.
Many people prefer to add PKG_OPTIONS.pkgname variables to /etc/mk.conf so they don't have to remember each time. The syntax is pretty similar, but one doesn't use quotes. For example, if I added a line in /etc/mk.conf
PKG_OPTIONS.kinput2="wnn4 -sj3" |
PKG_OPTIONS.kinput2=wnn4 -sj3 |
export TERM=cons25 |
I've also found the oddity that NetBSD's version of the rxvt X terminal won't show colors in mutt. Again, if you want them, just export the terminal to cons25 and you'll see colors.
In FreeBSD, rather than than "black" as a background color, I've always used the word "default" in my .muttrc. This doesn't work in NetBSD, it doesn't recognize it. So, if you want red on a black background in something, use the word black rather than the word default.
Although NetBSD has Sylpheed-claws, it doesn't have mutt-devel in its package lists. So, I usually just go to mutt's site and get it. I put it in /usr/pkg/bin rather than its default user local. One would just do this during the configuration. Hopefully, the reader who is going to do this knows about installing from source, but as this page is meant to be a step by step (At time of writing, mutt-devel is 1.5 something)
tar -zxvf mutt* cd mutt-1.5* ./configure --prefix=/usr/pkg make make install |
title NetBSD 1.6.1 rootnoverify (hd0,2) chainloader +1 |
If you install grub on NetBSD itself, it's a bit different than doing it on Linux or FreeBSD. Firstly, /boot is a datafile rather than a directory. I figured out the solution by looking at the grub-install script. In NetBSD one first creates a /grub partition. Then, copy over the files from /usr/pkg/share/grub/i386~ to the grub partition.
mkdir /grub cp -r /usr/pkg/share/grub/i386~/* /grub/ |
After that, if one does the usual and types the grub command then does the
root (hd0, |
then hits the tab key, then the standard setup (hd0) commands it will install. It'll first look for a /boot/grub directory, but then it will look for the /grub directory.
cd /usr/pkgsrc/inputmethod/anthy make install clean; make clean-depends cd ../uim make PKG_OPTIONS.uim="-canna" install clean; make clean-depends |
Add the following to your .xinitrc above the line calling your window manager.
exportXMODIFIERS=@im=uim uim-xim --engine=anthy & |
If you choose to use UTF-8, I recommend /usr/pkgsrc/rxvt-unicode, called as always with urxvt. I find the euc.JP fonts somewhat nicer as of December 2005, and often use mrxvt or rxvt. One can set LC_CTYPE with a script (handy if you switch between the two of them) or set it in .xinitrc.
LC_CTYPE=en_US.UTF-8 (if you prefer euc then set this to ja_JP.eucJP) |
If you use rxvt, any particular settings for rxvt that you wish to be permanent are put in /usr/pkg/lib/X11/app-defaults/Rxvt. For example I like to have a black background with white letters, so my file has
Rxvt*foreground: white Rxvt*background: black |
When rxvt is installed, there is a message telling you that double byte encoding is disabled by default and that one should edit the app-defaults/Rxvt file.
You will see several lines commented out with a ! that begin
Rxvt.multichar_encoding |
followed by things like eucj. Remove the ! at the beginning of the line with eucj and put a ! in front of the line that that ends with noenc.
I actually prefer mrxvt to rxvt. To use mrxvt you hvae to slightly edit the Makefile. Using your favorite text editor open /usr/pkgsrc/x11/mrxvt/Makefile and in the CONFIGURE_ARGS+= section add the following.
CONFIGURE_ARGS+= --enable-xim CONFIGURE_ARGS+= --enable-cjk CONFIGURE_ARGS+= --with-encoding=eucj |
To use Japanese input one calls up uim by hitting shift+space.
To get UTF-8 working with some applications, such as thunderbird, you
will may have to install a ja_JP.UTF-8 locale. (This isn't necessary to
use Japanese in urxvt, however.) To do this get the en_US.UTF-8.src
from
ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/share/locale/ctype
Then use mklocale to generate ja_JP.UTF-8. If you downloaded it as user
joe then as root or with root privilege
cd /usr/share/locale mklocale < /home/joe/en_US.UTF-8.src > ja_JP.UTF-8 |
If one decides to use kinput2 and canna
cd /usr/pkgsrc/inputmethod/canna make install clean cd ../kinput2 make PKG_OPTIONS.kinput2="-wnn4 -sj3" install clean make clean-depends |
Then one starts cannaserver with /usr/pkg/sbin/cannaserver and calls kinput2 with kinput2 -canna &. As most folks know, Japanese input is invoked by hitting shift+space. For more information on this, (such as starting X with kinput2 running) see my page mentioned above about inputting Japanese in *nix.
When one starts kinput2, they sometimes get an error that says it can't load the app-defaults file and that XFILESEARCHPATH might be set incorrectly. Adding the following to my .zshrc fixed the problem
XFILESEARCHPATH=/usr/pkg/lib/X11/app-defaults/Kinput2; export XFILESEARCHPATH |
PATH=$PATH:/usr/X11R6/bin; export PATH |
To get file completion in ksh, create a .kshrc file if it's not there already. Add the following
set -o emacs bind "^I=complete" bind "^I=complete-list" |
Also, in your .profile add
export ENV=~/.kshrc |
This will enable tab completion and history with the up arrow.
If you do this as root, however, you'll frequently find that in the middle of, for example, installing a package, you'll get a notification like bind not found. Sometimes, this doesn't cause a problem, but at other times it seems to have caused package builds to fail. Therefore, I recommend that one keeps csh for root. For csh, which I don't use that often, one can do
set filec |
in their .cshrc which will enable tab completion with the Esc key. As both csh and ksh are in /bin, I usually just change root's default shell to ksh.
Note that in NetBSD-2.0 this has changed. One can now set root's shell to ksh without editing anything and have tab completion. (The csh shell, however, doesn't have tab completion.) An ordinary user's shell has tab completion, but doesn't have history navigation with the arrow keys. To fix this add
set -o emacs |
to the user's .kshrc.
X11_TYPE=xorg |
to /etc/mk.conf. (If /etc/mk.conf doesn't exist, create it.)
X Configuration is fairly standard. They use a slightly older version and rather than psm0 the mouse is wsmouse0. (This is with a standard MS PS/2 optical mouse.) Protocol is wsmouse.
To get different virtual consoles, one uses ctrl+alt+F2, F3 etc, rather than just alt+F2.
As of January 2004 at least, the NetBSD version of tar uses the y, rather than the j option to decompress a bz2 file.
For printing, I use CUPS. In FreeBSD I use ghostscript-gnu, however, in NetBSD, I found it only worked if I used ghostscript-esp.
This page just scratches the surface, but it is hoped that it can save the FreeBSD user who feels like trying another O/S a bit of time.