xen创建pvm和hvm的过程

these are the basic steps of installing domU with xen-tools in ubuntu13.04 64bit in xen4.3

you can also use virt-manager which has an UI, but there may be some bugs between xen and virt-manager.

install a bridge:

before xen4.1, xen will automatically create xenbr0. in xen4.3, things are different, we need to create xenbr0 by hands.

the steps are for the situation where your computer is using dhcp. for static ip setting, the bridge may be not crrect.

first, install a tool named brctl:

sudo apt-get install bridge-utils

sudo brctl (this will show the help info. then you can see how to use commands like ‘addbr‘ or ‘addif‘)

sudo brctl show (this is to see your current status)

then change file "etc/network/interfaces" to this:

auto lo
iface lo inet loopback
auto xenbr0
iface xenbr0 inet dhcp
   bridge_ports eth0
auto eth0
iface eth0 inet manual

then turn xenbr0 up:

sudo ifup xenbr0

then in ifconfig you should see the status of xenbr0 is "up"

sudo ifconfig xenbr0

ok, reboot to get things work

Install PV domu:

sudo apt-get install xen-tools

sudo xen-create-image --hostname=yourhostname --dist=lucid --dir=/home/zmj/xenfile(change it to your own) --mirror=http://cn.archive.ubuntu.com/ubuntu --role=udev --verbose --pygrub --dhcp --passwd

ps:the hostname is the vm’s name

this xen-create-image command will automatically create a *.cfg fill in /etc/xen/ and create "domains/yourhostname/disk.img and swap.img" under your dir (in this example "/home/zmj/xenfile")

if these files, i.e. "domains/yourhostname/disk.img and swap.img" already exist in your dir, then the command will fail. you have three choices: 1.use --force in the command to rewrite the files 2. delete the files by hands 3. change your hostname to something else

the "yourhostname" are suggested to be short, better within 10 chars. there is a case that we cannot get things done until we give a short name to the --hostname.

this command will take a relative long time because it needs to download something via http.

with the *.cfg file you can create VM with ‘xm create‘. of course you can write *.cfg by yourself as long as the settings in your *.cfg file are correct, which would be much more difficult.

by the way, in /etc/xen there are some example.cfg which you can refer to.

you can find your img file at the --dir you specified at the command, i.e. /home/zmj/xenfile. you can mount this img to see what is inside:)

the --passwd option is important. with this, it will ask you for the pasword of your domu at the end of this command‘s running. otherwise, you‘ll not be able to login unless you mount the whole domu img and edit /etc/shadow file. or you can set passwd=1 in /etc/xen-tools/xen-tools.conf, which makes the command always asking a password.

you can use --lvm instead of --dir. more info,  plz refer to http://manpages.ubuntu.com/manpages/precise/man8/xen-create-image.8.html

sudo xl create /etc/xen/yourhostname.cfg (plz teach yourself if dont know how to use xl)

it will throw an error if bridge xenbr0 is missing. or you can modify the .cfg file.

do this command you may see this

[email protected]:Æ sud0 xl create /etc/xen/ubuntu.cfg
xend is runnlng, wh1ch may cause unpredlctable results when us1ng th1s xl command.
Please shut down xend before cont1nu1ng.

At this time,you can do this command:

sudo service xend stop

ps:这里因为现在的命令xl不需要使用xend了,以前的xm是需要用到xend的。

sudo xl list

You shall see your domU after this command.

sudo xl console yourhostname

Use this command to go inside the domU with username=root and password=yourpasswd

Press “Ctrl+]” will get you out of the vm console.

Install HVM domU:

The installation of HVM is much easier than that of a PV.

Put a *.iso file at some directory which is the OS you are going to build, for example win7.iso

Use this command to create an empty *.img file, which will act like the hard disk of your VM.

dd if=/dev/zero of=XXX.img bs=1024k seek=6144 count=0

Write a *.cfg file like this:

kernel = "/usr/local/lib/xen/boot/hvmloader"
builder=‘hvm‘
memory = 2048
vcpus=4
shadow_memory = 64
name = "u8s"
vif = [ ‘mac=00:16:3E:63:34:21, bridge=xenbr0‘ ]
disk = [ ‘file:/home/zmj/img/ubuntu8s.img,hda,w‘, ‘file:/home/zmj/iso/ubuntu8s.iso,hdc:cdrom,r‘ ]
boot="dc"
vnc = 1
sdl = 0
vncconsole=1
xen_platform_pci=0
acpi = 1
apic = 1
device_model = ‘/usr/local/lib/xen/bin/qemu-dm‘ stdvga=0 serial=‘pty‘ usbdevice=‘tablet‘

The *.img path and the *.iso path shall be correct. The kelnel path and the device_model path shall be correct.

Use this command to start the installation

