//burnz.blog

Entries tagged as ‘Howto’

How to setup headless Sun xVM VirtualBox on Ubuntu server

September 4, 2008 · 12 Comments

The steps are not too difficult but I did have to find a few places for information. Search on the forum turn up nothing on this subject so hopefully this HOWTO would be helpful to someone out there.

Note: This is not using the OSE version.

Background:
VirtualBox has a very good GUI running on the host to manage guest OS. However when running a server, we typically do not want to run X on it. Fortunately VirtualBox has commandline tools to manage guest systems. It also provides the VirtualBox Remote Desktop Protocol (VRDP) to allow connection to the guest remotely.

Clarification of terms used:
Host – refers to the machine we are trying to install VirtualBox.
Guest – the VirtualBox guest system that is setup on the host.
Remote – the PC that we are working on to connect to the host via SSH.

This setup was done on a fresh install of Ubuntu Server 8.04 with openssh-server installed.

All the following steps are done by SSH into the host from a remote (I’m using Windows for now).

1. Get required packages
Download the Ubuntu package for VirtualBox from http://www.sun.com/software/products/virtualbox/get.jsp

wget “download link here” -O virtualbox_1.6.2-31466_Ubuntu_hardy_i386.deb

We are using the non-OSE version here.

The manual from http://www.virtualbox.org/wiki/Downloads is also very useful.

2. Installation

sudo dpkg -i virtualbox_1.6.2-31466_Ubuntu_hardy_i386.deb

This will generate a bunch of dependencies. Fix them with

sudo apt-get -f upgrade

3. Decide on user, disk files location

First decide which user you want to run VirtualBox. Add this user to the vboxusers group.

sudo usermod -a -G vboxusers vboxuser

By default VirtualBox creates the directory .VirtualBox on the user home directory and put all the config and disk file there. In my setup, I put the disk files in /var/vbox as I had created a large partition for this purpose.

4. Install a guest OS

You will need an iso for the guest OS install CD. Copy or download it to the host. For example we will just use ubuntu-8.04-server-i386.iso

-create a vm

VBoxManage createvm -name ubuntu -register

-config vm

VBoxManage modifyvm ubuntu -memory “256MB” -acpi on -boot1 dvd -nic1 nat

-create a disk

VBoxManage createvdi -filename “/var/vbox/ubuntu.vdi” -size 5000 -register

-add disk to vm

VBoxManage modifyvm ubuntu -hda “/var/vbox/ubuntu.vdi”

-register an install iso

VBoxManage registerimage dvd /var/vbox/ubuntu-8.04-server-i38.iso

-mount iso on vm

VBoxManage modifyvm ubuntu -dvd /var/vbox/ubuntu-8.04-server-i38.iso

-start the vm with port

VBoxHeadless -startvm ubuntu -p 3389 &

If you are running just 1 guest, the -p 3389 is optional. For more than 1 guest, it has to listen to different port.

5. Connect from remote

Since my desktop is still Windows, I use Remote Desktop Connection. (On XP, Start>All Programs>Accessories>Communications)

For Mac, use http://www.microsoft.com/mac/products/remote-desktop/
For Ubuntu, look at http://ubuntuforums.org/showthread.php?t=824710

Just fill in the IP of your host (or IP:port if not the default) and you should see the Ubuntu installation waiting for you.

Other useful commands:

VBoxManage controlvm ubuntu poweroff
VBoxManage controlvm ubuntu reset

Getting Ubuntu Server to run in VirtualBox

After installation and restarting, you may find that the boot up hang with this error

This kernel requires the following features not present on the CPU: 0:6

To fix this, do the following:

  1. Reset the guest
  2. Hit F12 to choose to boot from the CD. (It goes by pretty quickly, reset again if you miss it.)
  3. Select Rescue a broken system
  4. After going through the install screens you will get a command prompt. Select to run it on the root system.
  5. Install the virtual linux-virtual kernel

apt-get install linux-virtual

6. Reboot and this should fix the restart.

Upgrading kernel
If the kernel on the host is upgraded, the VirtualBox kernel module need to be re-compiled. Do the following steps:

  1. apt-get install make gcc linux-headers-2.6.24-19-server (other kernel header, check uname -a)
  2. /etc/init.d/vboxdrv setup

It should recompile the VirtualBox module and everything should be working again.

[ Source: kcnnc from Ubuntu Forum ]

Categories: Linux / Unix · Software · Tutorial · Ubuntu
Tagged: , , ,

SSH: Convert OpenSSH to SSH2 and vise versa

December 14, 2007 · 4 Comments

Connecting two server running different type of SSH can be nightmare if you does not know how to convert the key. In this tutorial, I will try to explain on how to convert the public key from OpenSSH to SSH2 and SSH2 to OpenSSH. To convert the key, it must be done in OpenSSH server.

Convert OpenSSH key to SSH2 key

  • Run the OpenSSH version of ssh-keygen on your OpenSSH public key to convert it into the format needed by SSH2 on the remote machine. This must be done on the system running OpenSSH.
    #ssh-keygen -e -f ~/.ssh/id_dsa.pub > ~/.ssh/id_dsa_ssh2.pub

Convert SSH2 key to OpenSSH key

  • Run the OpenSSH version of ssh-keygen on your ssh2 public key to convert it into the format needed by OpenSSH. This needs to be done on the system running OpenSSH.
    #ssh-keygen -i -f ~/.ssh/id_dsa_1024_a.pub > ~/.ssh/id_dsa_1024_a_openssh.pub

(more…)

Categories: Linux / Unix · Security · Tutorial
Tagged: , , , , , ,