Solaris 11的自動化安裝(AI server)的搭建
先講講我的運行環境:SunOS test13 5.11 11.1 i86pc i386 i86pc, 運行在虛擬機ESX server上面
一:首先搭建dhcp server
1. root@test13:/repo/repoea# pkg list | grep dhcp
network/dhcp/dhcpmgr 0.5.11-0.175.1.0.0.24.2 i--
network/dhcp/dhcpmgr/locale 0.5.11-0.175.1.0.0.23.1134 i--
service/network/dhcp 0.5.11-0.175.1.0.0.24.2 i--
service/network/dhcp/datastore/binfiles 0.5.11-0.175.1.0.0.24.2 i--
service/network/dhcp/isc-dhcp 4.1.0.6-0.175.1.0.0.24.0 i--
2.安裝dhcp包, pkg install network/dhcp/dhcpmgr network/dhcp/dhcpmgr/locale service/network/dhcp service/network/dhcp/datastore/binfiles service/network/dhcp/isc-dhcp
3.配置dhcp
dhcpconfig -D -r SUNWfiles -p /var/dhcp
dhcpconfig -N 10.200.117.0 -t 10.200.117.1(-N代表網段,-t代表默認路由)
dhtadm -A -m Solaris-11-ea-sparc -d ':DNSdmain=cdc.veritas.com:DNSserv=10.200.117.18:BootSrvA=10.200.117.245:BootFile="http://10.200.117.245:5555/cgi-bin/wanboot-cgi":Subnet=255.255.255.0:Router=10.200.117.1:' (創建宏,其中BootFile後面是創建的ai service的服務,用installadm create-service生成以後會有這個bootfile)
將客戶機加入到這個宏裡面:
pntadm -A 10.200.117.244 -h test11 -c test11 -m Solaris-11-ea-x86 -i 01000C2929BC02 -s 10.200.117.245 -f PERMANENT -e "01/01/2080" 10.200.117.0(-i是指網卡的mac地址前面要加01,-A是增加 -h是指客服機hostname,-m是指宏,-s是指server ip,-f是指不過期,10.200.117.0指你的網段)
dhcpconfig -S -r(重啟dhcp)
確保這個服務是起來了的:svc:/network/dhcp-server:default(用svcs -a|grep dhcp查看下,沒起來把服務開啟)
用pntadm -L 查看你簡歷的網段
root@test13:/repo/repoea# pntadm -L
10.200.117.0
pntadm -P 10.200.117.0查看所在網段的客服機器
root@test13:/repo/repoea# pntadm -P 10.200.117.0
Client ID Flags Client IP Server IP Lease Expiration Macro Comment
01000C2929BC02 01 10.200.117.244 10.200.117.245 Forever Solaris-11-ea-x86 test11
dhtadm -P 查看簡歷的宏
root@test13:/repo/repoea# dhtadm -P
Name Type Value
==================================================
Solaris-11-ea-x86 Macro :DNSdmain=cdc.veritas.com:DNSserv=10.200.117.18:BootSrvA=10.200.117.245:BootFile="default-i386/boot/grub/pxegrub2":Subnet=255.255.255.0:Router=10.200.117.1:
Solaris-11-ea-sparc Macro :DNSdmain=cdc.veritas.com:DNSserv=10.200.117.18:BootSrvA=10.200.117.245:BootFile="http://10.200.117.245:5555/cgi-bin/wanboot-cgi":Subnet=255.255.255.0:Router=10.200.117.1:
二:第一步的時候遺留了一個問題就是生成bootfile,現在我們要創建ai service
1:我的一些iso資源,包括solaris 11 U1的x86和sparc,還有就是repo做IPS
root@test13:/mnt/os/OS/solaris11/U1# ls
sol-11_1-24b-ai-sparc.iso sol-11_1-24b-ai-x86.iso sol-11_1-24b-repo-p01.iso sol-11_1-24b-repo-p02.iso
2:創建文件系統mount點
zfs create -o compression=on -o mountpoint=/ai rpool/ai(ai server裡面有manifest和profile等目錄,存放manifest和profile)
zfs create -o compression=on -o mountpoint=/repo rpool/repo(做IPS)
cd /ai;mkdir aiboot manifest
cd /mnt;mkdir nfs iso
mount -o vers=3 10.200.117.71:/lab /mnt/nfs
svcadm enable svc:/network/dns/multicast:default
svcadm enable network/tftp/udp6
3:創建ai service
installadm create-service -n Solaris-11-ea-sparc -s /mnt/nfs/iso/ea/sol-11-ea-ai-sparc.iso -d /ai/aiboot/Solaris-11-ea-sparc
installadm create-service -n Solaris-11-ea-x86 -s /mnt/nfs/iso/ea/sol-11-ea-ai-x86.iso -d /ai/aiboot/Solaris-11-ea-x86
這裡會生成一個bootfile文件,記住這個名字,這個名字要和dhcp server的宏相關聯
root@test13:/ai/profile# installadm create-service -n Solaris-11-ea-sparc -s /mnt/os/OS/solaris11/U1/sol-11_1-24b-ai-sparc.iso -d /ai/aiboot/Solaris-11-ea-sparc
Creating service from: /mnt/os/OS/solaris11/U1/sol-11_1-24b-ai-sparc.iso
Setting up the image ...
Creating sparc service: Solaris-11-ea-sparc
Image path: /ai/aiboot/Solaris-11-ea-sparc
Service discovery fallback mechanism set up
Creating SPARC configuration file
Refreshing install services
Creating default-sparc alias
Service discovery fallback mechanism set up
Creating SPARC configuration file
No local DHCP configuration found. This service is the default
alias for all SPARC clients. If not already in place, the following should
be added to the DHCP configuration:
Boot file: http://10.200.117.245:5555/cgi-bin/wanboot-cgi
Refreshing install services
3:關聯manifest到ai service
installadm add-manifest -n Solaris-11-ea-x86 -m manifest-ea -f /ai/manifest/manifest-ea.xml -d(create-manifest也可以,我試過,-d的參數代表默認的)
installadm add-manifest -n Solaris-11-ea-sparc -m manifest-ea -f /ai/manifest/manifest-ea.xml -d
manifest的一個模板xml文件是:
root@test13:/mnt# cat /ai/manifest/manifest-ea.xml
<!DOCTYPE auto_install SYSTEM "file:///usr/share/install/ai.dtd.1">
<auto_install>
<ai_instance name="manifest-GA">
<target>
<logical>
<zpool name="rpool" is_root="true">
<filesystem name="export" mountpoint="/export"/>
<filesystem name="export/home"/>
<be name="solaris"/>
</zpool>
</logical>
</target>
<software type="IPS">
<destination>
<image>
<!-- Specify locales to install -->
<facet set="false">facet.locale.*</facet>
<facet set="true">facet.locale.de</facet>
<facet set="true">facet.locale.de_DE</facet>
<facet set="true">facet.locale.en</facet>
<facet set="true">facet.locale.en_US</facet>
<facet set="true">facet.locale.es</facet>
<facet set="true">facet.locale.es_ES</facet>
<facet set="true">facet.locale.fr</facet>
<facet set="true">facet.locale.fr_FR</facet>
<facet set="true">facet.locale.it</facet>
<facet set="true">facet.locale.it_IT</facet>
<facet set="true">facet.locale.ja</facet>
<facet set="true">facet.locale.ja_*</facet>
<facet set="true">facet.locale.ko</facet>
<facet set="true">facet.locale.ko_*</facet>
<facet set="true">facet.locale.pt</facet>
<facet set="true">facet.locale.pt_BR</facet>
<facet set="true">facet.locale.zh</facet>
<facet set="true">facet.locale.zh_CN</facet>
<facet set="true">facet.locale.zh_TW</facet>
</image>
</destination>
<source>
<publisher name="solaris">
<origin name="http://10.200.117.245:10002"/>
</publisher>
</source>
<!--
By default the latest build available, in the specified IPS
repository, is installed. If another build is required, the
build number has to be appended to the 'entire' package in the
following form:
<name>pkg:/
[email protected]#</name>
-->
<software_data action="install">
<name>pkg:/entire@latest</name>
<name>pkg:/group/system/solaris-large-server</name>
<name>pkg:/slim_install</name>
</software_data>
</software>
</ai_instance>
</auto_install>
紅色部分是你的IPSserver的地址和端口
4:創建profile
installadm create-profile -n Solaris-11-ea-sparc -f /ai/profile/10.200.117.244.xml -p profile-ea
installadm create-profile -n Solaris-11-ea-x86 -f /ai/profile/10.200.117.244.xml -p profile-ea
profile xml文件就不貼出來了,太長了,官網有
5:創建IPS
lofiadm -a /mnt/os/mnt/os/OS/solaris11/U1/sol-11_1-24b-repo-p01.iso
mount -F hsfs /dev/lofi/1 /mnt/iso
rsync -aP /mnt/iso/repo/ /repo/repoea/
/usr/lib/pkg.depotd -d /repo/repoea -p 10002 > /dev/null&
這個只是將p01的包拷入到/repo/repoea/,再重復上面的操作,然後將p02也拷入到/repo/repoea/
好了,我們現在就可以重啟機器通過ai server 自動安裝系統了