-
mount suse iso to a temp directory
mount -o loop SLES-11-SP1-DVD-x86_64-GM-DVD1.iso /mnt/temp
- create autoyast file
<?xml version="1.0"?> <!DOCTYPE profile SYSTEM "/usr/share/autoinstall/dtd/profile.dtd"> <profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns"> <software> <patterns config:type="list"> <pattern>WBEM</pattern> <pattern>apparmor</pattern> <pattern>base</pattern> <pattern>documentation</pattern> <pattern>gnome</pattern> <pattern>Minimal</pattern> <pattern>x11</pattern> </patterns> <remove-packages config:type="list"/> <remove-patterns config:type="list"/> </software> <host> <hosts config:type="list"> <hosts_entry> <host_address>127.0.0.1</host_address> <names config:type="list"> <name>localhost</name> </names> </hosts_entry> <hosts_entry> <host_address>192.168.1.50</host_address> <names config:type="list"> <name>robinsuse.ibm.com robinsuse</name> </names> </hosts_entry> <hosts_entry> <host_address>::1</host_address> <names config:type="list"> <name>localhost ipv6-localhost ipv6-loopback</name> </names> </hosts_entry> <hosts_entry> <host_address>fe00::0</host_address> <names config:type="list"> <name>ipv6-localnet</name> </names> </hosts_entry> <hosts_entry> <host_address>ff00::0</host_address> <names config:type="list"> <name>ipv6-mcastprefix</name> </names> </hosts_entry> <hosts_entry> <host_address>ff02::1</host_address> <names config:type="list"> <name>ipv6-allnodes</name> </names> </hosts_entry> <hosts_entry> <host_address>ff02::2</host_address> <names config:type="list"> <name>ipv6-allrouters</name> </names> </hosts_entry> <hosts_entry> <host_address>ff02::3</host_address> <names config:type="list"> <name>ipv6-allhosts</name> </names> </hosts_entry> </hosts> </host> <networking> <dhcp_options> <dhclient_hostname_option>AUTO</dhclient_hostname_option> </dhcp_options> <dns> <dhcp_hostname config:type="boolean">false</dhcp_hostname> <domain>ibm.com</domain> <hostname>robinsuse</hostname> <nameservers config:type="list"> <nameserver>211.161.46.84</nameserver> <nameserver>211.161.46.85</nameserver> </nameservers> <resolv_conf_policy>auto</resolv_conf_policy> <searchlist config:type="list"> <search>ibm.com</search> </searchlist> <write_hostname config:type="boolean">false</write_hostname> </dns> <interfaces config:type="list"> <interface> <bootproto>static</bootproto> <device>eth0</device> <ipaddr>192.168.1.50</ipaddr> <name>Ethernet Card 0</name> <netmask>255.255.255.0</netmask> <prefixlen>24</prefixlen> <startmode>auto</startmode> <usercontrol>no</usercontrol> </interface> </interfaces> <managed config:type="boolean">false</managed> <routing> <ip_forward config:type="boolean">false</ip_forward> <routes config:type="list"> <route> <destination>default</destination> <device>-</device> <gateway>192.168.1.1</gateway> <netmask>-</netmask> </route> </routes> </routing> </networking> <general> <mode> <confirm config:type="boolean">false</confirm> </mode> </general> <users config:type="list"> <user> <encrypted config:type="boolean">false</encrypted> <user_password>111111</user_password> <username>root</username> </user> </users> <partitioning config:type="list"> <drive> <use>all</use> </drive> </partitioning> <x11> <color_depth>16</color_depth> <configure_x11 config:type="boolean">true</configure_x11> <display_manager>gnome</display_manager> <enable_3d config:type="boolean">false</enable_3d> <!-- <monitor> <display> <frequency config:type="integer">60</frequency> <max_hsync config:type="integer">97</max_hsync> <max_vsync config:type="integer">180</max_vsync> <min_hsync config:type="integer">30</min_hsync> <min_vsync config:type="integer">50</min_vsync> <width config:type="integer">1024</width> </display> <monitor_device>G90F</monitor_device> <monitor_vendor>VIEWSONIC</monitor_vendor> </monitor> --> <resolution>1600x1200,1280x1024,1024x768,800x600,640x480</resolution> <window_manager>gdm</window_manager> </x11> </profile> |
3.create domain
virt-install -n testsuse -r 1024 --vcpus=1 --disk path=/var/lib/libvirt/images/testsuse.img,size=8 -l /mnt/temp --initrd-inject=/home/gongys/ks.cfg --extra-args "autoyast=file:///ks.cfg" --connect=qemu:///system --vnc -v --network bridge=br0 --disk path=/home/gongys/SLES-11-SP1-DVD-x86_64-GM-DVD1.iso,device=cdrom |