50 xen虚拟化技术基础xen虚拟化技术进阶

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了50 xen虚拟化技术基础xen虚拟化技术进阶相关的知识,希望对你有一定的参考价值。

01 xen虚拟化技术基础


配置环境:

node1 192.168.1.61 CentOS6.6


[[email protected] ~]# uname -r

2.6.32-504.el6.x86_64

[[email protected] ~]# cd /etc/yum.repos.d/

[[email protected] yum.repos.d]# vim xen4.repo

[xen4centos]

name=Xen4 for CentOS 6

baseurl=ftp://192.168.56.2/xen4/x86_64/

gpgcheck=0

[[email protected] ~]# yum install xen

[[email protected] ~]# vim /etc/grub.conf


注:xen没有安装成功


02 xen虚拟化技术基础


注:本节测试没有成功


#创建磁盘映像文件

[[email protected] ~]# mkdir -p /images/xen

[[email protected] ~]# qemu-img create -f raw -o size=2G /images/xen/busybox.img

[[email protected] ~]# qemu-img create -f raw  /images/xen/busybox.img 2G


#对磁盘映像文件格式

[[email protected] ~]# mke2fs -t ext2 busybox.img


挂载磁盘映像

[[email protected] ~]# mount -o loop busybox.img /mnt 


#编译busybox

[[email protected] ~]# yum groupinstall "Development Tools" "Server Platform Development"

[[email protected] ~]# yum -y install ncurses.x86_64

[[email protected] ~]# ls busybox-1.22.1.tar.bz2 

busybox-1.22.1.tar.bz2

[[email protected] ~]# tar xf busybox-1.22.1.tar.bz2 

[[email protected] ~]# cd busybox-1.22.1

[[email protected] busybox-1.22.1]# make menuconfig

[[email protected] busybox-1.22.1]# make

[[email protected] busybox-1.22.1]# make install

[[email protected] busybox-1.22.1]# cp -a install/* /mnt

[[email protected] busybox-1.22.1]# cd /mnt

[[email protected] mnt]# mkdir proc sys dev etc var boot home

[[email protected] mnt]# chroot /mnt /bin/sh

[[email protected] mnt]# cd /boot/

[[email protected] boot]# ln -s vmlinuz-2.6.32-504.el6.x86_64 vmlinuz

[[email protected] boot]# ln -s initramfs-2.6.32-504.el6.x86_64.img initramfs.img

[[email protected] boot]# cd /etc/xen

[[email protected] xen]# cp xlexample.pvlinux busybox

[[email protected] xen]# vim busybox

修改

name = "..."

name = "busybox-001"

修改

#ramdisk = "/boot/initrd.gz"

ramdisk = "/boot/initramfs.img"

修改

extra = "..."

extra = "selinux=0 init=/bin/sh"

修改

memory = 128

memory = 256

修改

disk = [ ‘/dev/vg/guest-volume,raw,xvda,rw‘ ]

disk = [ ‘/images/xen/busybox.img,raw,xvda,rw‘ ]

添加

root = "/dev/xvda ro"

[[email protected] xen]# xl -v create busybox

#打开控制台:

[[email protected] xen]# xl console busybox-001


#设置网络

[[email protected] ~]# cd /etc/sysconfig/network-scripts/

[[email protected] network-scripts]# cp ifcfg-eth0 ifcfg-xenbr0

[[email protected] network-scripts]# vim ifcfg-eth0

删除IP、掩码、网关、DNS 

修改

NM_CONTROLLED=yes

NM_CONTROLLED=no

添加

BRIDGE=xenbr0

[[email protected] network-scripts]# vim ifcfg-xenbr0 

修改

DEVICE=eth0

DEVICE=xenbr0

修改

NM_CONTROLLED=yes

NM_CONTROLLED=no

修改

TYPE=Ethernet

TYPE=Bridge

删除UUID行


[[email protected] network-scripts]#service network restart

[[email protected] network-scripts]#service NetworkManager stop

[[email protected] network-scripts]#chkconfig NetworkManager off

[[email protected] ~]# ifconfig eth0 0

[[email protected] ~]# brctl addbr xenbr0 


03 xen虚拟化技术进阶


结束至17:59(16357)


本文出自 “追梦” 博客,请务必保留此出处http://sihua.blog.51cto.com/377227/1885932

以上是关于50 xen虚拟化技术基础xen虚拟化技术进阶的主要内容,如果未能解决你的问题,请参考以下文章

xen虚拟化技术

整理Xen理论知识

虚拟化技术对照:Xen vs KVM

Xen虚拟化技术简介

虚拟化技术xen的简介和安装

科普:KVM与XEN虚拟化环境究竟有何不同?