@mrz1
2018-01-13T19:03:50.000000Z
字数 3408
阅读 939
自动化
安装前准备:关闭防火墙和SELINUX,DHCP服务器静态IP
安装相应软件包1.yum install dhcp httpd tftp-server syslinux2.chkconfig httpd onchkconfig dhcpd onchkconfig tftp on (因为tftp受xinetd管理所以xinetd也许启动)chkconfig xinetd on 或者修改/etc/xinetd.d/tftp文件中disable=no3.[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地址,分配默认iphardware 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 ksdir7.cp /root/anaconda-ks.cfg /var/www/html/ksdir/ks6-pxe.cfg8.[root@centos7 ksdir]#cat ks6-pxe.cfg (编辑这个脚本)# Kickstart file automatically generated by anaconda.#version=DEVELinstallreboottexturl --url=http://192.168.109.143/centos/6(url这里我们用光盘看9)lang en_US.UTF-8keyboard usnetwork --onboot yes --device eth0 --bootproto dhcp --noipv6rootpw --iscrypted $6$6YyIa0te.We2OG1r$W8zGexnUlYhMlStMTMYVJ7QAQIuFpqJp655PUU6xGnpC7FhFXUoZ2pB77H7wQSdT5ci3yiJ0vxilWzcxGst00.firewall --disabledauthconfig --enableshadow --passalgo=sha512selinux --disabledtimezone Asia/Shanghaibootloader --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 workclearpart --allzerombrpart /boot --fstype=ext4 --size=1024part / --fstype=ext4 --size=50000part /app --fstype=ext4 --size=20000part 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%end9.[root@centos7 ksdir]#cat /etc/fstab (把下面添加进去并且挂载maunt -a)/dev/sr0 /var/www/html/centos/6 iso9660 defaults 0 010.注意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/defaultcp /misc/cd/isolinux/{vesamenu.c32,boot.msg,splash.jpg} /var/lib/tftpboot/3.[root@centos7 ~]#Vim /var/lib/tftpboot/pxelinux.cfg/default(默认菜单)default vesamenu.c32timeout 60display boot.msgmenu background splash.jpgmenu title Welcome to CentOS 6!menu color border 0 #ffffffff #00000000menu color sel 7 #ffffffff #ff000000menu color title 0 #ffffffff #00000000menu color tabmsg 0 #ffffffff #00000000menu color unsel 0 #ffffffff #00000000menu color hotsel 0 #ff000000 #ffffffffmenu color hotkey 7 #ffffffff #ff000000menu color scrollbar 0 #ffffffff #00000000menu title PXE INSTALL CentOS 6label desktopmenu label ^Install desktop CentOS 7kernel vmlinuzappend initrd=initrd.img ks=http://192.168.109.143/ksdir/ks6-pxe.cfglabel minimenu label install ^Mini CentOS 6kernel vmlinuzappend initrd=initrd.img ks=http://192.168.109.143/ksdir/ks6-mini.cfglabel localmenu defaultmenu label Boot from ^local drivelocalboot 0xffffmenu end[root@centos7 tftpboot]#tree.├── boot.msg├── splash.jpg├── initrd.img├── pxelinux.0├── vesamenu.c32├── pxelinux.cfg│ └── default└── vmlinuz