centos6.3+tftp+dhcp+httpd
系统环境:centos6.3*64
setenforce 0 关闭 selinux
service iptables stop 关闭iptables
1 挂载镜像
mount /dev/cdrom /mnt
cp -rf /mnt/* /var/www/html/
yum install -y httpd* tftp-server-* xinetd-* system-config-kickstart-* syslinux dhcp* 安装必备软件
配置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 /tftpboot #开机必需的程序路径(根据的tftpboot路径更改)
disable = yes #把这边的yes改为no
per_source = 11
cps = 100 2
flags = IPv4
}
mkdir /tftpboot
2 创建tftp目录
cp /usr/share/syslinux/pxelinux.0 /tftpboot/
cp /mnt/p_w_picpaths/pxeboot/initrd.img /tftpboot/
cp /mnt/p_w_picpaths/pxeboot/initrd.img /tftpboot/
cp /mnt/isolinux/*.msg /tftpboot/ #开机引导文件
mkdir /tftpboot/pexlinux.cfg
cp /mnt/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
拷贝相关文件
3 配置 DHCP server
vim /etc/dhcp/dhcpd.conf
ddns-update-style interim; ignore client-updates; next-server 192.168.1.4; #tftp server 的ip地址 filename "/pxelinux.0"; subnet 192.168.1.0 netmask 255.255.255.0 { option routers 192.168.1.1;#路由地址 option subnet-mask 255.255.255.0; range dynamic-bootp 192.168.1.50 192.168.1.100; default-lease-time 21600; max-lease-time 43200; }
vim /etc/httpd/conf/httpd.conf
找到 #ServerName www.example.com:80 这一行 ,把注释去掉
4 配置ks.cfg
桌面环境 运行命令 system-config-kickstart 配置ks.cfg 并拷贝到 /var/www/html 下
修改 ks.cfg
例子如下
#platform=x86, AMD64, 或 Intel EM64T #version=DEVEL # Firewall configuration firewall --disabled # Install OS instead of upgrade install # Use network installation url --url="http://192.168.1.4/" # Root password rootpw --iscrypted $1$e8wRnTe1$eaeL5kK6Zi8MllGrUtCNk. # System authorization information auth --useshadow --passalgo=sha512 # Use graphical install graphical firstboot --disable # System keyboard keyboard us # System language lang zh_CN # SELinux configuration selinux --disabled # Installation logging level logging --level=info reboot # System timezone timezone Asia/Shanghai # Network information network --bootproto=dhcp --device=eth0 --onboot=on # System bootloader configuration bootloader --location=mbr # Clear the Master Boot Record zerombr # Partition clearing information clearpart --all # Disk partitioning information part /boot --fstype="ext4" --size=200 part swap --fstype="swap" --size=256 part / --fstype="ext4" --size=10000 part /usr/local --fstype="ext4" --size=10000 %packages
chmod -R 777 /tftpboot/
5
vim /tftpboot/pxelinux.cfg/default
default linux prompt 0 timeout 10 display boot.msg F1 boot.msg F2 options.msg F3 general.msg F4 param.msg F5 rescue.msg label linux kernel vmlinuz append initrd=initrd.img ks=http://192.168.1.4/ks.cfg #http地址,可以通过web访问验证 label text kernel vmlinuz append initrd=initrd.img text label ks kernel vmlinuz append ks initrd=initrd.img label local localboot 1 label memtest86 kernel memtest append -
启动服务
service httpd restart
service xinetd restart
service dhcpd restart
chkconfig httpd on
chkconfig xinetd on
chkconfig dhcpd on