Solaris 11 虚拟机

网友投稿 883 2022-09-20

Solaris 11 虚拟机

Solaris 11 虚拟机

Solaris 11 主机IP 172.22.139.222

root@solaris:~# ifconfig -a

lo0: flags=2001000849 mtu 8232 index 1

inet 127.0.0.1 netmask ff000000

net0: flags=100001000843 mtu 1500 index 2

inet 172.22.139.222 netmask fffffc00 broadcast 172.22.139.255

ether 0:50:56:b7:2a:cd

lo0: flags=2002000849 mtu 8252 index 1

inet6 ::1/128

net0: flags=120002004841 mtu 1500 index 2

inet6 fe80::250:56ff:feb7:2acd/10

ether 0:50:56:b7:2a:cd

root@solaris:~# zfs create -o mountpoint=/zones rpool/zones

root@solaris:~# zfs list

NAME                               USED  AVAIL  REFER  MOUNTPOINT

lake                               156K   976M    32K  /lake

lake/data                           31K   976M    31K  /lake/data

rpool                             8.76G  8.59G  4.33M  /rpool

rpool/ROOT                        6.08G  8.59G    31K  none

rpool/ROOT/solaris                6.08G  8.59G  5.56G  /

rpool/ROOT/solaris/var             404M  8.59G   238M  /var

rpool/VARSHARE                     109M  8.59G  67.8M  /var/share

rpool/VARSHARE/kvol               27.8M  8.59G    31K  /var/share/kvol

rpool/VARSHARE/kvol/dump_summary  1.22M  8.59G  1.02M  -

rpool/VARSHARE/kvol/ereports      10.2M  8.59G  10.0M  -

rpool/VARSHARE/kvol/kernel_log    16.2M  8.59G  16.0M  -

rpool/VARSHARE/pkg                  99K  8.59G    32K  /var/share/pkg

rpool/VARSHARE/pkg/repositories     49K  8.59G    31K  /var/share/pkg/repositories

rpool/VARSHARE/sstore             13.3M  8.59G  8.17M  /var/share/sstore/repo

rpool/VARSHARE/tmp                  75K  8.59G    50K  /var/tmp

rpool/VARSHARE/zones                49K  8.59G    31K  /system/zones

rpool/dump                        1.50G  8.59G  1.50G  -

rpool/export                      66.7M  8.59G    32K  /export

rpool/export/home                 66.6M  8.59G    35K  /export/home

rpool/export/home/hm              66.5M  8.59G  66.3M  /export/home/hm

rpool/export/home/user1             35K  8.59G    35K  /export/home/user1

rpool/export/home/user2           35.5K  8.59G  35.5K  /export/home/user2

rpool/swap                        1.00G  8.59G  1.00G  -

rpool/zones                         31K  8.59G    31K  /zones

root@solaris:~# dladm create-vnic -l net0 vnic1

root@solaris:~# dladm show-phys

LINK            MEDIA         STATE      SPEED  DUPLEX    DEVICE

net0            Ethernet      up         1000   full      e1000g0

root@solaris:~# dladm show-vnic

LINK            OVER           SPEED  MACADDRESS        MACADDRTYPE IDS

vnic1           net0           1000   2:8:20:73:ef:26   random      VID:0

root@solaris:~# zonecfg -z zone111

Use 'create' to begin configuring a new zone.

zonecfg:zone111> create

create: Using system default template 'SYSdefault'

zonecfg:zone111> set zonepath=/zones/zone111

zonecfg:zone111> add net

zonecfg:zone111:net> set physical=vnic1

zonecfg:zone111:net> end

zonecfg:zone111> exit

root@solaris:~# zoneadm list -cv

ID NAME             STATUS      PATH                         BRAND      IP

0 global           running     /                            solaris    shared

- zone111          configured  /zones/zone111               solaris    excl

root@solaris:~# sysconfig create-profile -o /root/zone1-profile.xml

下面安装时间比较长

root@solaris:~# zoneadm -z zone111 install -c /root/zone1-profile.xml

The following ZFS file system(s) have been created:

rpool/zones/zone111

Progress being logged to /var/log/zones/zoneadm.20210826T141239Z.zone111.install

Image: Preparing at /zones/zone111/root.

Install Log: /system/volatile/install.22384/install_log

AI Manifest: /tmp/manifest.xml.vEFWid

SC Profile: /root/zone1-profile.xml

Zonename: zone111

