kvm/qemu/vmware notes

make qemu image container

qemu-img create -f qcow2 /var/lib/libvirt/images/exos.img 10G

apply parameters to image container

qemu-system-x86_64 -hda /var/lib/libvirt/images/exos.img -boot order=d -cdrom /home/ccie/os/exospc-16.1.2.14.img -enable-kvm -m 1024M   -cpu host

 disable pxe boot edit vmx and add for each e1000 int:

ethernet0.opromsize = “0”

virt-install (replace parameters as needed)

sudo virt-install –connect qemu:///system -n vm10 -r 512

–vcpus=2 –disk path=/var/lib/libvirt/images/vm10.img,size=10 -c /var/lib/libvirt/images/CentOS-5.6-x86_64-bin-DVD.iso –vnc –noautoconsole –os-type linux –accelerate –network=bridge:br0 –hvm

sudo virt-install –connect qemu:///system -n vm10 -r 512 –vcpus=2 –disk path=/var/lib/libvirt/images/vm10.img,size=12 -c /var/lib/libvirt/images/CentOS-5.6-x86_64-bin-DVD.iso –vnc–noautoconsole –os-type linux –accelerate –network=bridge:br0 –hvm

cli vmware tools install
first go to vm-manage and reinstall, select reinstall. a pop up comes into the vm. then mount
 
sudo mkdir /mnt/cdrom
 
sudo mount /dev/cdrom /mnt/cdrom
mount point is /mnt/cdrom  vmtoo.tar.gz should be there
cd /tmp

sudo tar zxpf /mnt/cdrom/VMwareTools-10.0.5-3228253.tar.gz

umount /dev/cdrom

cd vmware-tools-distrib

     sudo ./vmware-install.pl -d -f
to accept the defaults w/o being prompted and to force install because sometimes it hangs
check vmware tools
gns3@gns3vm:~$ ps -aux | grep vmware
gns3      4869  0.0  0.0  10468   796 pts/0    S+   11:14   0:00 grep –color=auto vmware
gns3@gns3vm:~$
gns3@gns3vm:~$ ps -ef | grep vmware-guestd
gns3      4882  4823  0 11:17 pts/0    00:00:00 grep –color=auto vmware-guestd
gns3@gns3vm:~$ gns3@gns3vm:~$ sudo initctl list | grep vmware
vmware-tools start/running
vmware-tools-thinprint stop/waiting
vmware-tools start/running
vmware-tools-thinprint stop/waiting
load gns3 for ubuntu
sudo add-apt-repository ppa:gns3/ppa
sudo apt-get update
sudo apt-get install gns3-gui
update headers after kernel adds
sudo apt-get install build-essential linux-header-$(uname -r)
sudo apt-get update && sudo apt-get install linux generic
uid and groups belonging to
gns3@gns3vm:~$ id gns3
uid=1000(gns3) gid=1000(gns3) groups=1000(gns3),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),109(lpadmin),110(sambashare),111(vde2-net),999(docker),105(libvirtd)
ccie@ccie-virtual-machine:~$ id
uid=1000(ccie) gid=1000(ccie) groups=1000(ccie),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),108(lpadmin),118(sambashare),120(libvirtd)
ccie@ccie-virtual-machine:~
uuid generation for kvm
sudo apt-get install uuid
ccie@ccie-virtual-machine:~$ uuid
d4e25b56-0257-11e6-bd66-000c2954b8a3
create a bridge for kvm
 sudo brctl addbr br0
configure the bridge in /etc/network/interfaces
this will cause br0 to assume eth0’s address
auto br0
iface br0 inet dhcp
bridge_ports eth0
bridge_stp off
bridge_fd 0
        bridge_maxwait
