文章转自http://blogs.sun.com/judychen
Solaris提供了丰富的兼容性,其中之一就是可在其上直接运行Linux应用程序,而无需对Linux应用程序做任何修改,实现这个功能的机制包括BrandZ和Xen 。这两者之间的区别在于Xvm允许在机器上跑整个Linux操作系统,包括kernel;而BrandZ仅允许运行Linux用户态的应用程序,底层跑的仍然是Solaris核心。本文将教你如何一步步地创建出一个运行Linux应用程序的BrandZ。
Solaris提供了丰富的兼容性,其中之一就是可在其上直接运行Linux应用程序,而无需对Linux应用程序做任何修改,实现这个功能的机制包括BrandZ和Xen 。这两者之间的区别在于Xvm允许在机器上跑整个Linux操作系统,包括kernel;而BrandZ仅允许运行Linux用户态的应用程序,底层跑的仍然是Solaris核心。本文将教你如何一步步地创建出一个运行Linux应用程序的BrandZ。
- 以超级用户身份登陆或su
- 创建zone
# zonecfg -z centos
centos: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:centos> create -t SUNWlx
zonecfg:centos> set zonepath=/export/centos_root
zonecfg:centos> add net
zonecfg:centos:net> set address=192.168.0.2/24
zonecfg:centos:net> set physical=e1000g0
zonecfg:centos:net> end
zonecfg:centos> commit
zonecfg:centos> exit
- 安装lx zone
- 从Opensolaris网站上下载CentOS Linux。
- 以下载的tar包为源安装CentOS
# zoneadm -z centos install -d /export/centos_fs_image.tar
A ZFS file system has been created for this zone.
Installing zone 'centos' at root directory '/export/centos_root'
from archive '/export/centos_fs_image.tar'
This process may take several minutes.
Setting up the initial lx brand environment.
System configuration modifications complete.
Setting up the initial lx brand environment.
System configuration modifications complete.
Installation of zone 'centos' completed successfully.
Details saved to log file:
"/export/centos_root/root/var/log/centos.install.9025.log"
- 从Opensolaris网站上下载CentOS Linux。
- 检查安装后zone的状态
# zoneadm list -iv
ID NAME STATUS PATH BRAND IP
0 global running / native shared
- centos installed /export/centos_root lx shared
- 启动安装好的zone
# zoneadm -z centos boot
chichi# zoneadm list -iv
ID NAME STATUS PATH BRAND IP
0 global running / native shared
9 centos running /export/centos_root lx shared
- Login
# zlogin centos
要运行X应用程序的话,用ssh进行X输出重定向
# ssh -X centos
- 和网络配置相关的设置
- 设置DNS
$ cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=centos
GATEWAY=192.168.0.1
$ cat /etc/resolv.conf
nameserver 192.168.0.1
- 设置DNS
- 安装附加软件包
# yum install libstdc++