Redhat系统:
[root@blliu xen]# uname -a
Linux blliu 2.6.18-164.el5xen #1 SMP Tue Aug 18 15:59:52 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
使用Applications->System Tools->Virtual Machine Manager通过HTTP,NFS,或FTP的方式来直接安装运行在xen上的openfiler是行不通的,openfiler 2.3没有提供基于xen的安装介质,只有一个Xen domU Filesystem的包,下面演示一下通过此包如何安装一个在xen上运行的openfiler。本篇文章所讲的openfiler是基于目前最新的openfiler 2.3。
# First download the XEN Openfiler appliance tarball
mkdir -p /root/soft
cd /root/soft
wget http://www.rpath.org/rbuilder/downloadImage?fileId=26671
#或者
#到http://www.openfiler.com/community/download/下载openfile 2.3 x86_64 Xen domU Filesystem。
# Create needed LVM VBD-s on XEN dom0 (host) - you might need to substitute VG name if different in your system
# for Openfiler 5GB is enough
# 如果没有使用lvm2创建vg,通过fdisk创建分区是一样的。
# 如果你的磁盘被用光了,没有剩余空间来划分分区,可以模拟一个分区来操作:http://space.itpub.net/?uid-23135684-action-viewspace-itemid-680514
lvcreate -L 5G -n openfiler VolGroup00
# for NAS storage choose disk size appropriate for you - here we use 10GB example
lvcreate -L 10G -n nasdisk VolGroup00
# Create EXT3 filesystem for openfiler appliance root partition
mkfs.ext3 /dev/VolGroup00/openfiler
# And label it - as it is needed for openfiler
e2label /dev/VolGroup00/openfiler root
# Mount root filesystem and unpack openfiler appliance files into it
mount /dev/VolGroup00/openfiler /mnt/
cd /mnt/
tar xzpvf /root/soft/openfiler-2.3-x86_64.tar.gz
# Prepare kernel stuff
mkdir -p /opt/xenboot/openfiler
cp -p /mnt/boot/config-2.6.21.7-3.20.smp.gcc3.4.x86_64.xen.domU /opt/xenboot/openfiler/
cp -p /mnt/boot/initrd-2.6.21.7-3.20.smp.gcc3.4.x86_64.xen.domU.img /opt/xenboot/openfiler/
cp -p /mnt/boot/System.map-2.6.21.7-3.20.smp.gcc3.4.x86_64.xen.domU /opt/xenboot/openfiler/
cp -p /mnt/boot/vmlinuz-2.6.21.7-3.20.smp.gcc3.4.x86_64.xen.domU /opt/xenboot/openfiler/
# un-mount openfiler root filesystem
cd
umount /mnt
# create xen configuration file
# 不熟悉nano也可以使用vi等其他编辑器
# 请注意disk和root中xvda,xvdb表示的是openfiler虚拟机内部的磁盘,xvda表示系统安装的磁盘,在disk和root参数中都是xvda1,表示xvda磁盘的第一个分区,是安装的系统所在的分区。
nano -w /etc/xen/openfiler
--- cut here ---
name = 'openfiler'
memory = '512'
kernel = '/opt/xenboot/openfiler/vmlinuz-2.6.21.7-3.20.smp.gcc3.4.x86_64.xen.domU'
ramdisk = '/opt/xenboot/openfiler/initrd-2.6.21.7-3.20.smp.gcc3.4.x86_64.xen.domU.img'
disk = [ 'phy:/dev/VolGroup00/openfiler,xvda1,w', 'phy:/dev/VolGroup00/nasdisk,xvdb,w' ]
root = "/dev/xvda1 ro"
vfb = [ "type=vnc,vncunused=1,keymap=en-us" ]
vif = [ "mac=00:16:3e:38:75:88,bridge=xenbr0" ]
on_reboot = 'restart'
on_crash = 'restart'
--- cut here ---
# start domU
xm create openfiler
# 运行可能出现以下错误:
# Error: Device 0 (vif) could not be connected. Could not find bridge device xenbr0
# 系统中没有xenbr0,需要修改为其他的bridge设备。可以根据其他xen虚拟机的配置文件(/etc/xen目录下)来查看bridge设备信息。
# 例如:
# vif = [ "mac=00:16:36:2a:37:fd,bridge=xenbr1,script=vif-bridge" ]
# Error: Device 51713 (vbd) could not be connected. Hotplug scripts not working.
# 该错误是由于没有配置vif参数所致,调整配置文件加入vif配置信息。
当正常运行启动后,点击Applications->System Tools->Virtual Machine Manager会看到openfiler被自动加入了图形化的管理界面中。

如果你的虚拟机不能正确的获得IP,你还需要手动配置一下虚拟机的IP地址。选中点击Open,然后进入虚拟机内部,对Openfiler虚拟机的ip进行设置。
编辑/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
BROADCAST=192.168.4.255
HWADDR=00:0f:fe:85:64:6b
IPADDR=192.168.4.111
NETMASK=255.255.255.0
NETWORK=192.168.4.0
ONBOOT=yes
GATEWAY=192.168.4.254
TYPE=Ethernet
# 确保网络配置正确。
# access web console
https://192.168.4.111:446
# 用户名:密码
openfiler:password
访问正常!
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29615408/viewspace-1384924/ ,如需转载,请注明出处,否则将追究法律责任。