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
Iyk@ubuntu:Æ 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:(if your xen kernel is a vmware virtual machine, you can not create a HVM)
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 count=(count of bs)
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="bc"
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的过程的更多相关文章
- linux内核分析作业6:分析Linux内核创建一个新进程的过程
task_struct结构: struct task_struct { volatile long state;进程状态 void *stack; 堆栈 pid_t pid; 进程标识符 u ...
- 第六周分析Linux内核创建一个新进程的过程
潘恒 原创作品转载请注明出处<Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 task_struct结构: ...
- Spring IOC 容器源码分析 - 创建单例 bean 的过程
1. 简介 在上一篇文章中,我比较详细的分析了获取 bean 的方法,也就是getBean(String)的实现逻辑.对于已实例化好的单例 bean,getBean(String) 方法并不会再一次去 ...
- 实验 六:分析linux内核创建一个新进程的过程
实验六:分析Linux内核创建一个新进程的过程 作者:王朝宪 <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029 ...
- 20135202闫佳歆--week6 分析Linux内核创建一个新进程的过程——实验及总结
week 6 实验:分析Linux内核创建一个新进程的过程 1.使用gdb跟踪创建新进程的过程 准备工作: rm menu -rf git clone https://github.com/mengn ...
- 《Linux内核--分析Linux内核创建一个新进程的过程 》 20135311傅冬菁
20135311傅冬菁 分析Linux内核创建一个新进程的过程 一.学习内容 进程控制块——PCB task_struct数据结构 PCB task_struct中包含: 进程状态.进程打开的文件. ...
- 作业六:分析Linux内核创建一个新进程的过程
分析Linux内核创建一个新进程的过程 进程描述符PCB----task_struct数据结构 操作系统:1.进程管理 2.内存管理 3 文件系统 一.新进程如何创建和修改task_struct数据结 ...
- Linux内核分析-分析Linux内核创建一个新进程的过程
作者:江军 ID:fuchen1994 实验题目:分析Linux内核创建一个新进程的过程 阅读理解task_struct数据结构http://codelab.shiyanlou.com/xref/li ...
- Linux内核分析第六周学习笔记——分析Linux内核创建一个新进程的过程
Linux内核分析第六周学习笔记--分析Linux内核创建一个新进程的过程 zl + <Linux内核分析>MOOC课程http://mooc.study.163.com/course/U ...
随机推荐
- Google搜索被屏蔽,如何使用Google搜索
我们在国内使用搜索引擎最多的是Google和Baidu啦,在引擎上找一些我们需要的知识,最近好像www.google.cn已经无法访问了,并且香港的链接www.google.com.hk也无法访问了, ...
- Kubernetes安装部署演示介绍
四.安装k8s 1.安装 使用的是k8s 1.2.4版本. 将kubernetes.tar.gz 上传主机,并解压. tar -xzvf kubernetes.tar.gz cd kubernetes ...
- [转]javascript中基本类型和引用类型的区别分析
基本类型和引用类型 ECMAScript包含两个不同类型的值:基本类型值和引用类型值.基本类型值指的是简单的数据段:引用类型值指由多个值构成的对象.当我们把变量赋值给一个变量时,解析器首先要做的就是确 ...
- 关于app集成支付宝应用内支付的问题总结
pem文件生成,将合作伙伴密钥复制到notepad++中,每45个字符回车,去除空格,头尾加上标题,文件需保存为无BOM的UTF8格式,就OK. 可以每行64个字符,共216个字符. 近来处理了 ...
- PHP echo汉字出现乱码的情况之一
当然首先要理清楚到底是web服务端造成,php造成的,还是数据库造成的. 需要在头文件里UTF-8 <head> <meta http-equiv="Content-Typ ...
- 前端自动化工具 -- gulp https://angularjs.org/
gulp是基于流的前端自动化构建工具. gulp是基于stream流的形式,也就是前一个函数(工厂)制造出结果,提供后者使用. 同样的,也是包括基本用法和各插件的使用. 二.基本用法--插件使用 gu ...
- python学习笔记(四):函数
一.函数是什么? 函数一词来源于数学,但编程中的「函数」概念,与数学中的函数是有很大不同的,编程中的函数在英文中也有很多不同的叫法.在BASIC中叫做subroutine(子过程或子程序),在Pasc ...
- linux之fstab文件详解
/etc/fstab是用来存放文件系统的静态信息的文件.位于/etc/目录下,可以用命令less /etc/fstab 来查看,如果要修改的话,则用命令 vi /etc/fstab 来修改. 当系统启 ...
- 初学Python--列表(List)
1.索引 列表中的元素类型未必统一,如: listExample=[1,2,'a','b'] 元素下标索引以0开始 firstEle=listExample[0] 不能进行越界索引,但可以倒序索引 l ...
- linux进程的问题
#include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <pthread.h& ...