VirtualBox和WMware下CentOS6.4安装XEN4.2推荐

下面是VirtualBox-4.3,VMware9.0下安装xen4.2

主机 cpu intel i3,BIOS里面开启虚拟化

virtualbox设置

vmware设置

默认已经开启了cpu的虚拟化

请先关闭selinux SELINUX=disabled

yum install gcc gcc-c++ vim wget lrzsz ntpdate sysstat dstat wget -y

# grep pae /proc/cpuinfo

flags: fpu de tsc msr pae mce cx8 apic sep mca cmov pat clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc rep_good nopl pni ssse3 hypervisor lahf_lm

# egrep ‘vmx|svm’ /proc/cpuinfo #结果为空

yum install centos-release-xen

yum install xen #会安装下列包

device-mapper-1.02.79-8.el6.x86_64device-mapper-libs-1.02.79-8.el6.x86_64yajl-1.0.7-3.el6.x86_64libaio-0.3.107-10.el6.x86_64xen-licenses-4.2.4-33.el6.centos.alt.x86_64xen-libs-4.2.4-33.el6.centos.alt.x86_64glusterfs-libs-3.4.0.57rhs-1.el6_5.x86_64glusterfs-api-3.4.0.57rhs-1.el6_5.x86_64kpartx-0.4.9-72.el6_5.3.x86_64bridge-utils-1.2-10.el6.x86_64SDL-1.2.14-3.el6.x86_64libusb1-1.0.9-0.6.rc1.el6.x86_64usbredir-0.5.1-1.el6.x86_642:qemu-img-0.12.1.2-2.415.el6_5.10.x86_64pciutils-3.1.10-2.el6.x86_64python-lxml-2.2.3-1.1.el6.x86_64kernel-firmware-3.10.43-11.el6.centos.alt.noarchkernel-3.10.43-11.el6.centos.alt.x86_64xen-hypervisor-4.2.4-33.el6.centos.alt.x86_64xen-runtime-4.2.4-33.el6.centos.alt.x86_64xen-4.2.4-33.el6.centos.alt.x86_64kernel-firmware-2.6.32-358.el6.noarchkernel-firmware-3.10.43-11.el6.centos.alt.noarch2:qemu-img-0.12.1.2-2.415.el6_5.10.x86_64glusterfs-libs-3.4.0.57rhs-1.el6_5.x86_64xen-libs-4.2.4-33.el6.centos.alt.x86_64device-mapper-libs-1.02.79-8.el6.x86_64kpartx-0.4.9-72.el6_5.3.x86_64python-lxml-2.2.3-1.1.el6.x86_64xen-licenses-4.2.4-33.el6.centos.alt.x86_64usbredir-0.5.1-1.el6.x86_64xen-hypervisor-4.2.4-33.el6.centos.alt.x86_64pciutils-3.1.10-2.el6.x86_64libaio-0.3.107-10.el6.x86_64xen-4.2.4-33.el6.centos.alt.x86_64device-mapper-1.02.79-8.el6.x86_64libusb1-1.0.9-0.6.rc1.el6.x86_64glusterfs-api-3.4.0.57rhs-1.el6_5.x86_64xen-runtime-4.2.4-33.el6.centos.alt.x86_64SDL-1.2.14-3.el6.x86_64bridge-utils-1.2-10.el6.x86_64yajl-1.0.7-3.el6.x86_64kernel-3.10.43-11.el6.centos.alt.x86_64kernel-firmware-2.6.32-358.el6.noarch

/usr/bin/grub-bootxen.sh

#grep-v^#/boot/grub/grub.confdefault=0timeout=5splashimage=(hd0,0)/grub/splash.xpm.gzhiddenmenutitleCentOS(3.10.43-11.el6.centos.alt.x86_64)root(hd0,0)kernel/xen.gzdom0_mem=1024M,max:1024Mloglvl=allguest_loglvl=allmodule/vmlinuz-3.10.43-11.el6.centos.alt.x86_64roroot=UUID=4aba9486-86c5-4cb0-87c9-435e38a9ce86rd_NO_LUKSrd_NO_LVMLANG=en_US.UTF-8rd_NO_MDSYSFONT=latarcyrheb-sun16crashkernel=autoKEYBOARDTYPE=pcKEYTABLE=usrd_NO_DMrhgbquietmodule/initramfs-3.10.43-11.el6.centos.alt.x86_64.imgtitleCentOS(2.6.32-358.el6.x86_64)root(hd0,0)kernel/vmlinuz-2.6.32-358.el6.x86_64roroot=UUID=4aba9486-86c5-4cb0-87c9-435e38a9ce86rd_NO_LUKSrd_NO_LVMLANG=en_US.UTF-8rd_NO_MDSYSFONT=latarcyrheb-sun16crashkernel=autoKEYBOARDTYPE=pcKEYTABLE=usrd_NO_DMrhgbquietinitrd/initramfs-2.6.32-358.el6.x86_64.img

