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

运维 系统运维
随着使用ubuntu系统的用户越来越多,对于一台PC机安装ubuntu系统来说并不是难事,但是如果对于企业里新增的几十台几十台服务器,一台一台安装,实在是太累,通过以下方法,很容易在1小时内将60台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系统的知识还有待于读者去探索和学习。

【编辑推荐】

  1. 使用Bootmgr引导Ubuntu实例
  2. Ubuntu10.10里如何安装中文man?
  3. Ubuntu系统安装drcom出现error的解决方法
  4. Ubuntu将在数据中心服务器上占据一席之地
  5. ubuntu系统与windowsXP互相远程连接的方法
责任编辑:韩亚珊 来源: 之秀网
相关推荐

2020-12-29 11:04:57

Linux安装系统RedHat

2011-10-09 13:16:50

LNMP生产服务器自动安装

2021-01-11 13:27:55

无人机通信技术

2010-01-05 17:32:40

安装Ubuntu

2010-01-06 15:45:12

2010-01-06 16:51:33

2010-01-07 13:31:30

Ubuntu samb

2011-08-30 17:25:23

Ubuntu

2009-12-29 08:54:09

Ubuntu CUDA

2011-02-21 10:42:34

PostfixLinuxsetup

2010-06-09 09:33:41

Opensuse硬盘

2010-06-09 11:05:48

Opensuse安装m

2010-09-14 14:01:55

ubuntu tftp

2020-12-16 10:25:40

UbuntuLinuxXFCE

2020-12-18 08:55:20

Python火车票代码

2018-06-07 11:00:27

NFVSDN部署

2010-02-07 14:09:57

Ubuntu open

2021-03-03 14:50:55

安全自动化机器学习网络安全

2023-08-02 15:33:27

2009-11-10 10:29:56

GetDeb快速安装Ubuntu应用
点赞
收藏

51CTO技术栈公众号