实现快速全自动Ubuntu批量安装的步骤

随着使用ubuntu系统的用户越来越多,对于一台PC机安装ubuntu系统来说并不是难事,但是如果对于企业里新增的几十台几十台服务器,一台一台安装,实在是太累,通过以下方法,很容易在1小时内将60台ubuntu系统安装好。

环境:

192.168.5.112dhcpserver,Ubuntu10.04

192.168.5.150-200dhcpclient,pxeboot

所有配置在192.168.5.112上进行

1.安装dnsmasq

  
  
  
  
  1. apt-getinstalldnsmasq 

2.配置dnsmasq

  
  
  
  
  1. vi/etc/dnsmasq.conf  
  2.  
  3. bogus-priv  
  4.  
  5. filterwin2k  
  6.  
  7. interface=eth0 
  8.  
  9. dhcp-range=192.168.5.150,192.168.5.250,12h  
  10.  
  11. dhcp-boot=pxelinux.0  
  12.  
  13. enable-tftp  
  14.  
  15. tftp-root=/var/ftpd  
  16.  
  17. dhcp-authoritative 

3.安装apache2并建立相关目录

  
  
  
  
  1. apt-getinstallapache2  
  2.  
  3. mkdir/var/www/Ubuntu  
  4.  
  5. mount-oloop~/Ubuntu10.04.iso/mnt  
  6.  
  7. cp/mnt/preseed/Ubuntu-server.seed/var/www/ubuntu  
  8.  
  9. cp-a/mnt/*/var/www/Ubuntu  
  10.  
  11. cp-r/mnt/install/netboot/*/var/ftpd/ 

4.修改pxe配置

  
  
  
  
  1. vi/var/ftpd/pxelinux.cfg/default  
  2.  
  3. labellinux  
  4.  
  5. kernelUbuntu-installer/amd64/linux  
  6.  
  7. appendks=http://192.168.5.112/Ubuntu/ks.cfgpreseed/url=http://192.168.5.112/ubuntu/ubuntu-server.seedvga=normalinitrd=ubuntu-installer/amd64/initrd.gz– 

5.修改ks.cfg

  
  
  
  
  1. viks.cfg  
  2.  
  3. #Systemlanguage  
  4.  
  5. langen_US  
  6.  
  7. #Languagemodulestoinstall  
  8.  
  9. langsupporten_US  
  10.  
  11. #Systemkeyboard  
  12.  
  13. keyboardus  
  14.  
  15. #Systemmouse  
  16.  
  17. mouse  
  18.  
  19. #Systemtimezone  
  20.  
  21. timezoneAsia/Chongqing  
  22.  
  23. #Rootpassword  
  24.  
  25. rootpw–disabled  
  26.  
  27. #Initialusergaojinbo/gaojinbo.com  
  28.  
  29. usergaojinbo–fullname"gaojinbo.com"–iscrypted–password$1$YKmaOIb5$/13bs7gCjaoH./ohFT0A7/  
  30.  
  31. #Rebootafterinstallation  
  32.  
  33. reboot  
  34.  
  35. #Usetextmodeinstall  
  36.  
  37. text  
  38.  
  39. #InstallOSinsteadofupgrade  
  40.  
  41. install  
  42.  
  43. #UseWebinstallation  
  44.  
  45. url–urlhttp://192.168.5.112/ubuntu  
  46.  
  47. #Systembootloaderconfiguration  
  48.  
  49. bootloader–location=mbr 
  50.  
  51. #CleartheMasterBootRecord  
  52.  
  53. zerombryes  
  54.  
  55. #Partitionclearinginformation  
  56.  
  57. clearpart–all–initlabel  
  58.  
  59. #Diskpartitioninginformation  
  60.  
  61. part/–fstypeext4–size10000  
  62.  
  63. partswap–size5000  
  64.  
  65. auth–useshadow–enablemd5  
  66.  
  67. #network–bootproto=dhcpdevice=eth0 
  68.  
  69. network–bootproto=staticip=192.168.5.168–netmask=255.255.255.0–gateway=192.168.5.112–nameserver=221.5.88.88–device=eth0 
  70.  
  71. firewall–disabled  
  72.  
  73. skipx  
  74.  
  75. %packages  
  76.  
  77. @openssh-server 

注:

生成密码

echogaojinbo.com|opensslpasswd-1-stdin

6.修改Ubuntu-server.seed配置

  
  
  
  
  1. viUbuntu-server.seed  
  2.  
  3. #SuggestLVMbydefault.  
  4.  
  5. d-ipartman-auto/init_automatically_partitionstringsome_device_lvm  
  6.  
  7. d-ipartman-auto/init_automatically_partitionseenfalse  
  8.  
  9. #Alwaysinstalltheserverkernel.  
  10.  
  11. d-ibase-installer/kernel/override-imagestringlinux-server  
  12.  
  13. #InstalltheUbuntuServerseed.  
  14.  
  15. taskseltasksel/force-tasksstringserver  
  16.  
  17. #Onlyinstallbasiclanguagepacks.Lettaskselaskabouttasks.  
  18.  
  19. d-ipkgsel/language-pack-patternsstring  
  20.  
  21. #Nolanguagesupportpackages.  
  22.  
  23. d-ipkgsel/install-language-supportbooleanfalse  
  24.  
  25. #OnlyasktheUTCquestionifthereareotheroperatingsystemsinstalled.  
  26.  
  27. d-iclock-setup/utcbooleanfalse  
  28.  
  29. d-iclock-setup/ntpbooleanfalse  
  30.  
  31. d-iapt-setup/use_mirrorbooleanfalse  
  32.  
  33. d-inetcfg/get_ipaddressstring127.0.0.1  
  34.  
  35. d-imirror/http://hostnamestring127.0.0.1  
  36.  
  37. d-iapt-setup/restrictedbooleanfalse  
  38.  
  39. #Nobootsplashscreen.  
  40.  
  41. d-idebian-installer/splashbooleanfalse  
  42.  
  43. #Installthedebconfoem-configfrontend(ifinOEMmode).  
  44.  
  45. d-ioem-config-udeb/frontendstringdebconf  
  46.  
  47. #Addthenetworkandtasksoem-configstepsbydefault.  
  48.  
  49. oem-configoem-config/stepsmultiselectlanguage,timezone,keyboard,user,network,tasks 

7.重启dnsmasq

  
  
  
  
  1. /etc/init.d/dnsmasqrestart 

很简单吧,7个步骤完成!

总结:

全自动Ubuntu批量安装,1小时安装60台,步骤简单,大家可以自己动手操作一下。希望本文能够对大家有所帮助,更多有关linux系统的知识还有待于读者去探索和学习。


你可能感兴趣的:(实现快速全自动Ubuntu批量安装的步骤)