1. 安装配置dhcp
# yum install dhcp
之后配置dhcp
# vi /etc/dhcp/dhcpd.conf # default-lease-time 600; # max-lease-time 7200; ddns-update-style none; log-facility local7; next-server 192.168.1.1; //指定tftp服务器ip,该ip地址这里指定本机地址 filename "pxe<a href="http://www.ttlsa.com/linux/" title="linux"target="_blank">linux</a>.0"; //指定引导文件 subnet 192.168.1.0 netmask 255.255.255.0 { range dynamic-bootp 192.168.1.10 192.168.1.100; //设置dhcp作用域范围 # option domain-name-servers 8.8.8.8; # option routers 192.168.1.1; option subnet-mask 255.255.255.0; option broadcast-address 192.168.1.255; default-lease-time 600; max-lease-time 7200; }
2. 安装配置tftp
# yum install tftp-server
再配置tftp
# vim /etc/xinetd.d/tftp service tftp { socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /var/lib/tftpboot //设置tftp的根目录 disable = no //这里原来是yes要改成no per_source = 11 cps = 100 2 flags = IPv4 }
再执行
cd /var/lib/tftp mkdir pxelinux.cfg
挂载系统关盘到/mnt/cdrom目录下
# mount /dev/cdrom /mnt/cdrom # cp /mnt/cdrom/images/*.img /var/lib/tftpboot # cp /mnt/cdrom/isolinux/boot.msg /var/lib/tftpboot # cp /mnt/cdrom/isolinux/initrd.img /var/lib/tftpboot # cp /mnt/cdrom/isolinux/vesamenu.c32 /var/lib/tftpboot # cp /mnt/cdrom/isolinux/vmlinuz /var/lib/tftpboot # cp /mnt/cdrom/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default # chmod -R 755 /var/lib/tftpboot //让tftp目录下的所有文件有执行权限 #chmod 777 /var/lib/tftpboot/pxelinux.cfg/default
获取pxelinux.0 引导文件
# yum install syslinux # rpm -qa | grep syslinux # rpm -ql syslinux-4.02-7.el6.x86_64 | grep pxelinux.0 //查找 pxelinux.0所在位置 # cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
3. 配置apache
# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf Alias /iso "/mnt/cdrom/" <Directory "/mnt/cdrom"> AllowOverride None Options Indexes FollowSymLinks Require all granted Order Deny,Allow Deny From all Allow From 192.168.1.0/24 </Directory>
4. 启动关闭服务
# service dhcpd start # service xinetd start
关闭selinux和iptables
# set enforce0 # service iptables stop
5. 安装操作系统
从网络安装即可,各自服务器网络启动方式不同,这边不再敖述,在选择安装源的步骤填http://192.168.1.1/iso
转载请注明:IT运维空间 » linux » pxe网络安装centos系统
发表评论