Difference between revisions of "NetBSD"
m (→Booting the Installer) |
|||
Line 1: | Line 1: | ||
== c33ris2's gentle guide to installing NetBSD in a prgmr DomU (January 2009) == | == c33ris2's gentle guide to installing NetBSD in a prgmr DomU (January 2009) == | ||
+ | Note: By June 2010 (or earlier) <b><i>some</i></b> of the dom0 hosts have packed the installer files into the /distros collection available to many recovery images. In these cases, the fetching activity is no longer required. | ||
===Getting Started=== | ===Getting Started=== | ||
Line 80: | Line 81: | ||
===Booting the Installer=== | ===Booting the Installer=== | ||
− | Returning to [[Prgmr_menu|the control menu on your dom0 host]], destroy/shutdown your instance if it is running, and create/start it again, this time selecting first the "user bootloader configuration" from the options presented by the dom0, and after that select the installer from your new user bootloader. This should take you to the NetBSD Installer, for which | + | Returning to [[Prgmr_menu|the control menu on your dom0 host]], destroy/shutdown your instance if it is running, and create/start it again, this time selecting first the "user bootloader configuration" from the options presented by the dom0, and after that select the installer from your new user bootloader. This should take you to the NetBSD Installer, for which [http://netbsd.org/docs/guide/en/chap-exinst.html#exinst-starting a tutorial exists at netbsd.org] |
− | + | Install onto xbd0 | |
+ | When presented with the option, choose | ||
+ | <br><b>b: Use existing partition sizes</b> | ||
+ | <br>The next screen should show the existing BSD-disklabel partitions, as follows for a 6G allocation. | ||
+ | <pre> | ||
+ | Start MB End MB Size MB FS type Newfs Mount Mount point | ||
+ | --------- --------- --------- ---------- ----- ----- ----------- | ||
+ | a: 0 0 0 unused | ||
+ | b: 0 0 0 unused | ||
+ | c: 0 6143 6144 NetBSD partition | ||
+ | d: 0 6143 6144 Whole disk | ||
+ | e: 0 38 39 Linux Ext2 | ||
+ | f: 0 0 0 unused | ||
+ | </pre> | ||
+ | |||
+ | <i>If you're new to NetBSD partitioning, which I am, which is why I'm writing this, refer to [http://netbsd.org/docs/guide/en/chap-inst.html#chap-inst-install-partition this NetBSD Guide section]</i> | ||
+ | |||
+ | The purpose of examining this screen is to note that the Linux Ext2 partition used for the installer occupies the first 39 (numbered 0 thru 38) sectors of the partition. We need to set the NetBSD root after that, starting with sector 39. | ||
+ | |||
+ | Select "x: Partition sizes ok" and "no" to the opportunity to edit the partition table again. The installation will be aborted and you'll be returned to an earlier screen, which is intended by this tutorial. Proceed as before through the next few screens, but this time select | ||
+ | <br><b>a: Set sizes of NetBSD partitions</b> | ||
+ | <br>which will set up the default root and swap partitions. | ||
+ | |||
+ | Modify if desired, but it's not essential to do so. Chris makes the excellent suggestion to <b>"Add a user defined partition"</b> at /boot so that you can update the kernels and adjust the menu.lst later. | ||
+ | |||
+ | <br>The size here should be as noted earlier of the linux partition, 39MB in this example. | ||
+ | |||
+ | Select "accept these sizes", and you'll get a screen with one more chance, which we'll take, to modify the partitions, by selecting the DiskLabel a and changing the start point from 0 to 39 (MB). | ||
+ | |||
+ | If you added a label for /boot, you'll see it in the table, and it needs to be modified. Set the start to 0, and in response to the size prompt, answer with 'a' to have the partition end at the beginning of disklabel 'a'. | ||
+ | |||
+ | Proceed with the installer. | ||
− | |||
IMPORTANT: Change disklabel such that xbd0a starts after the end of the ext2 | IMPORTANT: Change disklabel such that xbd0a starts after the end of the ext2 |
Revision as of 19:41, 9 June 2010
Contents
c33ris2's gentle guide to installing NetBSD in a prgmr DomU (January 2009)
Note: By June 2010 (or earlier) some of the dom0 hosts have packed the installer files into the /distros collection available to many recovery images. In these cases, the fetching activity is no longer required.
Getting Started
Installing NetBSD as DomU is easy, but not trivial.
Boot your preconfigured system, in order to discover, and note for later use, YOUR_IP, NETMASK, GATEWAY, and NAMESERVER as follows:
Run 'ifconfig eth0' and note your "inet addr" and "Mask" values. Run 'route' or 'ip route' and note the IP of the default gateway. Run 'cat /etc/resolv.conf' and note the IP of the nameserver
From the control menu on your dom0 host, destroy/shutdown the instance, and restart ("create/start") it, selecting the "rescue" option from the bootloader. Login as 'root'.
Your fixed disk, as known to the linux rescue image, is /dev/xvda. Later, when booted to the NetBSD installer, it is identified as /dev/xbd0.
For NetBSD, this disk must be partitioned, and the NetBSD installer files placed therein.
fdisk /dev/xvda
From within fdisk,
- delete the existing partition, *which will destroy your current OS image and dataa*
- create a new primary partition #1, with first cylinder at default=1 and last cylinder at +32M
- write the new parition table to the disk.
- exit fdisk
Success to this point is evidenced by the prseence of /dev/xvda1 which must now be formatted, mounted, and a /boot directory created:
mkfs.ext2 /dev/xvda1 mount -n /dev/xvda1 /mnt mkdir /mnt/boot
If the file 'netbsd64.tar.gz' exists in /distros, skip over to #Unpacking the Installer
Otherwise you'll have to proceed here with
Fetching the Installer
Setup IP with
ifconfig eth0 up 64.62.205.XXX/26 route add -net 0.0.0.0 gw 64.62.205.193 eth0
wget and extract to /mnt/boot/ :
ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-5.0/amd64/binary/kernel/netbsd-INSTALL_XEN3_DOMU.gz ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-5.0/amd64/binary/kernel/netbsd-XEN3_DOMU.gz
(or newer)
Create a file boot/grub/menu.lst with this content:
timeout 5 title NetBSD run root (hd0,0) kernel /boot/netbsd-XEN3_DOMU title NetBSD install root (hd0,0) kernel /boot/netbsd-INSTALL_XEN3_DOMU
Skip to #Booting the Installer
Unpacking the Installer
This section presumes the presence, in the rescue instance, of /distros/netbsd64.tar.gz
Unpack this into the new boot menu, and shutdown.
tar zxf /distros/netbsd64.tar.gz -C /mnt/boot/ shutdown -h now
Booting the Installer
Returning to the control menu on your dom0 host, destroy/shutdown your instance if it is running, and create/start it again, this time selecting first the "user bootloader configuration" from the options presented by the dom0, and after that select the installer from your new user bootloader. This should take you to the NetBSD Installer, for which a tutorial exists at netbsd.org
Install onto xbd0
When presented with the option, choose
b: Use existing partition sizes
The next screen should show the existing BSD-disklabel partitions, as follows for a 6G allocation.
Start MB End MB Size MB FS type Newfs Mount Mount point --------- --------- --------- ---------- ----- ----- ----------- a: 0 0 0 unused b: 0 0 0 unused c: 0 6143 6144 NetBSD partition d: 0 6143 6144 Whole disk e: 0 38 39 Linux Ext2 f: 0 0 0 unused
If you're new to NetBSD partitioning, which I am, which is why I'm writing this, refer to this NetBSD Guide section
The purpose of examining this screen is to note that the Linux Ext2 partition used for the installer occupies the first 39 (numbered 0 thru 38) sectors of the partition. We need to set the NetBSD root after that, starting with sector 39.
Select "x: Partition sizes ok" and "no" to the opportunity to edit the partition table again. The installation will be aborted and you'll be returned to an earlier screen, which is intended by this tutorial. Proceed as before through the next few screens, but this time select
a: Set sizes of NetBSD partitions
which will set up the default root and swap partitions.
Modify if desired, but it's not essential to do so. Chris makes the excellent suggestion to "Add a user defined partition" at /boot so that you can update the kernels and adjust the menu.lst later.
The size here should be as noted earlier of the linux partition, 39MB in this example.
Select "accept these sizes", and you'll get a screen with one more chance, which we'll take, to modify the partitions, by selecting the DiskLabel a and changing the start point from 0 to 39 (MB).
If you added a label for /boot, you'll see it in the table, and it needs to be modified. Set the start to 0, and in response to the size prompt, answer with 'a' to have the partition end at the beginning of disklabel 'a'.
Proceed with the installer.
IMPORTANT: Change disklabel such that xbd0a starts after the end of the ext2
partition. Add a disklabel for the /boot partition, so you can update the
kernels and adjust the menu.lst later. (You can find out its sectors by using
fdisk /dev/xbd0). Here is an example disklabel setup for a 3072M disk
with a 32M boot partition:
We now have your BSD-disklabel partitions as: This is your last chance to change them. Start MB End MB Size MB FS type Newfs Mount Mount point --------- --------- --------- ---------- ----- ----- ----------- a: 31 2912 2882 FFSv1 Yes Yes / b: 2913 3040 128 swap c: 0 3071 3072 NetBSD partition d: 0 3071 3072 Whole disk e: 0 30 31 Linux Ext2 f: 0 0 0 unused g: Show all unused partitions h: Change input units (sectors/cylinders/MB) >x: Partition sizes ok
Install by FTP, setup networking by the noted data. Adjust the FTP paths to the snapshot you use.
Reboot, now with "NetBSD run".
Congratulations!
19:30, 3 February 2009 (UTC)