Linux系统下安装pxe+kickstart
aliang 2022-12-28 15:12:15 1393

    相信每一位在机房工作的同仁们少不了的就装系统,少量还好当一天装个十几个二十台还是同一个系统那真是够了,可能大家会说pe里面可是克制镜像,做系统时候直接还原还是很快的,但是一个型号的机房不可能只有一个型号的设备啊,况且机房是接受托管的。那么不同型号的设备如何省时省力呢?
    那就一起来来了解下pxe+kickstart
    PXE+Kickstart无人值守安装操作系统,PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/严格来说,PXE 并不是一种安装方式,而是一种引导方式。Server的网络模式,支持工作站通过网络从远端服务器下载映像,并由此支持通过网络启动操作系统,在启动过程中,终端要求服务器分配IP地址,再用TFTP(trivial file transfer protocol)或MTFTP(multicast trivial file transfer protocol)协议下载一个启动软件包到本机内存中执行,由这个启动软件包完成终端基本软件设置,从而引导预先安装在服务器中的终端操作系统。
    PXE+Kickstart安装
安装过程:

一、关闭了selinux iptables
 vim /etc/sysconfig/selinux
更改成 SELINUX=disabled
service iptables stop
chkconfig iptables off

二、配置yum源以及用yum安装
 yum install -y httpd* tftp-server-* xinetd-* system-config-kickstart-* syslinux dhcp*
挂载Linxu iso镜像
 mount /dev/cdrom   /mnt
