xCat 使用方法
新裝centos74 作為xcat master, 關閉selinux。
ip:192.168.18.28 hostname:centos74
這里使用的virtualbox虛擬機。
xcat 安裝:
- 下載安裝包:
https://xcat.org/files/xcat/xcat-dep/2.x_Linux/xcat-dep-2.14.2-linux.tar.bz2
https://xcat.org/files/xcat/xcat-core/2.14.x_Linux/xcat-core/xcat-core-2.14.2-linux.tar.bz2
- 解壓:
tar jxvf xcat-core-2.14.2-linux.tar.bz2
tar jxvf xcat-dep-2.14.2-linux.tar.bz2
- 添加yum源:(根據自己的linux環境選擇,我的是redhat6,64位)
cd /root/xcat-dep/rh6/x86_64; ./mklocalrepo.sh
cd /root/xcat-core; ./mklocalrepo.sh
- 開始安裝:
yum clean metadata
yum install -y xCAT
- 檢查xCAT是否安裝正確:
source /etc/profile.d/xcat.sh
tabdump site
xcat 配置:
配置xcat服務器:
chtab key=master site.value=192.168.18.28
chtab key=domain site.value=HPC # 根據具體情況配置,這個屬性最后會被寫到每個node的/etc/resolv.conf文件里 (必須配置)
chtab key=nameservers site.value=192.168.18.28 # 根據具體情況配置,這個屬性最后會被寫到每個node的/etc/resolv.conf文件里
chtab key=forwarders site.value=192.168.0.1
tabdump networks 命令來檢查一下networks表信息, 不一致則修改:
chtab netname=192_168_18_0-255_255_255_0 \
networks.net=192.168.18.0 \
networks.mask=255.255.255.0 \
networks.gateway=192.168.0.1 \
networks.dhcpserver=192.168.18.28 \
networks.tftpserver=192.168.18.28 \
networks.nameservers=192.168.18.28 \
networks.ntpservers=192.168.18.28
tabdump passwd 查看密碼:
chtab key=system passwd.username=root passwd.password=test
chtab key=system passwd.username=Administrator passwd.password=test
配置hosts,可以查看/etc/hosts:
makehosts #配置hosts
127.0.0.1 localhost
192.168.18.22 centos74 centos74.HPC
配置DNS:
makedns -n
service named restart
配置dhcp,編輯/etc/dhcp/dhcpd.conf文件:
user=dhcpd
group=dhcpd
改為
user=root
group=root
重啟服務:
systemctl restart dhcpd.service
makedhcp -n
注意:如果存在windows節點,則需要xcat master上配置samba,安裝過程需要。
安裝samba: yum install samba.
修改/etc/samba/smb.conf的[global]段: security = share。
注意: samba4 設置(需要設置install目錄及下所有權限為777):
security = user
map to guest = Bad User
並增加
[install]
path = /install
public = yes
writable = yes
guest ok = yes
chkconfig smb on
service smb restart
新增節點
centos7.4:
hostname: test ip: 192.168.18.29 mac: 080027D59856 內存大於1G
- 添加節點:
nodeadd test \
groups=compute,all \
mac.interface=enp0s3 \
mac.mac=08:00:27:D5:98:56 \
hosts.ip=192.168.18.29 \
noderes.netboot=pxe \
noderes.xcatmaster=192.168.18.28 \
noderes.installnic=enp0s3 \
noderes.primarynic=enp0s3 \
noderes.nfsserver=192.168.18.28 \
nodetype.os=centos7.4 \
nodetype.arch=x86_64 \
nodetype.profile=compute \
nodetype.nodetype=osi
使用lsdef test查看配置信息。
2. 添加鏡像:
[root@centos74 init.d]# copycds -n centos7 /media/sf_VData/xCat/CentOS-7-x86_64-DVD-1708.iso
Copying media to /install/centos7/x86_64
Media copy operation successful
使用lsdef -t osimage 查看, 根據需求修改模板
chdef -t osimage centos7-x86_64-install-compute template=/media/sf_VData/xCat/template/centos7.4/compute.centos7.tmpl
pkglist=/media/sf_VData/xCat/template/centos7.4/compute.centos7.pkglist
- 配置其他信息:
makehosts //添加/etc/hosts
makedns test //添加dns
makedhcp test // 配置dhcp
- 添加后處理:
tabdump postscripts //查看后處理配置
添加compute后處理類型:
chtab node=compute postscripts.postscripts="install_test"
lsdef test可查看是否改變。
創建后處理需要用到的文件目錄:
cp * /install/postscripts
權限修改為755
- 安裝系統:
nodeset test osimage=centos7-x86_64-install-compute
win7:
hostname: wtest ip: 192.168.18.30 mac: 080027299B89
- 添加節點:
nodeadd wtest \
groups=compute,all \
mac.interface=enp0s3 \
mac.mac=08:00:27:29:9B:89 \
hosts.ip=192.168.18.30 \
noderes.netboot=pxe \
noderes.xcatmaster=192.168.18.28 \
noderes.installnic=enp0s3 \
noderes.primarynic=enp0s3 \
noderes.nfsserver=192.168.18.28 \
nodetype.os=win7 \
nodetype.arch=x86_64 \
nodetype.profile=compute \
nodetype.nodetype=osi
再執行:chdef wtest kernel=Boot/pxeboot.0
使用lsdef wtest查看配置信息。
- 添加鏡像:
copycds -n win7 /media/sf_VData/xCat/cn_windows_7_ultimate_x64_dvd_x15-66043.iso
Copying media to /install/win7/x86_64
Media copy operation successful
chdef -t osimage win7-x86_64-install-compute \
imagetype=windows \
osarch=x86_64 \
osname=Windows \
osvers=win7 \
profile=ultimate \
provmethod=install \
template=/media/sf_VData/xCat/template/win7/ultimate.win7.x86_64.tmpl
使用lsdef -t osimage 查看
- boot程序(之前提前已經做好,不同windows需要制作對應版本boot,需要添加網絡驅動,參照官網)
[root@centos74 tftpboot]# ls /media/sf_VData/xCat/template/win7/startBoot/*
/media/sf_VData/xCat/template/win7/startBoot/bootmgr.exe
/media/sf_VData/xCat/template/win7/startBoot/Boot:
BCD BCD.64.LOG BCD.64.LOG2 bootmgr.efi Fonts wdsmgfw.efi
BCD.64 BCD.64.LOG1 bootmgfw.efi boot.sdi pxeboot.0 WinPE_64.wim
[root@centos74 tftpboot]# cp /media/sf_VData/xCat/template/win7/startBoot/* . -r
注意修改權限為755.
4. 配置其他信息:
makehosts //添加/etc/hosts
makedns test //添加dns
makedhcp test // 配置dhcp
- 添加后處理:
創建后處理需要用到的文件目錄:
cp * /install/winpostscripts
權限修改為755
-
添加驅動:
將驅動拷貝到/install/drivers// 目錄下。
例如: /install/drivers/win2012r2/x86_64/ -
安裝系統:
nodeset test osimage=win7-x86_64-install-compute -
/install/autoinst目錄下,對應的$IP.cmd 需要添加:
...
copy %instdrv%\winpostscripts\* c:\xcatpost\^M
copy %instdrv%\mypostscripts\mypostscript.htest c:\xcatpost\^M
goto up
:SKIPPOST^M
reg load HKLM\csystem c:\windows\system32\config\system^M
...
問題總結:
- bios需要啟用pxe boot並且設置從網路啟動
- 提示succeed to downloadn NBP file。但是沒有執行安裝而正常啟動,則需要開啟legacy mode。