鸟在笼中,恨关羽不能张飞;Survival of the fittest
分类: LINUX
2015-01-14 10:23:50
由于这边大部分是redhat,所以在安装PXE服务器的时候需要有些更改。Centos不需要更新源。 首先是编辑源文件 mv /etc/yum.repos.d/rhel-debuginfo.repo /etc/yum.repos.d/rhel-debuginfo.repo.bak vi /etc/yum.repos.d/rhel-debuginfo.repo [base] name=Red Hat Enterprise Linux 5 -Base baseurl= gpgcheck=1 [update] name=Red Hat Enterprise Linux 5 -Updates baseurl= gpgcheck=1 [extras] name=Red Hat Enterprise Linux 5 -Extras baseurl= gpgcheck=1 [addons] name=Red Hat Enterprise Linux 5 -Addons baseurl= gpgcheck=1 rpm --import 然后是安装需要的程序 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. install text url --url lang en_US.UTF-8 keyboard us network --device eth0 --bootproto dhcp --onboot=on rootpw aaaaaa firewall --enabled --port=22:tcp --port=22:tcp authconfig --enableshadow --enablemd5 selinux --disabled timezone Asia/Shanghai reboot bootloader --location=mbr --driveorder=sda --append="rhgb quiet" clearpart --all --initlabel --drives=sda part / --fstype ext3 --size=10000 --ondisk=sda part 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-x keyutils kexec-tools iscsi-initiator-utils trousers fipscheck device-mapper-multipath perl-Convert-ASN1 imake audit 编辑完成后,把相关的启动文件cp到tftp目录里。 cp /usr/share/syslinux/pxelinux.0 /tftpboot cd /var/www/html/rh57/isolinux cp vmlinuz /tftpboot/ cp initrd.img /tftpboot/ cp boot.* /tftpboot/ cp isolinux.cfg /tftpboot/pexlinux.cfg/default 编辑default文件 default ks prompt 1 timeout 600 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 label text kernel vmlinuz append initrd=initrd.img text label local localboot 1 label memtest86 kernel memtest append - label ks kernel vmlinuz append ks= initrd=initrd.img 最后启动相关服务,可以用ps来检查一下是否启动 service httpd restart service dhcpd restart service xinetd restart 需要安装系统的服务器只是开机、网络启动即可。