DHCP+TFTP+SYSLINUX+NFS+KICKSTART
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DHCP+TFTP+SYSLINUX+NFS+KICKSTART相关的知识,希望对你有一定的参考价值。
一.配置dhcp服务
[[email protected] ~]# yum install dhcp -y [[email protected] ~]# cat /etc/dhcp/dhcpd.conf ddns-update-style interim; subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.20 192.168.1.254; option routers 192.168.1.1; option subnet-mask 255.255.255.0; option domain-name-servers 192.168.1.1; option broadcast-address 192.168.1.255; default-lease-time 86400; max-lease-time 172800; next-server 192.168.1.1; ##tftpf服务器地址 filename "pxelinux.0"; ###网络启动 } [[email protected] ~]# service dhcp start
二.配置TFTP
[[email protected] ~]# yum install tftp-server [[email protected] ~]# vim /etc/xintd.d/tftp ##编辑使其打开tftp功能 [[email protected] ~]# cat /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 /var/lib/tftpboot disable= no per_source= 11 cps= 100 2 flags= IPv4 } [[email protected] ~]# service xinitd restart
开启防火墙69/udp
三.配置SYSLINUX
[[email protected] ~]# yum install syslinux [[email protected] ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/ [[email protected] ~]# cp /mnt/images/pxeboot/initrd.img /var/lib/tftpboot/ [[email protected] ~]# cp /mnt/images/pxeboot/vmlinuz /var/lib/tftpboot/ [[email protected] ~]# cp /mnt/isolinux/vesamenu.c32 /var/lib/tftpboot/ [[email protected] ~]# cp /mnt/isolinux/*.msg /var/lib/tftpboot/ [[email protected] ~]# cp /mnt/isolinux/splash.jpg /var/lib/tftpboot/ [[email protected] tftpboot] ll 总用量 38044 -r--r--r--. 1 root root 84 9月 1 04:27 boot.msg -r--r--r--. 1 root root 33383449 9月 1 04:24 initrd.img -rw-r--r--. 1 root root 26828 9月 1 04:23 pxelinux.0 drwxr-xr-x. 2 root root 4096 9月 1 06:18 pxelinux.cfg -r--r--r--. 1 root root 1236005 9月 1 06:25 splash.jpg -r--r--r--. 1 root root 162860 9月 1 04:26 vesamenu.c32 -r-xr-xr-x. 1 root root 4128944 9月 1 04:24 vmlinuz [[email protected] tftpboot]# [[email protected] ~]# mkdir /var/lib/tftpboot/pxelinux.cfg [[email protected] ~]# cp /mnt/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
[[email protected] pxelinux.cfg]# cat default default vesamenu.c32 #prompt 1 timeout 600 display boot.msg menu background splash.jpg menu title Welcome to Red Hat Enterprise Linux 6.5! menu color border 0 #ffffffff #00000000 menu color sel 7 #ffffffff #ff000000 menu color title 0 #ffffffff #00000000 menu color tabmsg 0 #ffffffff #00000000 menu color unsel 0 #ffffffff #00000000 menu color hotsel 0 #ff000000 #ffffffff menu color hotkey 7 #ffffffff #ff000000 menu color scrollbar 0 #ffffffff #00000000 label linux menu label ^Install or upgrade an existing system menu default kernel vmlinuz append ks=nfs:192.168.1.1:/tmp/ks.cfg inst.stage2=nfs:192.168.1.1/systemiso/rhel6 initrd=initrd.img label vesa menu label Install system with ^basic video driver kernel vmlinuz append initrd=initrd.img xdriver=vesa nomodeset label rescue menu label ^Rescue installed system kernel vmlinuz append initrd=initrd.img rescue label local menu label Boot from ^local drive localboot 0xffff label memtest86 menu label ^Memory test kernel memtest append -
四.配置NFS
[[email protected] tftpboot]# cat /etc/exports /systemiso/rhel6 *(rw) /tmp/ *(rw) [[email protected] tftpboot]# [[email protected] ~]# mkdir -p /systemiso/rhel6 [[email protected] ~]# cp -r /mnt/* /systemiso/rhel6 [[email protected] ~]# chmod +r /systemiso/rhel6/* [[email protected] ~]# service nfs start [[email protected] tftpboot]# cat /etc/exports /systemiso/rhel6 *(rw) /tmp/ *(rw)
五.创建kickstart文件
可以使用图形化配置ks.cfg文件 [[email protected] tftpboot]# yum install system-config-kickstart
或者直接使用已经创建好的ks.cfg [[email protected] ~]# cat /tmp/ks.cfg #platform=x86, AMD64, 或 Intel EM64T #version=DEVEL # Firewall configuration firewall --disabled # Install OS instead of upgrade install # Use NFS installation media nfs --server=192.168.110.1 --dir=/systemiso/rhel6 # Root password rootpw --iscrypted $1$eQ/X66iG$5qRmqf/zXbufAREjjaWLv. # System authorization information auth --useshadow --passalgo=sha512 # Use text mode install text 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 Africa/Abidjan # 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 #我给的硬盘8G part /boot --fstype="ext4" --size=500 part / --fstype="ext4" --size=6656 part swap --fstype="swap" --size=1000 %packages @base @compat-libraries %end
最后创建虚拟机,使用网络px启动即可自动安装
本文出自 “TOP-ONE” 博客,请务必保留此出处http://onenice.blog.51cto.com/13201315/1965074
以上是关于DHCP+TFTP+SYSLINUX+NFS+KICKSTART的主要内容,如果未能解决你的问题,请参考以下文章
CentOS7无人值守安装PXE+DHCP+TFTP+SYSLINUX+HTTP+Kickstart
kickstart+DHCP+NFS+TFTP+PXE 全自动化部署Linux系统