0
点赞
收藏
分享

微信扫一扫

MQTT服务器-安装篇(阿里云主机)

鱼板番茄 2024-08-06 阅读 31

PXE:工作在 Client/Server模式,允许客户机通过网络从远程服务器下载引导镜像,并加载安装文件或者整个操作系统。

运行 PXE协议需要设置:DHCP服务器和TFTP服务器。DHCP服务器用来给 PXE client(将要安装系统的主机)分配一个IP地址。PXE Client通过TFTP协议到TFTP Server 上下载所需的文件。

KickStart概述

KickStart是一种无人职守安装方式。KickStart的工作原理是通过记录典型的安装过程中所需人工干预填写的各种参数,并生成一个名为ks.cfg 的文件;在其后的安装过程中(不只局限于生成Kickstart安装文件的机器)当出现要求填写参数的情况时,安装程序会首先去查找KickStart生成的文件,当找到合适的参数时,就采用找到的参数,当没有找到合适的参数时,才需要安装者手工干预。


一、kickstart自动安装脚本制作(第一步)

环境准备:Redhat7.9 、开启主机图形化界面、配置网络可用、关闭vmvare dhcp功能。

yum install httpd -y

systemctl enable --now httpd

ln -s /rhel7 /var/www/html   #将/rhel7目录链接到Apache的默认网页根目录/var/www/html,当通过Web服务器访问网站时,实际上你看到的是/rhel7目录中的内容。
dnf install system-config-kickstart   #安装 图形化生成kickstart 自动安装脚本的工具
system-config-kickstart  #启动图形制作工具

必要配置如下:

 配置完成后保存:为ks.cfg文件

 编辑文本 vim ks.cfg 向文本中添加所缺的信息:

保存退出后,可以在命令行输入:ksvalidator ks.cfg 来查看文件中是否有错误。

cp /root/ks.cfg /var/www/html    #ks.cfg文件上传到web服务上。

可以在浏览器查看到则🆗,如果这一步到不了前面的就有问题:<(^-^)>

二、配置dhcp服务(第二步)

关键配置:

option domain-name "lxm.org";
option domain-name-servers 114.114.114.114;
 

subnet 172.25.254.0 netmask 255.255.255.0 {
  range 172.25.254.30 172.25.254.40;
  option routers 172.25.254.2;
}
 

完整内容如下:

# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#

# option definitions common to all supported networks...
option domain-name "lxm.org";
option domain-name-servers 114.114.114.114;

default-lease-time 600;
max-lease-time 7200;

# Use this to enble / disable dynamic dns updates globally.
#ddns-update-style none;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;

# No service will be given on this subnet, but declaring it helps the 
# DHCP server to understand the network topology.

#subnet 10.152.187.0 netmask 255.255.255.0 {
#}

# This is a very basic subnet declaration.

subnet 172.25.254.0 netmask 255.255.255.0 {
  range 172.25.254.30 172.25.254.40;
  option routers 172.25.254.2;
}

修改后都要重启服务:systemctl enable --now dhcpd

新建虚拟机,测试:ks=http://172.25.254.6/ks.cfg(测试机移除网络适配器,以及设置显示器)

 三、共享pexlinux数据文件的网络服务(第三步)

安装所需包:yum install syslinux.x86_64 -y

yum install tftp-server.x86_64 -y

启动:systemctl enable --now tftp

资源应该放在 /var/lib/tftpboot:

修改开机启动配置:vim /var/lib/tftpboot/pxelinux.cfg/default

然后再修改DHCP配置文件;vim /etc/dhcp/dhcpd.conf,再上一步的基础上添加2行:filename:指在next-server上要读取哪个文件;

 

测试:测试的客户机要移除光盘iso;开启的时候选择“打开电源时进入固件”

若部署成功:只用开启,其他不用任何手动操作

举报

相关推荐

0 条评论