本文共 2910 字,大约阅读时间需要 9 分钟。
1.第一台用光盘把一台安装好(或者自己的笔记本有一个SUSE接到网络里)
2.将ISO上传到root目录下 3.将自己autoinst.xml或者用现成的autoinst.xml 放到root目录(/root目录下本来有一个) 4.将一下脚本susepxe.sh上传到root目录 5.修改一下脚本里的网段参数 6.再执行sh susepxe.sh, 其他机器网络启动即可 #!/bin/bash # prepare: # a server installed suse 11 sp2 # ISO of suse # autoinst.xml # this script # usage: # modify this script's line between 18 ~ 26 # make this parameter correct # description: # this server is a dhcp(PXE) server and tftp server and vsftp srever # dhcp use local_eth as dhcp enthernet interface # other machines in the broadcast using pxe boot will use the autoinstfile and install suse paralel # if you want paralel and automation ,you can modify the xml . # # isofile='/root/SLES-11-SP2-DVD-x86_64-GM-DVD1.iso' autoxmlfilename='my_autoinst.xml' autoxml="/root/${autoxmlfilename}" local_eth='br0' local_ip='10.5.101.17' local_netmask='255.255.255.0' local_network='10.5.101.0' local_range1='10.5.101.150' local_range2='10.5.101.200' mount_path="/media" if [ ! -f $isofile ] ;then echo $isofile is not exist! fi if [ ! -f $autoxml ] ;then echo $autoxml is not exist! fi backup(){ local file1=$1 [ ! -f ${file1}.bak ] && cp -rf ${file1}{,.bak} } restore(){ local file1=$1 [ -f ${file1}.bak ] && cp -rf ${file1}{.bak,} } # mount iso install(){ mkdir -p $mount_path mount -t iso9660 -o loop $isofile $mount_path cd ${mount_path}/suse/x86_64 #install rpm rpm -ivh dhcp* rpm -ivh syslinux* rpm -ivh tftp* rpm -ivh vsftpd* #restore and bakcup #modify dhcp `restore /etc/dhcpd.conf` `backup /etc/dhcpd.conf` cat >> /etc/dhcpd.conf << EOF default-lease-time 14400; ddns-update-style none; next-server $local_ip; filename "pxelinux.0"; subnet $local_network netmask $local_netmask { range $local_range1 $local_range2; default-lease-time 14400; max-lease-time 172800; } EOF `restore /etc/sysconfig/dhcpd` `backup /etc/sysconfig/dhcpd` sed -i "s/DHCPD_INTERFACE=\"\"/DHCPD_INTERFACE=\"${local_eth}\"/" /etc/sysconfig/dhcpd service dhcpd restart #tftp `restore /etc/xinetd.d/tftp` `backup /etc/xinetd.d/tftp` perl -p -i -e "s/yes/no/ if /disable/ " /etc/xinetd.d/tftp service xinetd restart # prepare tftp file mkdir -p /tftpboot/ mkdir -p /tftpboot/pxelinux.cfg cp -rf ${mount_path}/boot/x86_64/loader/initrd /tftpboot/ cp -rf ${mount_path}/boot/x86_64/loader/linux /tftpboot/ cp -rf /usr/share/syslinux/pxelinux.0 /tftpboot/ touch /tftpboot/pxelinux.cfg/default > /tftpboot/pxelinux.cfg/default cat >> /tftpboot/pxelinux.cfg/default <<EOF default linux lable linux kernel linux append initrd=initrd autoyast=ftp://${local_ip}/${autoxmlfilename} install=ftp://${local_ip}/suse/ splash=verbose showopts EOF mkdir -p /srv/ftp/ cp -rf $autoxml /srv/ftp/ cd /srv/ftp mkdir suse -p umount $mount_path mount -t iso9660 -o loop $isofile /srv/ftp/suse/ service vsftpd restart } uninstall(){ service vsftpd stop service dhcpd stop } install本文转自 guowang327 51CTO博客,原文链接:http://blog.51cto.com/guowang327/1957116,如需转载请自行联系原作者