实验环境:
centos7.1
vmware worksation 11
实验设备:
kick.test.com 服务端(kickstart+dhcp+dns+vsftp+tftp)
client 客户端(1G内存)
注意内存最小1G,否则回报out of memory的错误。
所需服务:
1.DHCP
2.tftp-server
2.VSFTP
3.DNS
所需文件:
1.vmlinuz
2.initrd
3.ks.cfg kickstart 应答文件
4.pxelinux.0文件
5.系统光盘镜像
部署过程:
假设服务器所在网段为192.168.225.0 255.255.255.0,服务器ip地址为192.168.225.3,主机名为kick.test.com
1.安装配置dhcp
#yum install dhcp -y
#cat /usr/share/doc/dhcp-xxx/dhcpd.conf.example > /etc/dhcp/dhcpd.conf
#vim /etc/dhcp/dhcpd.conf
subnet 192.168.225.0 netmask 255.255.255.0{
range 192.168.225.100 192.168.225.150;
option domain-name-servers 192.168.225.3;
option domain-name "test.com";
option routers 192.168.225.3;
option broadcast-address 192.168.225.255;
default-lease-time 600;
max-lease-time 7200;
filename "/pxelinux.0"; 指定pxelinux.0文件在ftp上的位置。
next-server 192.168.225.3; 指定ftp服务器的ip地址
}
#systemctl start dhcpd
2.安装配置tftp
#yum install tftp-server -y
#vim /etc/xinetd.d/tftp
service tftpd{
...
disable = no
}
#systemctl restart xinted
#netstat -ntupl|grep :69
#mkdir /var/lib/tftpboot/pxelinux.cfg 创建tftpd服务配置文件目录,必须为此名字,不能修改。
#cp /isofile/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinu.cfg/default
#vim /var/lib/tftpboot/pxelinu.cfg/default
default linux 指定默认使用的lable
lable linux
...
append ... ks=ftp://192.168.225.3/ks.cfg 指定ks.cfg的位置
#cp /iso/isolinux/boot.msg /var/lib/tftpboot/pxelinu.cfg/boot.msg 复制欢迎信息
#vim /var/lib/tftpboot/pxelinu.cfg/boot.msg
可以使用
#chmod u+x /var/lib/tftpboot/pxelinu.cfg/default
#chmod u+x /var/lib/tftpboot/pxelinu.cfg/boot.msg
3.复制文件到tftp根目录下
#yum -y install syslinux
#rpm -ql syslinux|grep pxelinux.0
#cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
#cp /isofile/images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/
4.安装ftp并复制光盘文件到ftp根目录下:
#yum install vsftpd -y
#systemctl start vsftpd
#mkdir /var/ftp/iso
#cp -a /isofile/* /var/ftp/iso/
5.配置DNS(可选,主要作用是提供主机名)
#yum install bind -y
#vim /etc/named.conf
options {
listen-on port 53 { any; };
...
allow-query { any; };
zone "test.com" IN {
type master ;
file ‘test.com‘
};
zone "30.168.192.in-addr.arpa" IN {
type master;
file "192.168.225.zone"
};
#cd /etc/named/
#cp -a /var/named/named.localhost test.com
#vim test.com
$TTL 86400
$GENERATE 100-150 system$ A 192.168.225.$
@ IN SOA test.com. (
1
1D
1H
1W
3H
)
NS kick.test.com.
kick A 192.168.225.3
#cp -a test.com 192.168.225.zone
#vim 192.168.225.zone
$TTL 86400
$GENERATE 100-150 system$ PTR system$.test.com.
@ IN SOA test.com (
1
1D
1H
1W
3H
)
NS kick.test.com.
3 PTR kick.test.com.
#rndc-confgen -r /dev/urandom -a
#vim /etc/resovle.conf
nameserver 127.0.0.1
#systemctl start named
6.应答文件
#yum install system-config-kickstart -y
#system-config-kickstart &
#cp ks.cfg /var/ftp/
本文出自 “小私的blog” 博客,请务必保留此出处http://ggvylf.blog.51cto.com/784661/1683176
原文地址:http://ggvylf.blog.51cto.com/784661/1683176