此时vmware重启会一直停留在卡机页面,需要进入虚拟机的安装文件夹,修改CentOS 64-bit.vmx 文件中vcpu.hotadd = “TRUE” 改为vcpu.hotadd = “FALSE”

reboot #安装完成后重启

#ll/boot/xen.gzlrwxrwxrwx1rootroot19Aug1306:42/boot/xen.gz- xen-4.2.4-33.el6.gz#xminfohost:localhost.localdomainrelease:3.10.43-11.el6.centos.alt.x86_64version:#1SMPMonJun1614:22:02UTC2014machine:x86_64nr_cpus:4nr_nodes:1cores_per_socket:4threads_per_core:1cpu_mhz:3353hw_caps:178bfbff:28100800:00000000:00000140:00000201:00000000:00000001:00000000virt_caps:total_memory:2047free_memory:998free_cpus:0xen_major:4xen_minor:2xen_extra:.4-33.el6xen_caps:xen-3.0-x86_64xen-3.0-x86_32pxen_scheduler:creditxen_pagesize:4096platform_params:virt_start=0xffff800000000000xen_changeset:unavailablexen_commandline:dom0_mem=1024M,max:1024Mloglvl=allguest_loglvl=allcc_compiler:gcc(GCC)4.4.720120313(RedHat4.4.7-4)cc_compile_by:mockbuildcc_compile_domain:centos.orgcc_compile_date:MonJun1617:22:14UTC2014xend_config_format:4
#xmlistNameIDMemVCPUsStateTime(s)Domain-0010244r-----113.9
cp/etc/sysconfig/network-scripts/ifcfg-eth0/etc/sysconfig/network-scripts/ifcfg-br0#cat/etc/sysconfig/network-scripts/ifcfg-br0DEVICE=br0TYPE=BridgeONBOOT=yesNM_CONTROLLED=yesBOOTPROTO=noneIPADDR=192.168.22.242PREFIX=24GATEWAY=192.168.22.253DNS1=114.114.114.114DOMAIN=114.114.114.114DEFROUTE=yesIPV4_FAILURE_FATAL=yesIPV6INIT=noNAME="Systembr0"#cat/etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=eth0TYPE=EthernetONBOOT=yesNM_CONTROLLED=yesBOOTPROTO=noneBRIDGE=br0DEFROUTE=yesIPV4_FAILURE_FATAL=yesIPV6INIT=noNAME="Systemeth0"#servicenetworkrestart#brctlshowbridgename bridgeid STPenabled interfacesbr0 8000.0800278072e5 no eth0virbr0 8000.feffffffffff yes vif4.0
#servicexendstart#yuminstalllibvirtpython-virtinstlibvirt-daemon-xenvirt-managervirt-viewer#/etc/init.d/libvirtdstart#或者servicelibvirtdstart#chkconfiglibvirtdon

#yuminstallhttpd#mount-oloop/data/CentOS-6.5-x86_64-minimal.iso/mnt/#mkdir-p/var/www/html/centos#cp-r/mnt/var/www/html/centos#vim/var/www/html/centos/mnt/.treeinfo[images-x86_64]initrd=images/pxeboot/initrd.img[images-xen]kernel=isolinux/vmlinuzinitrd=isolinux/initrd.imgvim/etc/httpd/conf/httpd.conf292#DocumentRoot"/var/www/html"293DocumentRoot"/var/www/html/centos/mnt/"317# Directory"/var/www/html" 318 Directory"/var/www/html/centos/mnt/" vim/etc/httpd/conf.d/welcome.conf LocationMatch"^/+$" Options+IndexesErrorDocument403/error/noindex.html /LocationMatch servicehttpdstart

开启iptables的80端口,用virt-install安装guest

virt-install -n vm01 -r 512 –vcpus=2 –disk /data/images/vm01.img,size=10 –nographics -p -l “http://192.168.22.242″ -w bridge:br0 –extra-args=”text console=com1 utf8console=hvc0”

name vm01

内存 512M

cpu 2颗

磁盘文件/data/images/vm01.img

磁盘大小 10G

如果安装的过程中出现下面提示,不往下走了

running install…

running /sbin/loader

detecting hardware…

waiting for hardware to initialize…

那么稍等一会,这个不是错误

#xllistNameIDMemVCPUsStateTime(s)Domain-007264r-----769.9vm0165122-b----39.0
xlconsolevm01#连接vm1

也可以选择交互式安装virt-install –prompt