cp -rf   /mnt/*   /var/www/html/
 
三、配置tftp加载文件

开机启动:
 vi /etc/xinetd.d/tftp
disable                 = no 
#disable的直由yes变为no
加载FTP文件:
 mkdir /tftpboot/
cd /tftpboot/
cp /usr/lib/syslinux/pxelinux.0 /tftpboot  实验时候lib下没有syslinux目录正确cp /usr/share/syslinux/pxelinux.0 /tftpboot
cp /var/www/html/images/pxeboot/initrd.img   /tftpboot
cp /var/www/html/images/pxeboot/vmlinux   /tftpboot
cp /var/www/html/images/pxeboot/vmlinux   /tftpboot
mkdir pxelinux.cfg
cp /var/www/html/isolinux/isolinux.cfg   /tftpboot/pxelinux.cfg/default
四、配置dhcp文件
 vim /etc/dhcp/dhcpd.conf
 # # DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
ddns-update-style interim;
ignore client-updates;
subnet 192.168.100.0 netmask 255.255.255.0 {
option routers 192.168.100.1;
option subnet-mask 255.255.255.0;
range 192.168.100.100 192.168.100.200;
next-server 192.168.100.60;
filename "pxelinux.0";
allow booting;
allow bootp;
}
 
五、配置KickSyack自动安装配置文件
图形界面配置:
 #system-config-kickstart
Could not open display because no X server is running.报错信息  由于是最小化的系统  没有桌面
yum groupinstall "Desktop"
yum groupinstall chinese-support
#startx
#system-config-kickstart
Shell配置:参考代码区进行修改。
  
六、后续工作重启服务以及开机启动
 service httpd restart 
service xinetd restart
service dhcpd restart
chkconfig httpd on
chkconfig xinetd on
chkconfig dhcpd on
代码:
 [root@wh-kickstart-100-60 ~]# vim /tftpboot/pxelinux.cfg/default
 default linux
prompt 0
timeout 10
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux
  kernel vmlinuz
  append initrd=initrd.img ks=http://192.168.100.60/ks.cfg  ksdevice=eth0 (ksdevice单网卡可以不写 多网卡必须要有 不然会卡在配置网卡界面)
label text
  kernel vmlinuz
  append initrd=initrd.img text
label ks
  kernel vmlinuz
  append ks initrd=initrd.img
label local
  localboot 1
label memtest86
  kernel memtest
  append -

 [root@wh-kickstart-100-60 ~]# vim /etc/dhcp/dhcpd.conf
 #
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample  
#
ddns-update-style interim;
ignore client-updates;
subnet 192.168.100.0 netmask 255.255.255.0 {
option routers 192.168.100.1;
option subnet-mask 255.255.255.0;
range 192.168.100.100 192.168.100.200;
next-server 192.168.100.60;
filename "pxelinux.0";
allow booting;
allow bootp;
}

 [root@wh-kickstart-100-60 ~]# vim /var/www/html/ks.cfg 
 #platform=x86, AMD64, or Intel EM64T
# System authorization information
auth  --useshadow  --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --none
# Use graphical install
graphical
# Firewall configuration
firewall --enabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# Installation logging level
logging --level=info
# Use network installation
url --url=http://192.168.100.60/
# Network information (网络配置需要注意的:要么自动获取  预设固定ip的话 要设置和环境一个网段的ip)
network --bootproto=dhcp --device=eth0 --onboot=on
#Root password
rootpw --iscrypted $1$vraKvWxT$xevNz205XcKgz8pnf43BV1
# SELinux configuration
selinux --disabled
# System timezone
timezone  Asia/Shanghai
# Install OS instead of upgrade
install
# X Window System configuration information
xconfig  --defaultdesktop=GNOME --depth=8 --resolution=640x480
# Disk partitioning information
part / --bytes-per-inode=4096 --fstype="ext3" --size=4096
part /boot --bytes-per-inode=4096 --fstype="ext3" --size=100
part swap --bytes-per-inode=4096 --fstype="swap" --size=1024
part /home --bytes-per-inode=4096 --fstype="ext3" --grow --size=1
%packages
@gnome-desktop

DHCP介绍:
ddns-update-style interim:这个是动态获取IP地址啦。必须放在第一项哇。
ignore client-updates:服务端与客户端传输相关
Subnet:获取IP段,要配置正确。
Routers:是路由地址
Range:dhcp分配IP段。
next-server:是tftp地址。
Allow booting bootp:放行传输和协议。
    希望这些对IDC工作的各位有所帮助,更多内容请关注:陆网科技

相关信息推荐
2022-12-28 15:24:02 关键词: 云服务器 虚拟化安装
昨天和客户交谈时提及云技术,虚拟化化技术时,客户显得略有迷茫,今天我给大家简单的讲一下KVM虚拟技术
2022-12-28 15:22:40 关键词: HostMonitor安装 网络监测工具
作为一名机房管理员,最怕什么?不是怕设备出问题,而是怕出问题了自己还不知道,那么怎么样才可以有效的实
2022-12-28 15:20:50 关键词: 服务器系统安装 U盘启动盘 PE系统
小编电脑随着使用时间的变长,越来越乱,越来越卡,想整理下电脑换个系统,用什么工具方便呢?那么今天我个
2022-12-28 15:05:17 关键词: 华为交换机技术 VLan隔离 端口隔离
对于网络工程师来说vlan这个词并不陌生,VLAN是个网络设置中常用的东西,在网络区域划分中常用的,
2022-12-28 14:43:37 关键词: Linux技术 centos运维
一般建站用centos的比较多,因为啥呢,因为centos比较方便,简单,用ssh就能连接了!但是大
2022-12-28 14:42:42 关键词: 操作系统防火墙 防火墙怎么开启与关闭
很多小伙伴都遇到过ping不通一台服务器或者一个网站,以为网站或服务器断网死机了,其实并不是这样的。
2022-12-28 14:40:30 关键词: 网站php开发 网页开发
很多写代码的程序员,都会遇见各种各样的代码报错问题。以下小编为大家例举出一些常见问题。PHPcrc3
2022-12-28 14:38:51 关键词: 系统漏洞
几年前的,"WannaCry"勒索病毒爆发刚满两年,Windows再次被曝出一个"蠕虫级"的高危远程
2022-12-28 14:36:33 关键词: windows源IP 源IP指定
经常我们会遇到多IP服务器,但是对外访问的源IP是由系统自己指定的,但有时候我们想自己指定对外访问的
2022-12-28 14:35:43 关键词: CactiEZ 流量监控 zabbix 流量统计
现在几乎所有的IDC机房都有流量监控设备、流量监控系统。方便于实时监控机房核心交换机、机柜交换机、服