...
This guide will help you set up the preconfigured VM referenced at devcloud-kvm. It's much easier to use the preconfigured image but this guide may help you if you wish to use a different development enviroment.
...
{toggle-cloak:id=VM
Definition
XML}
Create the VM XML (click to show):
unmigrated-inline-wiki-markup{toggle-cloak:id=VM
Definition
XML}
unmigrated-inline-wiki-markup{cloak:id=VM
Definition
| Code Block |
XML}
cat
>
devcloud-kvm.xml
<<
EOL
<domain
type='kvm'>
<name>devcloud-kvm</name>
<memory>8388608</memory>
<currentMemory>8388608</currentMemory>
<vcpu>4</vcpu>
<os>
<type
arch='x86_64'
machine='pc-1.0'>hvm</type>
<boot
dev='hd'/>
<bootmenu
enable='yes'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<cpu
match='exact'>
<model>Westmere</model>
<vendor>Intel</vendor>
<feature
policy='require'
name='vmx'/>
</cpu>
<clock
offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/kvm</emulator>
<disk
type='file'
device='disk'>
<driver
name='qemu'
type='qcow2'/>
<source
file='/var/lib/libvirt/images/devcloud-kvm.qcow2'/>
<target
dev='vda'
bus='virtio'/>
<address
type='pci'
domain='0x0000'
bus='0x00'
slot='0x05'
function='0x0'/>
</disk>
<disk <disk type='block'
device='cdrom'>
<driver
name='qemu'
type='raw'/>
<target
dev='hdc'
bus='ide'/>
<readonly/>
<address
type='drive'
controller='0'
bus='1'
unit='0'/>
</disk>
<controller
type='usb'
index='0'>
<address
type='pci'
domain='0x0000'
bus='0x00'
slot='0x01'
function='0x2'/>
</controller>
<controller </controller> <controller type='ide'
index='0'>
<address
type='pci'
domain='0x0000'
bus='0x00'
slot='0x01'
function='0x1'/>
</controller>
<interface
type='network'>
<mac
address='52:54:00:4e:ff:4f'/>
<source
network='default'/>
<model
type='virtio'/>
<address
type='pci'
domain='0x0000'
bus='0x00'
slot='0x03'
function='0x0'/>
</interface>
<interface
type='network'>
<mac
address='52:54:00:52:b1:5e'/>
<source
network='private1'/>
<model
type='virtio'/>
<address
type='pci'
domain='0x0000'
bus='0x00'
slot='0x07'
function='0x0'/>
</interface>
<serial
type='pty'>
<target
port='0'/>
</serial>
<console </serial> <console type='pty'>
<target
type='serial'
port='0'/>
</console>
<input
type='tablet'
bus='usb'/>
<input
type='mouse'
bus='ps2'/>
<graphics
type='vnc'
port='-1'
autoport='yes'/>
<video>
<model
type='cirrus'
vram='9216'
heads='1'/>
<address
type='pci'
domain='0x0000'
bus='0x00'
slot='0x02'
function='0x0'/>
</video>
<memballoon
model='virtio'>
<address
type='pci'
domain='0x0000'
bus='0x00'
slot='0x06'
function='0x0'/>
</memballoon>
</devices>
</domain>
EOL
| Wiki Markup |
|---|
{cloak}
- Define VM with xml as created above
| Code Block |
virsh define devcloud-kvm.xml
- Create hard disk that XML points to:
| Code Block |
qemu-img create -f qcow2 /var/lib/libvirt/images/devcloud-kvm.qcow2 60G
| Wiki Markup |
{toggle-cloak{toggle-cloak:id=NetXML}
Create the network xml(click to show):
unmigrated-inline-wiki-markup{toggle-cloak:id=NetXML}
unmigrated-inline-wiki-markup| Code Block |
{cloak:id=NetXML}
cat
>
devcloud-kvm-net.xml
<<
EOL
<network>
<name>private1</name>
<uuid>f49f9a26-6c7a-ece4-9d4d-d2e295e6fb80</uuid>
<bridge
name='virbr1'
stp='off'
delay='0'
/>
<mac
address='52:54:00:8D:BA:A5'/>
</network>
EOL
| Wiki Markup |
|---|
{cloak}
- Create/edit networks required:
| Code Block |
virsh net-destroy default
virsh net-edit default (change ip address range for dhcp so that we have some to manually assign)
virsh net-start default
virsh net-define devcloud-kvm-net.xml
virsh net-autostart private1
virsh net-start private1
- Start the vm, attach to vnc
| Code Block |
virsh start kvm-cloudstack
virsh vncdisplay kvm-cloudstack
- launch your favorite vnc viewer and connect to the localhost port returned by the previous command
- Attach CentOS installation iso
| Code Block |
virsh attach-disk kvm-cloudstack ~/Downloads/CentOS-6.3-x86_64-minimal.iso hdc --type cdrom
note Once you attach the disk the VM should reboot on its own. But you may need to reboot it manually.
- Install minimal CentOS
| Code Block |
Use 1 partition of 30G for /, and leave another 30G partition blank for a volume group
Configure the guest network
- Set eth0 to use br0 (/etc/sysconfig/network-scripts/ifcfg-eth0)
| Code Block |
BOOTPROTO=none
ONBOOT=yes
BRIDGE=cloudbr0
DEVICE=eth0
- Set eth1 to use br1 (/etc/sysconfig/network-scripts/ifcfg-eth1)
| Code Block |
BOOTPROTOBOOTPROTO=none
ONBOOT=yes
BRIDGE=cloudbr1
DEVICE=eth1
- Set br0 to use IP (/etc/sysconfig/network-scripts/ifcfg-br0)
| Code Block |
DEVICE="cloudbr0"
BOOTPROTO="static"
GATEWAY="172.17.10.1"
IPADDR="172.17.10.10"
NETMASK="255.255.255.0"
ONBOOT="yes"
TYPE="Bridge"
- Set br1 to use IP (/etc/sysconfig/network-scripts/ifcfg-br1)
| Code Block |
DEVICE="cloudbr1"
BOOTPROTO="static"
ONBOOT="yes"
IPADDR="192.168.100.10"
NETMASK="255.255.255.0"
TYPE="Bridge"
- Configure networking
| Code Block |
# Edit /etc/hosts and create an entry for "192.168.100.10 devcloud-kvm" -- we want to treat the internal/management interface as the main IP for this host
set a nameserver in /etc/resolv.conf
disable selinux in /etc/sysconfig/selinux
- reboot then ssh into the server
| Code Block |
(optional) yum update
yum install git java-1.6.0-openjdk-devel java-1.6.0 rpm-build mysql-connector-java mysql mysql-server ant* jsvc ipmitool jakarta-commons-lang jna dnsmasq wget tomcat6 ws-commons-utils gcc glibc-devel MySQL-python mkisofs java-1.7.0-openjdk-devel java-1.7.0-openjdk kvm libvirt libvirtd ebtables vconfig python-paramiko sudo python-setuptools
chkconfig mysqld on
chkconfig dnsmasq on
chkconfig nfs on
chkconfig rpcbind on
mkdir -m 777 -p /nfs/primary
mkdir -m 777 /nfs/secondary
echo '/nfs/primary *(rw,insecure,async,no_root_squash)' > /etc/exports
echo '/nfs/secondary *(rw,insecure,async,no_root_squash)' >> /etc/exports
- Edit /etc/sysconfig/nfs and add the following:
| Code Block |
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892
RQUOTAD_PORT=875
STATD_PORT=662
STATD_OUTGOING_PORT=2020
- Add services to iptables, just after the port 22 rule (/etc/sysconfig/iptables):
| Code Block |
-A INPUT -i eth1 -m state --state NEW -p udp --dport 53 -j ACCEPT
-A INPUT -i eth1 -m state --state NEW -p tcp --dport 53 -j ACCEPT
-A INPUT -i eth1 -m state --state NEW -p udp --dport 111 -j ACCEPT
-A INPUT -i eth1 -m state --state NEW -p tcp --dport 111 -j ACCEPT
-A INPUT -i eth1 -m state --state NEW -p tcp --dport 2049 -j ACCEPT
-A INPUT -i eth1 -m state --state NEW -p tcp --dport 32803 -j ACCEPT
-A INPUT -i eth1 -m state --state NEW -p udp --dport 32769 -j ACCEPT
-A INPUT -i eth1 -m state --state NEW -p tcp --dport 892 -j ACCEPT
-A INPUT -i eth1 -m state --state NEW -p udp --dport 892 -j ACCEPT
-A INPUT -i eth1 -m state --state NEW -p tcp --dport 875 -j ACCEPT
-A INPUT -i eth1 -m state --state NEW -p udp --dport 875 -j ACCEPT
-A INPUT -i eth1 -m state --state NEW -p tcp --dport 662 -j ACCEPT
-A INPUT -i eth1 -m state --state NEW -p udp --dport 662 -j ACCEPT
Install Maven
...
...
Reboot to apply yum updates/start services
Install cloudstack from source
...
...
You should You should be able to log into cloudstack now at http://192.168.100.10:8080/client
Image Removed
Running Main Branch:
...
...
unmigrated-inline-wiki-markup
{toggle-cloak:id=agentscript}
Write the custom startup script to /etc/init.d/cloud-agent (click to show):
unmigrated-inline-wiki-markup{toggle-cloak:id=agentscript}
...
...