#virt-install--helpUsage:virt-install--nameNAME--ramRAMSTORAGEINSTALL[options]Options:--versionshowprogram'sversionnumberandexit-h,--helpshowthishelpmessageandexit--connect=URIConnecttohypervisorwithlibvirtURIGeneralOptions:-nNAME,--name=NAMENameoftheguestinstance-rMEMORY,--ram=MEMORYMemorytoallocateforguestinstanceinmegabytes--vcpus=VCPUSNumberofvcpustoconfigureforyourguest.Ex:--vcpus5--vcpus5,maxcpus=10--vcpussockets=2,cores=4,threads=2--cpuset=CPUSETSetwhichphysicalCPUsdomaincanuse.--cpu=CPUCPUmodelandfeatures.Ex:--cpucoreduo,+x2apic--description=DESCRIPTIONHumanreadabledescriptionoftheVMtostoreinthegeneratedXML.--security=SECURITYSetdomainsecuritydriverconfiguration.--numatune=NUMATUNETuneNUMApolicyforthedomainprocess.InstallationMethodOptions:-cCDROM,--cdrom=CDROMCD-ROMinstallationmedia-lLOCATION,--location=LOCATIONInstallationsource(eg,nfs:host:/path,http://host/path,ftp://host/path)--pxeBootfromthenetworkusingthePXEprotocol--importBuildguestaroundanexistingdiskimage--init=INITPathtoinitbinaryforcontainerguest.Ex:--init/path/to/app(tocontainanapplication)--init/sbin/init(forafullOScontainer)--livecdTreattheCD-ROMmediaasaLiveCD-xEXTRA,--extra-args=EXTRAAdditionalargumentstopasstotheinstallkernelbootedfrom--location--initrd-inject=INITRD_INJECTIONSAddgivenfiletorootofinitrdfrom--location--os-type=DISTRO_TYPETheOStypebeinginstalled,e.g.'linux','unix','windows'--os-variant=DISTRO_VARIANTTheOSvariantbeinginstalledguests,e.g.'fedora6','rhel5','solaris10','win2k'--boot=BOOTOPTSOptionallyconfigurepost-installbootorder,menu,permanentkernelboot,etc.StorageConfiguration:--disk=DISKOPTSSpecifystoragewithvariousoptions.Ex.--diskpath=/my/existing/disk--diskpath=/my/new/disk,size=5(ingigabytes)--diskvol=poolname:volname,device=cdrom,bus=scsi,...--nodisksDon'tsetupanydisksfortheguest.--filesystem=FILESYSTEMSPasshostdirectorytotheguest.Ex:--filesystem/my/source/dir,/dir/in/guest--filesystemtemplate_name,/,type=templateNetworkingConfiguration:-wNETWORK,--network=NETWORKConfigureaguestnetworkinterface.Ex:--networkbridge=mybr0--networknetwork=my_libvirt_virtual_net--networknetwork=mynet,model=virtio,mac=00:11...--nonetworksDon'tcreatenetworkinterfacesfortheguest.GraphicsConfiguration:--graphics=GRAPHICSConfigureguestdisplaysettings.Ex:--graphicsvnc--graphicsspice,port=5901,tlsport=5902--graphicsnone--graphicsvnc,password=foobar,port=5910,keymap=ja--noautoconsoleDon'tautomaticallytrytoconnecttotheguestconsoleDeviceOptions:--serial=SERIALSConfigureaguestserialdevice--parallel=PARALLELSConfigureaguestparalleldevice--channel=CHANNELSConfigureaguestcommunicationchannel--console=CONSOLESConfigureatextconsoleconnectionbetweentheguestandhost--host-device=HOSTDEVSConfigurephysicalhostdevicesattachedtotheguest--soundhw=SOUNDHWConfigureguestsounddeviceemulation--watchdog=WATCHDOGConfigureaguestwatchdogdevice--video=VIDEOConfigureguestvideohardware.--smartcard=SMARTCARDConfigureaguestsmartcarddevice.Ex:--smartcardmode=passthroughVirtualizationPlatformOptions:-v,--hvmThisguestshouldbeafullyvirtualizedguest-p,--paravirtThisguestshouldbeaparavirtualizedguest--containerThisguestshouldbeacontainerguest--virt-type=HV_TYPEHypervisornametouse(kvm,qemu,xen,...)--arch=ARCHTheCPUarchitecturetosimulate--machine=MACHINEThemachinetypetoemulate--noapicDisablesAPICforfullyvirtualizedguest(overridesvalueinos-type/os-variantdb)--noacpiDisablesACPIforfullyvirtualizedguest(overridesvalueinos-type/os-variantdb)-uUUID,--uuid=UUIDUUIDfortheguest.MiscellaneousOptions:--autostartHavedomainautostartonhostbootup.--print-xmlPrintthegenerateddomainXMLratherthandefinetheguest.--print-step=XMLSTEPPrintXMLofaspecificinstallstep(1,2,3,all)ratherthandefinetheguest.--norebootDon'tbootguestaftercompletinginstall.--wait=WAITTimetowait(inminutes)--dry-runRunthroughinstallprocess,butdonotcreatedevicesordefinetheguest.--forceForces'yes'foranyapplicableprompts,terminatesforallothers-q,--quietSuppressnon-erroroutput--promptRequestuserinputforambiguoussituationsorrequiredoptions.-d,--debugPrintdebugginginformation

只能昏昏沉沉地沿着青草和泥土的气息前进。

VirtualBox和WMware下CentOS6.4安装XEN4.2推荐

相关文章:

你感兴趣的文章:

标签云: