利用BrandZ在Solaris上运行Linux应用程序

文章转自http://blogs.sun.com/judychen
Solaris提供了丰富的兼容性,其中之一就是可在其上直接运行Linux应用程序,而无需对Linux应用程序做任何修改,实现这个功能的机制包括BrandZ和Xen 。这两者之间的区别在于Xvm允许在机器上跑整个Linux操作系统,包括kernel;而BrandZ仅允许运行Linux用户态的应用程序,底层跑的仍然是Solaris核心。本文将教你如何一步步地创建出一个运行Linux应用程序的BrandZ。

  1. 以超级用户身份登陆或su

  2. 创建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


  3. 安装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"


  4. 检查安装后zone的状态
    # zoneadm list -iv
      ID NAME             STATUS     PATH                           BRAND    IP   
       0 global           running    /                              native   shared
       - centos           installed  /export/centos_root            lx       shared


  5. 启动安装好的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


  6. Login
    # zlogin centos

    要运行X应用程序的话,用ssh进行X输出重定向
    # ssh -X centos

  7. 和网络配置相关的设置
    • 设置DNS
      $ cat /etc/sysconfig/network
      NETWORKING=yes
      HOSTNAME=centos
      GATEWAY=192.168.0.1
      $ cat /etc/resolv.conf
      nameserver 192.168.0.1


  8. 安装附加软件包
    # yum install libstdc++
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值