免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1892 | 回复: 0
打印 上一主题 下一主题

How to install FreeBSD as domU [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-09-19 11:32 |只看该作者 |倒序浏览
原文:
http://www.yuanjue.net/xen/howto.html
在CentOS4.4/Xen3上安装FreeBSD6.1成功,安装过程原文写的很清楚,就不画蛇添足了:).Thanks yuanjue!

NOTE: All these works here are still under testing and may not be suitable for production environment. We only support FreeBSD/i386 for now. As for the dom0 suppport of FreeBSD, we still need some time to get it ready. Stay tuned :-)
How to install FreeBSD as domU
There are several files needed if one wants to install FreeBSD as a domU domain: kernel (
freebsd-XENU_INSTALL
&
freebsd-XENU
), config (
freebsd_xen_INSTALL
) and of course an image file if you install FreeBSD into a file instead of a real hard disk.
1. If you prefer a file backed system, then the first thing should do is to create an image file. It could be done like the following:
dd if=/dev/zero of=freesd_xen_INSTALL.img bs=1024k count=1000
This will create a 1GB blank image file for use. Feel free to change the parameters to match your own needs.
2. Make sure the kernel file and config file are in proper place. Typically, the config file would be placed in /etc/xen/vm, and the kernel's location is specified in that config file.
3. To install FreeBSD as domU, make sure these two lines are used in config file:
kernel = "/Path/To/Kernel/freebsd-XENU_INSTALL"
#kernel = "/Path/To/Kernel/freebsd-XENU"
extra += ",vfs.root.mountfrom=ufs:/dev/md0"
#extra += ",vfs.root.mountfrom=ufs:/dev/md0/xbd769s1a"
4. Now we could start installing. Just create the domain as usual:
xm create -c /Path/To/Config/freebsd_xen_INSTALL
After the domain boots, it will ask you to choose a console to continue the intallation process. "2 ...................... VT100 or compatible terminal." is a good choice here. Then we will be brought to the familiar Sysinstall Menu dialog. The very first thing needs to do here is change the Release Name from 7.0-CURRENT to the RELEASE version that you intend to install, since we port Xen in 7.0-CURRENT and don't offer a RELEASE kernel with Xen support currently. This could be done in the menu entry "Options".
NOTE: The installation will hang when "Extracting base in / directory" if you choose to install 6.1-RELEASE , while 6.0-RELEASE works fine in my machine using a file backed system. So it's up to you whether or not to test 6.1-RELEASE.
5. After choosing a proper FreeBSD release, continue the installation process as you usually do. When it is time to come into FDISK Partition Editor dialog, you would find that the DISK Geometry showing here is 0 cyls/0 heads/0 sectors, which ends up with a 0MB disk for us to use. Make sure to use "G" to set Drive Geometry manually. Just to type something like "1000/1000/1000" is enough, as sysintall will first complain the geometry we typed makes no sense and then offer us some certain disk geometry workable. Then continue.
6. The whole installation made via FTP has been tested and works very well. Other methods for installation via network should also work. Choose your own preferred installation media and let sysinstall finish the left installation.
7. When the installing process is finished, almost everything has been done. DO NOT reboot this domain immediately, we still need to do one more trick. In the Main Installation Menu, go into Configure entry, select "TTYs" item, and press "Yes" to edit /etc/ttys. What should be done here is simple: Add one line and comment all the ttyv lines or turn them off.
The modified ttys file would look like this:
xc0 "/usr/libexec/getty Pc" vt100 on secure
#ttyv0 "/usr/libexec/getty Pc" cons25 on secure
# Virtual terminals
#ttyv1 "/usr/libexec/getty Pc" cons25 on secure
#ttyv2 "/usr/libexec/getty Pc" cons25 on secure
#ttyv3 "/usr/libexec/getty Pc" cons25 on secure
#ttyv4 "/usr/libexec/getty Pc" cons25 on secure
#ttyv5 "/usr/libexec/getty Pc" cons25 on secure
#ttyv6 "/usr/libexec/getty Pc" cons25 on secure
#ttyv7 "/usr/libexec/getty Pc" cons25 on secure
#ttyv8 "/usr/X11R6/bin/xdm -nodaemon" xterm off secure
8. Now the config file for this domain needs to be modified since the whole installaion has been done and we want to boot into this system next. Change it like this:
#kernel = "/Path/To/Kernel/freebsd-XENU_INSTALL"
kernel = "/Path/To/Kernel/freebsd-XENU"
#extra += ",vfs.root.mountfrom=ufs:/dev/md0"
extra += ",vfs.root.mountfrom=ufs:/dev/md0/xbd769s1a"
9. OK. Now you could safely reboot this domain, either using "xm reboot domainID" or sysinstall itself. Or you could shutdown this domain using "xm shutdown domainID" and then restart it. If you choose rebooting, then use "xm list" to figure out domainID for this domain after rebooting (usually it will increase 1 compared with the domainID it has before rebooting). "xm console domainID" will now bring you into the brand new system that you just installed. Enjoy it. :-)
How to use freebsd-XENU kernel to start domU directly
If you prefer to use an existing FreeBSD system rather than installing a new one, here is one way to do this. Files needed are kernel (
freebsd-XENU
) and config (
freebsd_xen
).
I still use file backed system as a example. For real hard disk situation, a few modificaitons will be needed.
1. Create the image for file backed system. Since we want to put a existing system on it rather than installing FreeBSD on it, it is not as simple as creating a blank image while doing the install-domU process. The following is the basic way to do it:

  • Create a file system in the image.
    dd if=/dev/zero of=freesd_xen.img bs=1024k count=1000
    mdconfig -a -t vnode -f freebsd_xen.img -u 0
    bsdlabel -e md0 #edit md0 to add /(md0a) and swap(md0b), at least we need these two for a working system
    newfs md0a
  • mount /dev/md0a and copy data from an existing FreeBSD system to it. Dump & Restore are good tools for this job.

2. After the image is created, apply some tricks to get it work under Xen.

  • Edit /etc/fstab like this:
    # Device             Mountpoint  FStype  Options  Dump  Pass#
       /dev/xbd769b  none  swap  sw  0  0
       /dev/xbd769a  /  ufs  rw  1  1
    This is because Xen doesn't know anything about ad0, ad0s1 or somthing like that, we should please it using the way that Linux use.
  • Edit /etc/ttys. Add one line and comment all the ttyv lines or turn them off.
    xc0 "/usr/libexec/getty Pc" vt100 on secure
    #ttyv0 "/usr/libexec/getty Pc" cons25 on secure
    ...
    xc0 is the console name for FreeBSD that Xen would recognizes.
  • Edit /etc/rc.conf. Change the NIC name to xn0 like below:
    ifconfig_xn0="inet 192.168.1.103 netmask 255.255.255.0"
    xn0 is the NIC name for FreeBSD that Xen would recognizes.



本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/19641/showart_173398.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP