@mrz1
2018-01-13T19:03:50.000000Z
字数 3408
阅读 830
自动化
安装前准备:关闭防火墙和SELINUX,DHCP服务器静态IP
安装相应软件包
1.yum install dhcp httpd tftp-server syslinux
2.chkconfig httpd on
chkconfig dhcpd on
chkconfig tftp on (因为tftp受xinetd管理所以xinetd也许启动)
chkconfig xinetd on 或者修改/etc/xinetd.d/tftp文件中disable=no
3.[root@centos7 ~]#vim /etc/dhcp/dhcpd.conf //编写这个文件
option domain-name "zhangqifei.com";
option domain-name-servers 114.114.114.114,8.8.8.8; //DNS解析
option routers 192.168.109.1;//全局默认网关
default-lease-time 84600; //有效期
max-lease-time 84600; //特殊要求最大有效期
log-facility local7;
subnet 192.168.109.0 netmask 255.255.255.0 { //网段
range 192.168.109.100 192.168.109.200; //分配ip范围 如果这里写网关,就是这些范围ip,外面的网关是全局的这里不设置网关会是全局网关
filename "pxelinux.0";/文件名网络中启动程序的文件名
next-server "192.168.109.143";(tftp)//程序的文件名地址
}
例也可以这样:
host fantasia { //绑定mac地址,分配默认ip
hardware ethernet 08:00:07:26:c0:a5;
fixed-address 192.168.109.101;
这里网关和DNS都可以单独设置
}
4.service dhcpd restart (启动dhcp服务)
5.service httpd restart (启动httpd服务)
6.mkdir -p centos/6;mkdir ksdir
7.cp /root/anaconda-ks.cfg /var/www/html/ksdir/ks6-pxe.cfg
8.[root@centos7 ksdir]#cat ks6-pxe.cfg (编辑这个脚本)
# Kickstart file automatically generated by anaconda.
#version=DEVEL
install
reboot
text
url --url=http://192.168.109.143/centos/6(url这里我们用光盘看9)
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto dhcp --noipv6
rootpw --iscrypted $6$6YyIa0te.We2OG1r$W8zGexnUlYhMlStMTMYVJ7QAQIuFpqJp655PUU6xGnpC7FhFXUoZ2pB77H7wQSdT5ci3yiJ0vxilWzcxGst00.
firewall --disabled
authconfig --enableshadow --passalgo=sha512
selinux --disabled
timezone Asia/Shanghai
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
clearpart --all
zerombr
part /boot --fstype=ext4 --size=1024
part / --fstype=ext4 --size=50000
part /app --fstype=ext4 --size=20000
part swap --size=2048
%packages
@base
@core
@debugging
@basic-desktop
@desktop-debugging
@desktop-platform
@directory-client
@fonts
@general-desktop
@graphical-admin-tools
@input-methods
@internet-applications
@internet-browser
@legacy-x
@network-file-system-client
@x11
%end
9.[root@centos7 ksdir]#cat /etc/fstab (把下面添加进去并且挂载maunt -a)
/dev/sr0 /var/www/html/centos/6 iso9660 defaults 0 0
10.注意ks6-pxe.cfg权限644
/var/lib/tftpboot/(tftp客户端连接的目录默认是这个目录下)
1.yum install syslinux(安装这个包)
2.cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
cp /misc/cd/isolinux/{vmlinuz,initrd.img} /var/lib/tftpboot/
mkdir /var/lib/tftpboot/pxelinux.cfg/
cp /misc/cd/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
cp /misc/cd/isolinux/{vesamenu.c32,boot.msg,splash.jpg} /var/lib/tftpboot/
3.[root@centos7 ~]#Vim /var/lib/tftpboot/pxelinux.cfg/default(默认菜单)
default vesamenu.c32
timeout 60
display boot.msg
menu background splash.jpg
menu title Welcome to CentOS 6!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000
menu title PXE INSTALL CentOS 6
label desktop
menu label ^Install desktop CentOS 7
kernel vmlinuz
append initrd=initrd.img ks=http://192.168.109.143/ksdir/ks6-pxe.cfg
label mini
menu label install ^Mini CentOS 6
kernel vmlinuz
append initrd=initrd.img ks=http://192.168.109.143/ksdir/ks6-mini.cfg
label local
menu default
menu label Boot from ^local drive
localboot 0xffff
menu end
[root@centos7 tftpboot]#tree
.
├── boot.msg
├── splash.jpg
├── initrd.img
├── pxelinux.0
├── vesamenu.c32
├── pxelinux.cfg
│ └── default
└── vmlinuz