sudo /etc/init.d/networking restart, or reboot
make an empty  image file
sudo qemu-img create -f qcow2 /home/ccie/images/ubu-client.img 10G
Now you are ready to start a VM using the domain XML file you created earlier. The following command will create a VM, and automatically start it.
$ sudo virsh create ubu-client.xml
from img create
ccie@ccie-virtual-machine:~$ sudo qemu-img create -f qcow2 /home/ccie/images/ubu-client.img 10G
Formatting ‘/home/ccie/images/ubu-client.img’, fmt=qcow2 size=10737418240 encryption=off cluster_size=65536 lazy_refcounts=off
on ubu for ubu image:
ccie@ubuntu:~$ virsh dumpxml 4f20ae6b-d3e7-6506-5eb1-ebd1efcbf0ea
<domain type=’kvm’>
  <name>ubu-client</name>
  <uuid>d4e25b56-0257-11e6-bd66-000c2954b8a</uuid>
  <memory unit=’KiB’>10737418240</memory>
  <currentMemory unit=’KiB’>10737418240</currentMemory>
  <vcpu placement=’static’>1</vcpu>
  <os>
    <type arch=’x86_64′ machine=’pc-i440fx-trusty’>hvm</type>
    <boot dev=’hd’/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset=’utc’/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type=’file’ device=’disk’>
      <driver name=’qemu’ type=’raw’/>
      <source file=’/home/ccie/images/ubu-client.img’/>
      <target dev=’vda’ bus=’virtio’/>
      <address type=’pci’ domain=’0x0000′ bus=’0x00′ slot=’0x05′ function=’0x0’/>
    </disk>
    <disk type=’file’ device=’cdrom’>
       <driver name="qemu" type="raw"/>
      <source file="/home/ccie/Desktop/ios/lubuntu-14.04-desktop-amd64.iso"/>
      <target dev=’hdc’ bus=’ide’/>
      <readonly/>
      <address type=’drive’ controller=’0′ bus=’1′ target=’0′ unit=’0’/>
    </disk>
  <interface type='bridge'>
      <source bridge='br0'/>
      <mac address="00:0c:29:54:b8:a3"/>
    <controller type=’usb’ index=’0′>
    <address type=’pci’ domain=’0x0000′ bus=’0x00′ slot=’0x01′ function=’0x2’/>
    </controller>
    <controller type=’pci’ index=’0′ model=’pci-root’/>
    <controller type=’ide’ index=’0′>
      <address type=’pci’ domain=’0x0000′ bus=’0x00′ slot=’0x01′ function=’0x1’/>
    </controller>
       </interface>
    <serial type=’pty’>
      <target port=’0’/>
    </serial>
    <console type=’pty’>
      <target type=’serial’ port=’0’/>
    </console>
    <input type=’mouse’ bus=’ps2’/>
    <input type=’keyboard’ bus=’ps2’/>
    <graphics type=’vnc’ port=’-1′ autoport=’yes’ listen='0.0.0.0'/>
    <sound model=’ich6′>
      <address type=’pci’ domain=’0x0000′ bus=’0x00′ slot=’0x04′ function=’0x0’/>
    </sound>
    <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>
virt-install
virt-install –name ubu-client –ram 1024 –vcpus=1 \
–disk path=/home/ccie/images/ubu-client.img,size=10 \
--network bridge=br0 \
–cdrom /home/ccie/Desktop/ios/lubuntu-14.04-desktop-amd64.iso \
--graphics vnc --noautoconsole --hvm \
output:
root@ccie-virtual-machine:/home/ccie/images# sudo virt-install –name ubu-client –ram 1024 –vcpus=1 \
> –disk path=/home/ccie/images/ubu-client.img,size=10 \
> –network bridge=br0 \
> –cdrom /home/ccie/Desktop/ios/lubuntu-14.04-desktop-amd64.iso \
> –graphics vnc –noautoconsole –hvm \
> –connect qemu:///system
Starting install…
Creating domain…                                       |    0 B     00:00
Domain installation still in progress. You can reconnect to
the console to complete the installation process.
root@ccie-virtual-machine:/home/ccie/images# sudo virt-install –name ubu-client –ram 1024 –vcpus=1 \
> –disk path=/home/ccie/images/ubu-client.img,size=10 \
> –network bridge=br0 \
> –cdrom /home/ccie/Desktop/ios/lubuntu-14.04-desktop-amd64.iso \
> –graphics vnc –noautoconsole –hvm \
> –connect qemu:///system
Starting install…
Creating domain…                                       |    0 B     00:00
Domain installation still in progress. You can reconnect to
the console to complete the installation process.
virt-install --name vmname --ram 1024 --vcpus=1 \
--disk path=/var/lib/libvirt/images/vmname.img,size=10 \
--network bridge=br0 \
--cdrom /var/lib/libvirt/images/os-install.iso \
--graphics vnc --noautoconsole --hvm \
–os-variant win2k3