使用uec搭建起eucalyptus的云以后,一个要解决的问题是如何在vm里面安装软件。如果直接登录安装肯定是不行的,因为vm关闭以后就不存在了。
安装的方法主要参考如下的内容:
http://open.eucalyptus.com/participate/wiki/install-tomcat-image
http://open.eucalyptus.com/participate/wiki/modifying-prepackaged-image
mkdir temp-mnt
associate a loop block device to the image ( I assume here that /dev/loop5 is free)losetup /dev/loop5 root.img
and finally mount itmount /dev/loop5 temp-mnt
it is probably a good idea to make procfs, dev and sysfs available in your chrooted environment (this will allow a greater set of tools to work correctly). To do so:
mount -o bind /proc temp-mnt/proc (这一步是必须的,否则安装java会失败)
mount -o bind /sys temp-mnt/sys
mount -o bind /dev temp-mnt/dev
You now have the image under temp-mnt and you can copy over what you want into it. Pay attention to not overfill the image (you can check with df). If you want to install packages into it, you have few options:
- chroot temp-mnt and use apt-get or yum or zypper to install what you want
- you can instruct the package manager program to use a different root (for example both dpkg and rpm uses the --root option)
如果新的系统locale设置有问题,运行apt-get等命令会报错,请参考另一篇文章。
Once your are done modifying the image, you should
must first use 'umount -n temp-mnt/proc' umount /dev/loop5 (如果umount失败,请参阅另一篇文章)
losetup -d /dev/loop5