您的位置:首页 > 运维架构 > Linux

Linux centos PXE无人值守安装 DHCP+TFTP+FTP+Kickstart

2016-02-28 17:28 429 查看
网络模式:NAT模式(共享主机的IP地址)DHCP / TFTP IP:192.168.220.137HTTP / FTP / NFS IP:192.168.220.137环境搭建:yum install -y tftp-server dhcp system-config-kickstart vsftp xinetd syslinux1.挂载ISO文件然后把光盘中的文件拷贝至/var/ftp/pub中mount /dev/cdrom /media/CentOS/cp -Rf /media/CentOS/* /var/ftp/pub/2. a.将initrd.img pxelinux.0 vmlinuz 拷贝至 /tftpboot目录中mkdir /tftpbootchmod 777 -Rf /tfrpboot/cp /media/CentOS/isolinux/initrd.img /tftpbootcp /media/CentOS/isolinux/vmlinuz /tftpbootcp /usr/share/syslinux/pxelinux.0 /tftpboot ##找到pxelinux.0 文件 (find / -name pxelinux.0)b.将default文件放在/tftpboot/pxelinux.cfg/下mkdir /tftpboot/pxelinux.cfg/cp /var/ftp/pub/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
配置文件参数:1.vi /etc/dhcp/dhcpd.confddns-update-style interim;ignore client-updates;
subnet 192.168.220.0 netmask 255.255.255.0 {
allow booting;
allow bootp;
allow unknown-clients;
option routers 192.168.222.137;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.220.2;
option time-offset -18000; # Eastern Standard Time
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;
range dynamic-bootp 192.168.220.140 192.168.220.150;
default-lease-time 21600;
max-lease-time 43200;
next-server 192.168.220.137;
filename "pxelinux.0";
}
2.vi /etc/xinetd.d/tftp# default: off# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
3.vi /etc/vsftp/vsftpd.conf
无需改动
4.vi /tftpboot/pxelinux.cfg/default default linuxprompt 1
timeout 30
label linux
kernel vmlinuz
append initrd=initrd.img ks=ftp://192.168.220.137/ks.cfg
5.在桌面环境下配置Kickstart启动X Windows 环境startx配置Kickstartvim /var/ftp/ks.cfg
#platform=x86, AMD64, 或 Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
url --url="ftp://192.168.220.137/pub"
# Root password
rootpw --iscrypted $1$CpoBgXT7$AzEBGDew56m/vIUoIH7SU.
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone Asia/Chongqing
# 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 --initlabel
# Disk partitioning information
part /boot --fstype="ext4" --size=100
part swap --fstype="swap" --size=512
part / --fstype="ext4" --grow --size=1
%packages
@debugging
@legacy-unix
@network-file-system-client
@web-server

%end
测试:servcei iptables stopsetenforce 0service dhcpd startservice xinetd startservice vsftpd start以上可完成PXE无人值守安装操作系统错误:如果出现error downloading Kickstart file 解决:/var/ftp/ks.cfg 权限问题 或者 路径问题
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  dhcp ftp pxe