天天看点

pxe+dhcp+ftp+tftp 从网络安装linux

关闭防火墙:service iptables  stop ;chkconfig iptables off

关闭selinux :/etc/sysconfig/selinux中设置参数selinux=0 ;重启机器;查看 getenforce ,如果是 disable 就关闭了

安装 tftp dhcp vsftp:

yum install -y tftp-server;

yum install -y dhcp-server; chkconfig–level 345 dhcpd on

yum install -y vsftpd;        chkconfig –level 345 vsftpd on

配置并开启tftp,

vi /etc/xinetd.d/tftp , 修改2个参数:

       server_args             = -unobody -s /tftpboot

       disable                 = no

#首先挂载

mount /dev/cdrom /mnt/cdrom

mkdir /tftpboot/pxelinux.cfg

cp /usr/share/syslinux/pxelinux.0/tftpboot/

cp /mnt/cdrom/isolinux/vmlinuz /tftpboot/

cp /mnt/cdrom/isolinux/initrd.img/tftpboot/ 

cp /mnt/cdrom/isolinux/isolinux.cfg/tftpboot/pxelinux.cfg/default

在/tftpboot目录PXE用到的文件:

生成结果tftpboot目录: [/tftpboot]#tree

.

├── initrd.img           

├── pxelinux.0

├── pxelinux.cfg

│   └── default

└── vmlinuz

配置dhcp:

vi /etc/dhcp/dhcpd.conf

#       注意

#       optionrouters 192.168.172.128;

#       next-server192.168.172.128;

#       都要写成本机ip

ddns-update-style interim;

ignore client-updates;

allow booting;

allow bootp;

subnet 192.168.172.0 netmask 255.255.255.0 {

         optionrouters 192.168.172.128;

         optionsubnet-mask 255.255.255.0;

         optiondomain-name-servers 192.168.172.128;  #本地IP

         optiontime-offset -18000; # Eastern Standard Time

         rangedynamic-bootp 192.168.172.100 192.168.172.200; #要分区的IP

         default-lease-time21600;

         max-lease-time43200;

         #Group the PXE bootable hosts together

         #PXE-specific configuration directives...

         next-server192.168.172.128;

         filename"pxelinux.0";  #方便查找配置文件

}

配置vsftpd:

vi vsftpd/vsftpd.conf ,在最后添加一行,用于更改匿名登陆目录:

anon_root=/mnt/cdrom

挂载iso文件到该目录:

mount /dev/cdrom /mnt/cdrom

重启各服务:

service xinetd restart;

service dhcpd restart;

service vsftpd restart;

参考文档:

http://wenku.baidu.com/view/8c17a24bf7ec4afe04a1dfdf.html

继续阅读