Installation: Starting ...

Creating IPS image

Startup linked: 1/1 done

Installing packages from:

solaris

origin:  PKGS         FILES    XFER (MB)   SPEED

Completed                            415/415   65388/65388  428.2/428.2  917k/s

PHASE                                          ITEMS

Installing new actions                   89400/89400

Updating package state database                 Done

Updating package cache                           0/0

Updating image state                            Done

Creating fast lookup database                   Done

Updating package cache                           2/2

Installation: Succeeded

done.

Done: Installation completed in 1246.734 seconds.

Next Steps: Boot the zone, then log into the zone console (zlogin -C)

to complete the configuration process.

Log saved in non-global zone as /zones/zone111/root/var/log/zones/zoneadm.20210826T141239Z.zone111.install

root@solaris:~# zoneadm list -cv

ID NAME             STATUS      PATH                         BRAND      IP

0 global           running     /                            solaris    shared

- zone111          installed   /zones/zone111               solaris    excl

root@solaris:~# zoneadm -z zone111 boot

root@solaris:~# zoneadm list -cv

ID NAME             STATUS      PATH                         BRAND      IP

0 global           running     /                            solaris    shared

1 zone111          running     /zones/zone111               solaris    excl

登录虚拟机zone111

root@solaris:~# zlogin -C zone111

[Connected to zone 'zone111' console]

Booting to milestone "all".

Hostname: solaris111

solaris111 console login: user

Password:1nature

Oracle Corporation      SunOS 5.11      11.4    Aug 2018

user@solaris111:~$ ping 172.22.139.222

172.22.139.222 is alive

user@solaris111:~$ ipadm show-addr

ADDROBJ           TYPE     STATE        ADDR

lo0/v4            static   ok           127.0.0.1/8

vnic1/v4          static   ok           172.22.139.238/22

lo0/v6            static   ok           ::1/128

vnic1/v6          addrconf ok           fe80::8:20ff:fe73:ef26/10

user@solaris111:~$ svcs -a | grep apache

disabled       22:43:28 svc:/network/22:43:30 svc:/system/apache-stats-24:default

user@solaris111:~$ sudo svcadm enable apache24

user@solaris111:~$ svcs -a | grep apache

disabled       22:43:30 svc:/system/apache-stats-24:default

online         22:53:55 svc:/network/ cd /var/apache2/2.4/htdocs

user@solaris111:/var/apache2/2.4/htdocs$ sudo vi index.html

It works fine!

从Solaris 11 主机IP 172.22.139.222访问curl works fine!

监控系统资源

user@solaris111:~$ zonestat 5

Collecting data for first interval...

Interval: 1, Duration: 0:00:05

SUMMARY                   Cpus/Online: 1/1   PhysMem: 3071M  VirtMem: 4095M

----------CPU---------- --PhysMem-- --VirtMem-- --PhysNet--

ZONE  USED %PART  STLN %STLN  USED %USED  USED %USED PBYTE %PUSE

[total]  0.13 13.6%  0.00 0.00% 2253M 73.3% 2428M 59.2% 11.1K 0.00%

[system]  0.13 13.1%     -     - 1963M 63.9% 2126M 51.9%     -     -

zone111  0.00 0.45%     -     -  290M 9.44%  301M 7.36%     0 0.00%

从Solaris 11 主机IP 172.22.139.222上查看虚拟机zone111所占空间

root@solaris:~# du -sh /zones/zone111/

1.8G   /zones/zone111

设置开机启动

root@solaris:~#  svcadm enable svc:/system/zones:default

显示zone111信息

root@solaris:~# zonecfg -z zone111 info

zonename: zone111

zonepath: /zones/zone111

brand: solaris

net:

physical: vnic1

anet:

linkname: net0

configure-allowed-address: true

auto-mac-address: 2:8:20:7e:90:21

修改zone111为自启动

root@solaris:~# zonecfg -z zone111

zonecfg:zone111> set autoboot=true

zonecfg:zone111> verify

zonecfg:zone111> commit

zonecfg:zone111> exit

root@solaris:~# zonecfg -z zone111 info | grep autoboot

autoboot: true

重启后查看从Solaris 11 主机IP 172.22.139.222访问curl works fine!

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:C# 基础知识系列- 15 异常处理篇(cctv5体育节目表)
下一篇:socket编程原理
相关文章

 发表评论

暂时没有评论,来抢沙发吧~