Home/IT/VMware/Root Server/OpenBSD  

Strato UNIX Root Server  

← Zurück|Weiter →  

Before installing OpenBSD to the physical disk you should change the partition type of the 3rd primary partition to be compatible with OpenBSD:

debian# sfdisk --change-id /dev/sda 3 A6

The OpenBSD installation CD image is available from one of the OpenBSD mirrors. Create a new virtual machine and power on VMware Server or Workstation. The VM's graphical display is needed for switching to the serial console only.

debian# wget
debian# vmware

This is how I create the OpenBSD virtual machine:

- Create a new virtual machine
- Virtual machine configuration: Custom
- I will install the operating system later
- Guest Operating System: FreeBSD 64-bit
- Name: OpenBSD
- Network Connection: NAT
- Disk: Use a physical disk
- Device: /dev/sda
- Usage: Use entire disk
- Finish

Once finished I edit the config again:

- Edit virtual machine settings
- Floppy > Remove
- CD/DVD > Connection > Use ISO image > /root/cd46.iso
- Add... > Serial Port > Output to socket > /tmp/vmware-socket > This end is the server > The other end is an application > Finish
- Save

You are now ready to install OpenBSD. This is the desired hard disk layout:


After powering on the machine immediately press ESC and select the CD-Rom drive as the boot device. If you miss this you will boot your native Linux a second time virtually and this is certainly not what you want...

>> OpenBSD/amd64 CDBOOT 2.01
boot> set tty com0
switching console to com0

Once the console has switched to the serial port you must open another shell on the Debian host and establish a connection to the named pipe. There are two ways to do that with socat: directly or with minicom. For OpenBSD with it's shell based installer it is sufficient to contact the named pipe directly:

debian# socat unix-connect:/tmp/vmware-socket stdio

Just hit ENTER and the machine will boot into the OpenBSD installation program. Here is my log:

(I)nstall, (U)pgrade or (S)hell? i
Proceed with install? [no] yes
System hostname? (short form, e.g. 'foo') h1671829
Available network interfaces are: em0 vlan0.
Which one do you wish to configure? (or 'done') [em0] 
IPv4 address for em0? (or 'dhcp' or 'none') [dhcp]
Netmask? [] 
IPv6 address for em0? (or 'rtsol' or 'none') [none] 
Available network interfaces are: em0 vlan0.
Which one do you wish to configure? (or 'done') [done] 
Default IPv4 route? (IPv4 address, 'dhcp' or 'none')
add net default: gateway
DNS domain name? (e.g. '') [my.domain]
DNS nameservers? (IP address list or 'none') [none]
Do you want to do any manual network configuration? [no] 

Password for root account? (will not echo) ++++++++
Password for root account? (again) ++++++++

Start sshd(8) by default? [yes] 
Start ntpd(8) by default? [no] 
Do you expect to run the X Window System? [yes] 
Do you want the X Window System to be started by xdm(1)? [no] 

Change the default console to com0? [no] yes
Available speeds are: 9600 19200 38400 57600 115200.
Which one should com0 use? (or 'done') [9600] 57600

Setup a user? (enter a lower-case loginname, or 'no') [no] 
What timezone are you in? ('?' for list) [Africa/Abidjan] Europe/Berlin

Available disks are: sd0.
Which one is the root disk? (or 'done') [sd0] 

Disk: sd0       geometry: 60801/255/63 [976773168 Sectors]
Offset: 0       Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
 0: 83      0   1   1 -    995 254  63 [          63:    16000677 ] Linux files*
 1: 82    996   0   1 -   1244 254  63 [    16000740:     4000185 ] Linux swap  
 2: A6   1245   0   1 -  60799 254  63 [    20000925:   956751075 ] OpenBSD     
 3: 83  60800   0   1 -  60800 254  63 [   976752000:       16065 ] Linux files*
Use (W)hole disk, use the (O)penBSD area, or (E)dit the MBR? [OpenBSD] 
Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a] c
Label editor (enter '?' for help at any prompt)
> p
> d i
> d j
> d k
> a a
offset: [20000925] 
size: [956751075] 512m
Rounding to cylinder: 1060290
FS type: [4.2BSD] 
mount point: [none] /
> a b
offset: [21061215] 
size: [955690785] 1024m
Rounding to cylinder: 2104515
FS type: [swap] 
> a d
offset: [23165730] 
size: [953586270] 1024m
Rounding to cylinder: 2104515
FS type: [4.2BSD] 
mount point: [none] /var
> a e
offset: [25270245] 
size: [951481755] 1024m
Rounding to cylinder: 2104515
FS type: [4.2BSD] 
mount point: [none] /tmp
> a f
offset: [27374760] 
size: [949377240] 1024m
Rounding to cylinder: 2104515
FS type: [4.2BSD] 
mount point: [none] /usr
> a g
offset: [29479275] 
size: [947272725] 4096m
Rounding to cylinder: 8401995
FS type: [4.2BSD] 
mount point: [none] /usr/local
> a h
offset: [37881270] 
size: [938870730] 
FS type: [4.2BSD] 
mount point: [none] /home>
> w
> q
Location of sets? (cd disk ftp http or 'done') [cd] h
HTTP/FTP proxy URL? (e.g. 'http://proxy:8080', or 'none') [none]
Server? (hostname, list#, 'done' or '?') []
Server directory? [pub/OpenBSD/4.6/amd64]
Set name(s)? (or 'abort' or 'done') [done] all
Set name(s)? (or 'abort' or 'done') [done]
Location of sets? (cd disk ftp http or 'done') [done]
# halt

Next step is to reboot into OpenBSD with the physical system. As the hard disk's MBR is under Debian control, I need a boot entry in the GRUB menu:

debian# cat >> /boot/grub/menu.lst << MARK

title OpenBSD 4.6
rootnoverify (hd0,2)
chainloader +1


debian# perl -pi -e 's/^default.*0$/default\t\t2/' /boot/grub/menu.lst
debian# reboot

At reboot GRUB should select OpenBSD automatically.

    GNU GRUB  version 0.97  (639K lower / 3635904K upper memory)

 | Debian GNU/Linux, kernel 2.6.26-2-amd64                                 |  
 | Debian GNU/Linux, kernel 2.6.26-2-amd64 (single-user mode)              |
 | OpenBSD 4.6                                                             |
 |                                                                         |
 |                                                                         |
 |                                                                         |
 |                                                                         |
 |                                                                         |
 |                                                                         |
 |                                                                         |
 |                                                                         |
 |                                                                         |  
    Use the ^ and v keys to select which entry is highlighted.
    Press enter to boot the selected OS, 'e' to edit the
    commands before booting, or 'c' for a command-line.

Now some things have to be tuned for the new hardware and for the changed idendity. All network parameters have to be set to the real ones. One special problem is the name change of the network interface. One other is that the gateway has to be set with a host route:

openbsd# vi /etc/hosts


openbsd# ifconfig -a | grep -B 1 lladd | grep ': ' | cut -f 1 -d ':'

openbsd# vi /etc/hostname.em0

          inet 0xffffffff
          !route add -link \$if: -interface

openbsd# vi /etc/mygate

openbsd# vi /etc/resolv.conf

          lookup file bind

The included http server is enabled

openbsd# echo 'httpd_flags=' >> /etc/rc.conf.local

and the machine is restarted one more time:

openbsd# reboot

After reboot the system should be reachable over the network.

  Weiter →