[基礎]RHEL6下LINUX伺服器批量部署 包準備:xinetd,tftp-server,dhcp,httpd,system-config-kickstart,syslinux,nfs實驗環境:本機地址:192.168.46.98本地網關:192.168.46.254配置DHCP伺服器:Sample: subnet 192.168.46.0 netmask 255.255.255.0 { range 192.168.46.100 192.168.46.105; option routers 192.168.46.254; default-lease-time 600; max-lease-time 7200; next-server 192.168.46.98; /*指向tftp伺服器*/ filename="pxelinux.0"; } /*ftp根目錄的相對路徑*/參考檔案:ddns-update-style interim; /*dhcp支援的dns動態更新方式*/ignore client-updates; /*忽略用戶端DNS動態更新*/authoritative; /*授權*/allow booting; /*支援PXE啟動*/allow bootp; /*支援boottp*/subnet 192.168.129.0 netmask 255.255.255.0 { /*範圍*/range 192.168.129.30 192.168.129.78; /*ip位址區段範圍*/option routers 192.168.129.1; /*網關*/option subnet-mask 255.255.255.0; /*子網路遮罩*/option domain-name-servers 203.103.24.68; /*DNS伺服器的地址*/default-lease-time 21600; /*租期,秒數*/max-lease-time 43200; /*最大租期,秒數*/next-server 192.168.129.22; /*TFTPServer的IP*/filename "/pxelinux.0"; /*Bootstrap檔案*/掛載系統光碟片到 /mnt配置TFTP根目錄(tftpboot)# cp /mnt/images/pxeboot/vmlinuz /mnt/images/pxeboot/initrd.img /var/lib/tftpboot# cp /mnt/isolinux/boot.msg /mnt/isolinux/splash.jpg /var/lib/tftpboot# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/# mkdir /var/lib/tftpboot/pxelinux.cfg# cp -p /media/cdrom/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/defaultTFTP下default配置# vi /var/lib/tftpboot/pxelinux.cfg/defaultdefault linux#prompt 1timeout 600display boot.msgmenu background splash.jpgmenu title Welcome to Red Hat Enterprise Linux 6.4!menu color border 0 #ffffffff #00000000menu color sel 7 #ffffffff #ff000000menu color title 0 #ffffffff #00000000menu color tabmsg 0 #ffffffff #00000000menu color unsel 0 #ffffffff #00000000menu color hotsel 0 #ff000000 #ffffffffmenu color hotkey 7 #ffffffff #ff000000menu color scrollbar 0 #ffffffff #00000000label local localboot 0label linux kernel vmlinuz append initrd=initrd.img devfs=nomount ks=http://192.168.46.98/ks.cfg NFS共用目錄配置# vi /etc/exports/mnt 192.168.46.0/255.255.255.0(ro,sync)配置Kickstart檔案ks.cfg# cd /var/www/html# vi ks.cfg#platform=x86, AMD64, or Intel EM64T#version=DEVEL# Firewall configurationfirewall --enabled --ssh# Install OS instead of upgradeinstall# Use NFS installation medianfs --server=192.168.46.98 --dir=/mnt# Root password#rootpw --iscrypted $1$kC9vxUwe$l.U7ZGNt9Yjcvt2YHy3J50# System authorization informationauth --useshadow --passalgo=sha512# Use text mode installtext# System keyboardkeyboard us# System languagelang en_US# SELinux configurationselinux --disabled# Do not configure the X Window Systemskipx# Installation logging levellogging --level=info# Reboot after installationreboot# System timezonetimezone --isUtc Asia/Shanghai# Network informationnetwork --bootproto=dhcp --device=eth0 --onboot=on# System bootloader configurationbootloader --location=mbr# Clear the Master Boot Recordzerombr# Partition clearing informationclearpart --all --initlabel# Disk partitioning informationpart /boot --asprimary --fstype="ext4" --size=128part swap --asprimary --fstype="swap" --size=2048part / --asprimary --fstype="ext4" --size=8000part /data --asprimary --fstype="ext4" --size=1%packages@base@chinese-support%end 開啟服務tftp包含於xinetd中,所以要進入設定檔中開啟# vi /etc/xinetd.d/tftpservice 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}開啟# service dhcpd start# service xinetd start# service httpd start# service nfs start