本文共 3421 字,大约阅读时间需要 11 分钟。
由于这边大部分是redhat,所以在安装PXE服务器的时候需要有些更改。Centos不需要更新源。首先是编辑源文件mv /etc/yum.repos.d/rhel-debuginfo.repo /etc/yum.repos.d/rhel-debuginfo.repo.bakvi /etc/yum.repos.d/rhel-debuginfo.repo[base]name=Red Hat Enterprise Linux 5 -Basebaseurl=http://mirrors.163.com/centos/5/os/$basearch/gpgcheck=1[update]name=Red Hat Enterprise Linux 5 -Updatesbaseurl=http://mirrors.163.com/centos/5/updates/$basearch/gpgcheck=1[extras]name=Red Hat Enterprise Linux 5 -Extrasbaseurl=http://mirrors.163.com/centos/5/extras/$basearch/gpgcheck=1[addons]name=Red Hat Enterprise Linux 5 -Addonsbaseurl=http://mirrors.163.com/centos/5/addons/$basearch/gpgcheck=1rpm --import http://mirrors.163.com/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5然后是安装需要的程序 yum install dhcp httpd tftp-server syslinux接着是编辑各程序的配置文件DHCP: cat /etc/dhcpd.conf ddns-update-style interim;ignore client-updates;subnet 10.0.7.0 netmask 255.255.255.0 {# --- default gateway option routers 10.0.7.77; option subnet-mask 255.255.255.0; option time-offset -18000; filename "pxelinux.0"; next-server 10.0.7.77; range dynamic-bootp 10.0.7.80 10.0.7.200; default-lease-time 21600; max-lease-time 43200;}TFTP:这里就是把disable改成no,然后创建目录/tftpboot/pxelinux.cfg/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 /tftpboot disable = no per_source = 11 cps = 100 2 flags = IPv4}完成这些后在/vqr/www/html下创建文件夹rh57。 然后把iso文件mount上。mount -o loop /root/rh57.iso /var/www/html/rh57现在就开始编辑自动应答文件ks.cfg#Kickstart file automatically generated by anaconda.installtexturl --url http://10.0.7.77/rh57lang en_US.UTF-8keyboard usnetwork --device eth0 --bootproto dhcp --onboot=onrootpw aaaaaafirewall --enabled --port=22:tcp --port=22:tcpauthconfig --enableshadow --enablemd5selinux --disabledtimezone Asia/Shanghairebootbootloader --location=mbr --driveorder=sda --append="rhgb quiet"clearpart --all --initlabel --drives=sdapart / --fstype ext3 --size=10000 --ondisk=sdapart swap --size=1600 --ondisk=sda#part /opt --fstype ext3 --size=100 --grow --ondisk=sda%packages@admin-tools@base@core@development-libs@development-tools@editors@graphical-internet@legacy-network-server@legacy-software-development@legacy-software-support@network-server@server-cfg@system-tools@base-xkeyutilskexec-toolsiscsi-initiator-utilstrousersfipscheckdevice-mapper-multipathperl-Convert-ASN1imakeaudit编辑完成后,把相关的启动文件cp到tftp目录里。cp /usr/share/syslinux/pxelinux.0 /tftpbootcd /var/www/html/rh57/isolinuxcp vmlinuz /tftpboot/cp initrd.img /tftpboot/cp boot.* /tftpboot/cp isolinux.cfg /tftpboot/pexlinux.cfg/default编辑default文件default ksprompt 1timeout 600display boot.msgF1 boot.msgF2 options.msgF3 general.msgF4 param.msgF5 rescue.msglabel linux kernel vmlinuz append initrd=initrd.imglabel text kernel vmlinuz append initrd=initrd.img textlabel local localboot 1label memtest86 kernel memtest append -label ks kernel vmlinuz append ks=http://10.0.7.77/ks57.cfg initrd=initrd.img最后启动相关服务,可以用ps来检查一下是否启动service httpd restartservice dhcpd restartservice xinetd restart需要安装系统的服务器只是开机、网络启动即可。
转载于:https://blog.51cto.com/9a383637/1608654