xCat 使用方法

Jun 3, 2019

xCat 使用方法

新装centos74 作为xcat master, 关闭selinux。
ip:192.168.18.28 hostname:centos74

xcat 安装:

  1. 下载安装包:

    1
    2
    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
  2. 解压:

    1
    2
    tar jxvf xcat-core-2.14.2-linux.tar.bz2 
    tar jxvf xcat-dep-2.14.2-linux.tar.bz2
  3. 添加yum源:(根据自己的linux环境选择,我的是redhat6,64位)

    1
    2
    cd /root/xcat-dep/rh6/x86_64; ./mklocalrepo.sh
    cd /root/xcat-core; ./mklocalrepo.sh
  4. 开始安装:

    1
    2
    yum clean metadata
    yum install -y xCAT
  5. 检查xCAT是否安装正确:

    1
    2
    source /etc/profile.d/xcat.sh
    tabdump site

xcat 配置:

配置xcat服务器:

1
2
3
4
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表信息, 不一致则修改:

1
2
3
4
5
6
7
8
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 查看密码:

1
2
chtab key=system passwd.username=root passwd.password=jhadmin
chtab key=system passwd.username=Administrator passwd.password=jhadmin

配置hosts,可以查看/etc/hosts:

1
2
3
makehosts #配置hosts 
127.0.0.1 localhost
192.168.18.22 centos74 centos74.HPC

配置DNS:

1
2
makedns -n  
service named restart

配置dhcp,编辑/etc/dhcp/dhcpd.conf文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
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

1
并增加

[install]
path = /install
public = yes
writable = yes
guest ok = yes

1
2
3
4
5
6
7
8
	chkconfig smb on
service smb restart

## 新增节点
### centos7.4:
hostname: test ip: 192.168.18.29 mac: 080027D59856 内存大于1G

1. 添加节点:

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

1
2
使用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

1
使用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

1
3. 配置其他信息:

makehosts //添加/etc/hosts
makedns test //添加dns
makedhcp test // 配置dhcp

1
4. 添加后处理:

tabdump postscripts //查看后处理配置
添加compute后处理类型:
chtab node=compute postscripts.postscripts=”install_Unischeduler”
lsdef test可查看是否改变。
创建后处理需要用到的文件目录:
cp * /install/postscripts
权限修改为755

1
2
3
4
5
6
7
4. 安装系统:
nodeset test osimage=centos7-x86_64-install-compute

### win7:
hostname: wtest ip: 192.168.18.30 mac: 080027299B89

1. 添加节点:

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

1
2
3
使用lsdef wtest查看配置信息。 

2. 添加镜像:

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

1
2
3
4
5
6
7
8
9
```
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 查看

  1. boot程序(之前提前已经做好,不同windows需要制作对应版本boot,需要添加网络驱动)
    1
    2
    3
    4
    5
    6
    [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.

  1. 配置其他信息:
    1
    2
    3
    4
    5
    makehosts //添加/etc/hosts
    makedns test //添加dns
    makedhcp test // 配置dhcp
    ```
    5. 添加后处理:

chdef -t site clustersite precreatemypostscripts=1
创建后处理需要用到的文件目录:
cp * /install/winpostscripts
权限修改为755

1
2
3
4
5
6
7
6. 添加驱动:
将驱动拷贝到/install/drivers/<os>/<arch> 目录下。
例如: /install/drivers/win2012r2/x86_64/
7. 安装系统:
nodeset test osimage=win7-x86_64-install-compute

8. /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


# API 安装
安装包:
yum install mod_ssl
service httpd restart
yum install perl-JSON

增加可接入用户:
tabch key=xcat,username=root passwd.password=<root-pw>


问题总结:
1. bios需要启用pxe boot并且设置从网路启动
2. 提示succeed to downloadn NBP file。但是没有执行安装而正常启动,则需要开启legacy mode。
3. 安装系统得模板文件已提供,针对中英文版本,需要修改模板中安装得语音,以实际情况为准。
4. 后处理脚本文件已提供,需要针对实际情况修改。

# IPMI 使用:

- 设置使用 IPMI
        nodech <noderange> nodehm.power=ipmi nodehm.mgt=ipmi
- 设置 IPMI 的IP地址,用户名和密码等属性
        nodech <noderange> ipmi.bmc=<ipmi ip address> ipmi.username=<ipmi username> ipmi.password=<ipmi password>
- 设置要安装的操作系统镜像
        nodeset <noderange> osimage=rhel5.8-x86_64-install-compute
- 设置机器使用网络启动
        rsetboot <noderange> net
- 重启机器执行安装
        rpower <noderange> reset