This is before the time of learning 5.8xen virtualizationThe study notes
Although always feltxenBut fast become a zombieVirtualizationThis aspect is undeniable his powerful
especiallyredhat6Cancelledxen,xenGiving a feeling to be eliminated but canceled support for xen in my opinion it would be unwise
Or talkxenThe other pull much hurt the body
First, create a file,I was hard enough because I of course you can also use lvm directly under the root directory created
1 2 3 4 5 |
[root@tea ~]# mkdir /xen [root@tea ~]# dd if=/dev/zero of=/xen/vm1 bs=1M count=20000 20000+0 records in 20000+0 records out 20971520000 bytes (21 GB) copied, 190.778 seconds, 110 MB/s |
20,000 each to create a fast file size is zero 1m of this advance the created file in / xen / m1 in place while the virtual machine that you use to store
Install the virtual machine virtual machine is divided into two parts
1,Configuration file / etc / xen(You can modify memory and other things)
2,Virtual storage media / var / lib / libvirt / images (hvm is not the xen)
Check under your cpu is not support full virtualization the flags in / proc / cpuinfo in there
intel vmx(Cpu virtualization can be used for full virtualization)
amd SVM(Cpu virtualization can be used for full virtualization)
[root@tea ~]# cat /proc/cpuinfo 中
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr lahf_lm hvm的虚拟机(hvm的xen不是这个)
Virtual storage location
1 |
[root@localhost network-scripts]# cat /var/lib/libvirt/images/rhel5u8no1.img |
Here is the name of the virtual machine you create a corresponding configuration of yum
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
[root@tea ~]# vim /etc/yum.repos.d/yum.repo [root@tea ~]# cat /etc/yum.repos.d/yum.repo [rhel-server] name=server baseurl=file:///var/ftp/rhel5/Server enabled=1 gpgcheck=0 以下三个是集群的时候用的不做集群实验可以忽略 [rhel-VT] name=VT baseurl=file:///var/ftp/rhel5/VT enabled=1 gpgcheck=0 [rhel-ClusterStorage] name=ClusterStorage baseurl=file:///var/ftp/rhel5/ClusterStorage enabled=1 gpgcheck=0 [rhel-Cluster] name=Cluster baseurl=file:///var/ftp/rhel5/Cluster enabled=1 gpgcheck=0 [root@tea ~]# yum install kernel-xen |
The installation is complete restart to change the kernel
1 2 3 4 5 6 7 8 9 |
[root@tea ~]# uname -r 2.6.18-308.el5xen 安装以下几个包,虚拟机主系统和虚拟机的管理器,虚拟机可视化操作界面 [root@tea ~]# yum install libvirt-viewer [root@tea ~]# yum install libvirt [root@tea ~]# yum install libvirt-manager [root@tea ~]# service xend start [root@tea ~]# service libvirtd start |
1 installation, file dd 6 Ge 20g before this step has been telling everyone operating a 2, lvm to create a partition 30-50g --->pv—>vg—>lv set up a ftp on your system,The mirror mount cdrom or iso / var / ftp / rhel5u8 paravirtualized command virt-install -r 1024 -n rhel5u8-1 –disk path=/dev/vg/lv -l ftp:Own ip / rhel5u8 –bridge = xenbr0 full virtual command virt-install -r 1024 -n rhel5u8-1 –file /xen/vm1 -l ftp:Own ip / rhel5u8 –bridge=xenbr0 –hvm file installed virt-install -r 1024 -n rhel5u8-1 –file /xen/vm1 –cdrom /root/rhel5.8.iso –bridge=xenbr0 –hvm
1 2 3 4 |
[root@tea ~]# virt-install -r 1024 -n rhel5u8-1 --file /xen/vm1 --cdrom /root/rhel5.8.iso --bridge=xenbr0 --hvm Starting install... Creating domain... | 0 B 00:01 |
-r virtual machine's memory allocation unit mb
-n (/ etc / xen / configuration file of the same name) to the virtual machine settings name
–file –set the virtual machine disk storage medium (file location dd)
-l –Cdrom installation source specified virtual machine –Bridge bridge set up a virtual machine connection
–hvm 全 虚拟
Cloned virtual machine
After creating a virtual machine,You can create other virtual machines with virt-clone clone mode –original has been installed virtual name a few –Name name of new virtual machines –File Location file a new virtual machine
1 2 3 4 5 6 7 8 9 10 |
[root@tea ~]# virt-install -r 1024 -n rhel5u8-1 --file /xen/vm1 --cdrom /root/rhel5.8.iso --bridge=xenbr0 --hvm Starting install.. Creating domain... | 0 B 00:01 Guest installation complete... restarting guest. [root@tea ~]# virt--clone --original rhel5u8-1 --name rhel6u8-2 --file /xen/vm2 bash: virt--clone: command not found [root@tea ~]# virt-clone --original rhel5u8-1 --name rhel6u8-2 --file /xen/vm2 Cloning /xen/vm1 | 20 GB 03:24 Clone 'rhel6u8-2' created successfully |
virsh list to view the virtual machine is running
virt-viewer virtual machine can be connected to the virtual machine name
virt start the virtual machine name to open a virtual machine
virt shutdown the virtual machine name off the virtual machine
Connect virtual machines virt-viewer virtual machine can be connected to the virtual machine name
ssh virtual machine virtual machine name ipvirsh console (console connected)
In fact, here is not finished at the virtual machine network card because the card also set here inside and outside the virtual machine is divided into inner and outer I would like to not have to say, if we chose to do what clusters within a collective way to modify virtual machine network adapter bridging
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
[root@aoteman ~]# brctl show查看虚拟机桥接方式xenbr0为内网桥接virbr0外网的哦 bridge name bridge id STP enabled interfaces virbr0 8000.feffffffffff yes vif0.0 vif10.0 vif6.0 vif7.0 vif8.0 vif9.0 xenbr0 8000.fe2e225c3e35 no tap4 tap3 tap2 tap1 tap0 peth0 [root@aoteman ~]# brctl delif xenbr0 vif16.0 [root@aoteman ~]# brctl addif virbrbr0 vif16.0 |
In the last two steps to solve remember you add delete modify the card number oh brctl delif xenbr0 vif16.0 brctl addif virbrbr0 vif16.0
Original article written by LogStudio:R0uter's Blog » Linux Redhat Xen Virtualization study notes
Reproduced Please keep the source and description link:https://www.logcg.com/archives/220.html