sudo xl create *.cfg

After the installation, change “bc” to “c” in the *.cfg file. “bc” means boot from cd, while “c” means boot from hard disk.

Run this command again and you’ll find the VM running

sudo xl create *.cfg

Use this command to see the vm list

sudo xl list

Use this command to open the VM.

sudo xl vncviewer domu

xen创建pvm和hvm的过程

时间: 2024-10-29 03:57:31

xen创建pvm和hvm的过程的相关文章

第六周分析Linux内核创建一个新进程的过程

潘恒 原创作品转载请注明出处<Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 task_struct结构: struct task_struct {   volatile long state;进程状态  void *stack; 堆栈  pid_t pid; 进程标识符  unsigned int rt_priority;实时优先级  unsigned int policy;调度策略  struct files

XEN创建出VM虚拟机文件物理路径

XEN创建出VM虚拟机文件物理路径. 打开下面这个文件,找到# Directory tree containing VM metadata行. vi /etc/xenopsd.conf 默认路径是 /var/run/nonpersistent/xenopsd 在VM夹里以UUID命名的文件夹.UUID在对应的XEN center里--虚拟机--常规选项卡里可以看到.

实验六———分析Linux内核创建一个新进程的过程

分析Linux内核创建一个新进程的过程 攥写人:李鹏举  学号:20132201 ( *原创作品转载请注明出处*) ( 学习课程:<Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 ) 本周要求: 阅读理解task_struct数据结构http://codelab.shiyanlou.com/xref/linux-3.18.6/include/linux/sched.h#1235: 分析fork函数对应的内核处理过

Linux内核分析-分析Linux内核创建一个新进程的过程

作者:江军 ID:fuchen1994 实验题目:分析Linux内核创建一个新进程的过程 阅读理解task_struct数据结构http://codelab.shiyanlou.com/xref/linux-3.18.6/include/linux/sched.h#1235: 分析fork函数对应的内核处理过程sys_clone,理解创建一个新进程如何创建和修改task_struct数据结构: 使用gdb跟踪分析一个fork系统调用内核处理函数sys_clone ,验证您对Linux系统创建一个

《Linux内核--分析Linux内核创建一个新进程的过程 》 20135311傅冬菁

20135311傅冬菁 分析Linux内核创建一个新进程的过程 一.学习内容 进程控制块——PCB  task_struct数据结构 PCB task_struct中包含: 进程状态.进程打开的文件.进程优先级信息 操作系统管理的三个功能: 1.进程管理 2.内存管理 3.文件系统 Linux进程的状态: 进程状态分析: long state是进程的运行状态,-1是未执行,0是执行中,大于0则是暂停: *stack 是建立一个内核堆栈: flags 是定义了每个进程的标识符: list_head

XEN创建内网(VLAN)

步骤: 1.创建一个Network 2.创建VLAN 创建VLAN的时候内部包含几个工作 2.1.创建一个Vlan对象(图中的①) 2.2.创建一个PIF(图中的②)连接之前新建的VLAN和新建的Network 2.3.Vlan(图中的①)和PIF(图中的③)连接起来 code: Network.Record networkRecord = new Network.Record(); networkRecord.nameLabel = "for_vlan_test_1"; networ

创建一个Material Design应用过程

创建一个使用Material主题的应用 1.这里需要先搭建一个应用的运行环境 创建一个AVD: 然后运行这个AVD. 2.创建应用 其中的Min SDK和Target SDK 都选择了L Preivew版本. 3.修改AndroidManifest.xml文件 修改uses-sdk 修改应用theme: AppMaterialTheme是在res/values/styles.xml文件 配置好以上的文件之后就可以开发了.可以创建一个layout和一个activiy,创建方式和 之前的版本一样.然

分析Linux内核创建一个新进程的过程【转】

转自:http://www.cnblogs.com/MarkWoo/p/4420588.html 前言说明 本篇为网易云课堂Linux内核分析课程的第六周作业,本次作业我们将具体来分析fork系统调用,来分析Linux内核创建新进程的过程 关键词:fork, 系统调用,进程 *运行环境:** Ubuntu 14.04 LTS x64 gcc 4.9.2 gdb 7.8 vim 7.4 with vundle 分析 分析方法说明 PCB包含了一个进程的重要运行信息,所以我们将围绕在创建一个新进程时

分析Linux内核创建一个新进程的过程

一.原理分析 1.进程的描述 进程控制块PCB——task_struct,为了管理进程,内核必须对每个进程进行清晰的描述,进程描述符提供了内核所需了解的进程信息. struct task_struct{ volatile long state; //进程状态,-1表示不可执行,0表示可执行,大于1表示停止 void *stack; //内核堆栈 atomic_t usage; unsigned int flags; //进程标识符 unsigned int ptrace; …… } 2.进程的创