XEN 只安装了部分,后来夭折了,kvm安装成功!
[iyunv@localhost ~]# wget http://bits.xensource.com/oss-xen/release/4.1.3/xen-4.1.3.tar.gz
[iyunv@localhost ~]# tar xvf xen-4.1.3.tar.gz
[iyunv@localhost ~]# cd xen-4.1.3
[iyunv@localhost xen-4.1.3]# make xen tools stubdom
Error: zlib check failed
Make sure to have the zlib libs and headers installed.
make[1]: *** [ioemu-dir-find] Error 1
make[1]: Leaving directory `/root/xen-4.1.3/tools'
make: *** [tools/ioemu-dir] Error 2
[iyunv@localhost ~]# yum groupinstall "Development Tools"
[iyunv@localhost ~]# yum install hmaccalc ncurses-devel zlib-devel openssl-devel python-devel
[iyunv@localhost ~]# yum install bridge-utils libtool-ltdl xorg-x11-drv-evdev xorg-x11-drv-fbdev
[iyunv@localhost ~]# yum install xorg-x11-drv-i810-devel xorg-x11-drv-via-devel xorg-x11-proto-devel
[iyunv@localhost ~]# yum install xorg-x11-server-sdk xorg-x11-xtrans-devel libuuid-devel
[iyunv@localhost ~]# yum install readline-devel gcc gcc-gfortran gcc-c++ flex pcre-devel
[iyunv@localhost ~]# yum install blas-devel lapack-devel curl-devel bison gperf gnuplot
[iyunv@localhost ~]# yum install texinfo-tex tetex-dvips
[iyunv@localhost xen-4.1.3]# yum install iasl
[iyunv@localhost xen-4.1.3]# yum install dev86.x86_64
桥接
[iyunv@localhost ~]# yum install libvirt
[iyunv@localhost xen-4.1.3]# make xen tools stubdom
[iyunv@localhost xen-4.1.3]# make install-xen install-tools install-stubdom
[iyunv@localhost xen-4.1.3]# chkconfig --add xend
[iyunv@localhost xen-4.1.3]# chkconfig --add xencommons
[iyunv@localhost xen-4.1.3]# chkconfig --add xendomains
[iyunv@localhost xen-4.1.3]# chkconfig xend on
[iyunv@localhost xen-4.1.3]# chkconfig xendomains on
[iyunv@localhost xen-4.1.3]# chkconfig xencommons on
[iyunv@localhost ~]# tar jxvf linux-3.1.2.tar.bz2
[iyunv@localhost ~]# cd linux-3.1.2
[iyunv@localhost linux-3.1.2]# make menuconfig
Processor type and features --->
] Paravirtualized guest support --->
Device Drivers --->
Xen driver support --->
Xen memory balloon driver
Scrub pages before returning them to system
Xen /dev/xen/evtchn device
Backend driver support (NEW)
Xen filesystem
Create compatibility mount point /proc/xen
Create xen entries under /sys/hypervisor
userspace grant access device driver
[iyunv@localhost linux-3.1.2]# make -j6
[iyunv@localhost linux-3.1.2]# make -j6 modules
[iyunv@localhost linux-3.1.2]# make -j6 modules_install
[iyunv@localhost linux-3.1.2]# make -j6 install
[iyunv@localhost ~]# more /boot/grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,0)
# kernel /boot/vmlinuz-version ro root=/dev/sda1
# initrd /boot/initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (3.1.2)
root (hd0,0)
kernel /boot/xen.gz
module /boot/vmlinuz-3.1.2 ro root=UUID=403a6c34-e2a0-4a57-9e75-83bc0e0453b7 rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us LANG=en
_US.UTF-8 nomodeset crashkernel=auto rhgb quiet rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_NO_LVM rd_NO_DM rhgb quiet
module /boot/initramfs-3.1.2.img
title CentOS (2.6.32-279.el6.x86_64)
root (hd0,0)
kernel /boot/vmlinuz-2.6.32-279.el6.x86_64 ro root=UUID=403a6c34-e2a0-4a57-9e75-83bc0e0453b7 rd_NO_LUKS KEYBOARDTYPE=pc KEY
TABLE=us LANG=en_US.UTF-8 nomodeset crashkernel=auto rhgb quiet rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_NO_LVM rd_NO_
DM rhgb quiet
initrd /boot/initramfs-2.6.32-279.el6.x86_64.img
[iyunv@localhost ~]# xm list
Name ID Mem VCPUs State Time(s)
Domain-0 0 31687 12 r----- 45.2
[iyunv@localhost ~]# xm info
host : localhost.localdomain
release : 3.1.2
version : #1 SMP Thu Jul 17 18:30:44 CST 2014
machine : x86_64
nr_cpus : 12
nr_nodes : 1
cores_per_socket : 6
threads_per_core : 2
cpu_mhz : 2000
hw_caps : bfebfbff:2c100800:00000000:00003f40:13bee3ff:00000000:00000001:00000000
virt_caps : hvm hvm_directio
total_memory : 32722
free_memory : 1088
free_cpus : 0
xen_major : 4
xen_minor : 1
xen_extra : .3
xen_caps : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
xen_scheduler : credit
xen_pagesize : 4096
platform_params : virt_start=0xffff800000000000
xen_changeset : unavailable
xen_commandline :
cc_compiler : gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)
cc_compile_by : root
cc_compile_domain :
cc_compile_date : Thu Jul 17 18:10:12 CST 2014
xend_config_format : 4
[iyunv@localhost ~]# yum install httpd
[iyunv@localhost ~]# service httpd start
[iyunv@localhost ~]# mount -o loop CentOS-6.3-x86_64-bin-DVD1.iso /var/www/html/iso/
[iyunv@localhost ~]# yum install virt-viewer
virt-install --name=node001 --ram=2048 --vcpus=2 --file=/data/xuni1/xuni.img --vnc --os-type=linux --file-size=30 --location=http://192.168.1.219/CentOS-6.3-x86_64-bin-DVD1.iso
grep -E '(vmx|svm)' /proc/cpuinfo
[iyunv@localhost ~]# yum install bridge-utils
[iyunv@localhost ~]# grep -E -o 'vmx|svm' /proc/cpuinfo
vmx
vmx
vmx
vmx
vmx
vmx
vmx
vmx
vmx
vmx
vmx
vmx
KVM安装
[iyunv@localhost ~]# yum install kvm kmod-kvm qemu kvm-qemu-img virt-viewer
[iyunv@localhost ~]# lsmod | grep kvm
kvm_intel 52570 0
kvm 314739 1 kvm_intel
[iyunv@localhost ~]# virsh -c qemu:///system list
error: internal error Unable to locate libvirtd daemon in /usr/sbin (to override, set $LIBVIRTD_PATH to the name of the libvirtd binary)
error: failed to connect to the hypervisor
[iyunv@localhost ~]# yum install libvirt
[iyunv@localhost ~]# virsh -c qemu:///system list
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
error: failed to connect to the hypervisor
[iyunv@localhost ~]# /etc/init.d/libvirtd start
Starting libvirtd daemon: [ OK ]
[iyunv@localhost ~]# virsh -c qemu:///system list
Id Name State
----------------------------------------------------
[iyunv@localhost ~]# chkconfig libvirtd on
安装桥接管理工具
[iyunv@localhost ~]# yum install bridge-utils tunctl
[iyunv@localhost data]# mkdir -p /data/xuni001
[iyunv@localhost data]# cd /data/xuni001/
#[iyunv@localhost ~]# virt-install --connect qemu:///system --name centos6.3 --ram 1024 --vcpus=2 --disk path=/data/xuni001/xuni.img,cache=writeback,size=10 --cdrom=/root/CentOS-6.3-x86_64-bin-DVD1.iso --os-type=linux --accelerate --network bridge=virbr0 --hvm --os-variant=rhel6
命令行中安装虚拟机没有安装成功,后来是在图形界面操作下安装上的,没有截图
virsh -c qemu:///system list
virsh start centos6.3
virsh shutdown centos6.3
virsh autostart centos6.3
[iyunv@localhost ~]# brctl addbr br0
[iyunv@localhost ~]# brctl addif br0 em1
ifconfig br0 192.168.1.220
[iyunv@localhost ~]# yum install virt-manager
开机自启动
[iyunv@localhost ~]# virsh autostart xuni001
strace -p
virsh list 列出当前虚拟机列表,不包括未启动的
virsh list --all 列出所有虚拟机,包括所有已经定义的虚拟机
virsh start domain-name 启动指定虚拟机
virsh shutdown domain-name 停止指定虚拟机
virsh reboot domain-name 重新启动指定虚拟机
virsh autostart domain-name 指定虚拟机开机自动启动
|