网络安装centos7.2

1、查看系统版本,安装所需包
cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.3 (Santiago)

#yum install -y dhcp sblim-cmpi-dhcp xinetd syslinux tftp-server vsftpd
2、配置dhcpd服务
option space PXE;
option PXE.mtftp-ip code 1 = ip-address;
option PXE.mtftp-cport code 2 = unsigned integer 16;
option PXE.mtftp-sport code 3 = unsigned integer 16;
option PXE.mtftp-tmout code 4 = unsigned integer 8;
option PXE.mtftp-delay code 5 = unsigned integer 8;
option PXE.discovery-control code 6 = unsigned integer 8;
option PXE.discovery-mcast-addr code 7 = ip-address;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
option vendor-class-identifier "PXEClient";
vendor-option-space PXE;

option PXE.mtftp-ip 0.0.0.0;

filename "pxelinux.0";

next-server 192.168.2.10;
}
ddns-update-style interim;
ignore client-updates;
default-lease-time 1200;
max-lease-time 9200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.2.255;
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.200 192.168.2.250;
3、打开tftp服务
vi /etc/xinetd.d/tftp
   disable = no

4、挂载镜像拷贝所需文件
mkdir -p /var/ftp/centos7.2/
mount -o loop /root/ISO/CentOS-7-x86_64-DVD-1511.iso /var/ftp/centos7.2/
cp /var/ftp/centos7.2/isolinux/vmlinuz /var/lib/tftpboot/
cp /var/ftp/centos7.2/isolinux/initrd.img /var/lib/tftpboot/
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
5、建立配置文件
mkdir /var/lib/tftpboot/pxelinux.cfg
vi /var/lib/tftpboot/pxelinux.cfg/default
default centos-7.2
prompt 1
timeout 10
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label centos-7.2
  kernel vmlinuz
  append initrd=initrd.img method=ftp://192.168.2.10/centos7.2 devfs=nomount
6、启动服务
chkconfig tftp on
service xinetd restart
service dhcpd restart
service vsftpd restart

猜你喜欢

转载自blog.csdn.net/qq_37594711/article/details/79919144