在Fedora 20 Domain-0上创建Fedora 20 Domain-U

In this post, creating a file-backed virtual block device (VBD) and installing Fedora 20 in the Xen DomU via internet will be introduced. This domain is created on a Fedora 20 Dom0 as introduced in Installing Xen on Fedora 20 as Domain-0. For better performance, you may consider using LVM backed VM.

在本文中,将介绍创建文件支持的虚拟块设备(VBD)并通过Internet在Xen DomU中安装Fedora 20。 该域是在Fedora 20 Dom0上创建的,如在Fedora 20上将Xen安装为Domain-0所介绍的那样 。 为了获得更好的性能,您可以考虑使用LVM支持的VM。

创建文件支持的VBD (Create file-backed VBD)

The actual space of VBD will be the amount of disk the virtual machine used. And it will be convenient if the virtual machine will be duplicated since the work is just copying the VBD file and changing some configurations.

VBD的实际空间将是虚拟机使用的磁盘量。 如果要复制虚拟机,将很方便,因为工作只是复制VBD文件并更改某些配置。

Assume that we are working in /home/xen/f20install/

假设我们正在/ home / xen / f20install /

Create a 20GB sparse file-backed VBD:

创建一个20GB的稀疏文件支持的VBD:

# dd if=/dev/zero of=./vmdisk0 bs=1k seek=20480k count=1

通过Internet安装Fedora 20 Linux (Install Fedora 20 Linux via Internet)

First download the pxeboot kernel of Fedora 20 for installation via Internet:

首先下载Fedora 20的pxeboot内核以通过Internet安装:

(Note: if the URL expired, try to find it on https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/)

(注意:如果URL过期,请尝试在https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/上找到)

wget http://download.fedoraproject.org/pub/fedora/linux/releases/20/Fedora/x86_64/os/images/pxeboot/vmlinuz
wget http://download.fedoraproject.org/pub/fedora/linux/releases/20/Fedora/x86_64/os/images/pxeboot/initrd.img

Create an installation profile vm.run:

创建安装配置文件vm.run:

name="f20install"
vcpus=2
memory=2048
disk = ['file:/home/xen/f20install/vmdisk0,xvda,w']
vif = [ 'bridge=xenbr0' ]
kernel="/home/xen/f20install/vmlinuz"
ramdisk="/home/xen/f20install/initrd.img"
extra="root=live:http://download.fedoraproject.org/pub/fedora/linux/releases/20/Fedora/x86_64/os/LiveOS/squashfs.img"
on_reboot = 'restart'
on_crash = 'restart'

The virtual machine’s name is “f20install”, memory is 2G, VCPU count is 2, and the disk is the VBD created above.

虚拟机的名称为“ f20install”,内存为2G,VCPU数量为2,磁盘为上面创建的VBD。

Here, DHCP is used for the VM to get IP, DNS and gateway information. If gateway and DNS server should be set according to the network configuration in format like:

在此,DHCP用于VM来获取IP,DNS和网关信息。 如果应根据网络配置设置网关和DNS服务器,格式如下:

extra="root=live:http://.../to/squashfs.img ip=10.8.1.210::10.8.1.1:255.255.0.0:vm210:eth0:none nameserver=8.8.8.8"

The full grammar explanation and supported protocols can be found in Anaconda documents.

完整的语法说明和支持的协议可以在Anaconda文档中找到。

Start this virtual machine and connect to this virtual machine’s console and complete the installation:

启动此虚拟机并连接到该虚拟机的控制台并完成安装:

# xl create -c vm.run

The console can be released by “Ctrl+]”. And it can be reconnected by:

可以通过“ Ctrl +]释放控制台。 可以通过以下方式重新连接:

# xl console f20install

The installation of Fedora 20 will start. You can choose the “Text mode” and configure the installer interactively.

Fedora 20的安装将开始。 您可以选择“文本模式”并以交互方式配置安装程序。

After successful installation of Fedora 20, it will reboot automatically. However, as the VM configuration is using the old one, it will boot from the external kernel and go the the installation interface again. As the installation is already done, you can shut down it by:

成功安装Fedora 20后,它将自动重启。 但是,由于VM配置使用的是旧配置,它将从外部内核启动并再次进入安装界面。 安装完成后,您可以通过以下方式关闭它:

# xl shutdown f20install

This virtual machine can be duplicated to get more VMs: How to Duplicate Xen DomU Virtual Machines.

可以复制此虚拟机以获取更多VM: 如何复制Xen DomU虚拟机

启动DomU (Start DomU)

Assume the VM vmdisk0 is duplicated to /home/xen/vm-10.8.1.210 and we are working in this directory.

假设虚拟机vmdisk0已复制到/home/xen/vm-10.8.1.210,我们正在此目录中工作。

Create a profile vm.run for loading the virtual machine:

创建一个配置文件vm.run以加载虚拟机:

name="10.8.1.210"
vcpus=2
memory=2048
disk = ['file:/home/xen/vm-10.8.1.210/vmdisk0,xvda,w' ]
vif = [ 'bridge=xenbr0' ]
bootloader = "pygrub"
on_reboot = 'restart'
on_crash = 'restart'

Here we use the PyGrub as the bootloader. PyGrub starts Linux DomUs with the kernels that lie in the file system of the DomU instead of the kernels that lie in the file system of the Dom0. That makes the kernel update and management easier.

在这里,我们使用PyGrub作为引导程序。 PyGrub使用位于DomU文件系统中的内核而不是位于Dom0文件系统中的内核来启动Linux DomU。 这使内核的更新和管理更加容易。

Then the DomU can be started using the profile:

然后可以使用配置文件启动DomU:

# xm create vm.run

The console of this DomU can be connected to:

该DomU的控制台可以连接到:

# xm console 10.8.1.210

翻译自: https://www.systutorials.com/creating-fedora-20-domain-u-on-fedora-20-domain-0/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值