Last time we introduced how to create a Windows Image for OpenNebula. Of course Ubuntu is indispensable. The steps for creating a Ubuntu image for OpenNebula are similar to those for creating a Windows Image. The following are the specific steps:
First download the required ubuntu version:
$ Wget http://releases.ubuntu.com/11.10/ubuntu-11.10-server-amd64.iso
Create a 10 GB hard disk in raw format ):
$ Kvm-img create-f raw ubuntu. img 10G
Formatting 'ubuntu. img ', fmt = raw size = 10737418240
Then use the downloaded ubuntu "installation disk" and the created "Hard Disk" to boot the system and use the-vnc parameter to enable vnc access so that you can remotely log on to other machines for installation:
$ Sudo kvm-m 512-cdrom ubuntu-11.10-server-amd64.iso \
-Drive file = ubuntu. img-boot d-nographic-vnc: 0
After logging on to another machine with a vnc client, you can see the Ubuntu installation interface. Follow the on-screen prompts to complete the ubuntu installation. Note that only one partition is allocated /, do not divide the partition into swap areas. In the future, VPSee will introduce how to add swap partitions to the virtual machine:
$ Vncviewer 172.16.39.111: 5900
After the installation is complete, the system will automatically restart. shutdown-h now Vm and then start the just-installed VM image ubuntu by following the command below. img, if a failed to find romfile "pxe-rtf8139.bin" error message appears, you can solve it by installing kvm-pxe:
$ Sudo kvm-m 512-drive file = ubuntu. img-boot c-nographic-vnc: 0
Kvm: pci_add_option_rom: failed to find romfile "pxe-rtl8139.bin"
$ Sudo apt-get install kvm-pxe
Use vnc to log on to the virtual machine image again, upgrade and update the system, and install some necessary tools, such as OpenSSH:
$ Vncviewer 172.16.39.111: 5900
$ Sudo update
$ Sudo upgrade
$ Sudo apt-get install openssh-server
Create and edit the virtual network configuration file, and then create an OpenNebula Virtual Network (see install and configure OpenNebula on CentOS ):
$ Vi small_network.net
NAME = "Small network"
TYPE = FIXED
BRIDGE = br0
LEASES = [IP = "172.16.39.111"]
LEASES = [IP = "172.16.39.112"]
LEASES = [IP = "172.16.39.113"]
$ Onevnet create small_network.net
$ Onevnet list
Id user name type bridge p # LEASES
0 oneadmin Small network Fixed br0 N 0
Create and edit the startup configuration file for the Ubuntu virtual machine. Do not forget to add ARCH = x86_64 (otherwise Ubuntu cannot be started normally), we just installed Ubuntu 64-bit Server (ubuntu-11.10-server-amd64.iso ):
NAME = ubuntu
CPU = 1
MEMORY = 512
OS = [ARCH = x86_64,
BOOT = hd,
ROOT = sda1
]
DISK = [source =/var/lib/one/images/ubuntu. img,
Clone = no,
Target = sda,
Readonly = no]
GRAPHICS = [type = "vnc ",
Listen = "0.0.0.0 ",
Port = "5900"]
NIC = [NETWORK = "Small network"]
Create an Ubuntu Virtual Machine on OpenNebula according to the above configuration. Wait a moment, OpenNebula will automatically schedule according to the current resource situation. During this period, the onevm list Command will be continuously used to view the creation of the current virtual machine, the status starts from pend-> prol-> boot-> runn. runn indicates that the VM has been successfully created and runs properly. Finally, check whether OpenNebula has successfully created a virtual machine named ubuntu:
$ Onevm create ubuntu. one
$ Onevm list
ID USER NAME STAT CPU MEM HOSTNAME TIME
42 oneadmin ubuntu runn 1 512 M node00 01:16:39
Edit recommendations]