歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> KickStart+PXE+HTTPd+DHCP+TFTP自動安裝Ubuntu 12.04

KickStart+PXE+HTTPd+DHCP+TFTP自動安裝Ubuntu 12.04

日期:2017/2/28 15:48:54   编辑:Linux教程

前言*

KickStart很多運維人員都非常熟悉,我們大多數都用它來實現自動安裝系統,常見的用自動安裝RedHat Linux,最近由於業務需求,需要安裝Ubuntu,跟Redhat Linux還是有一些區別,記錄安裝步驟,供大家相互交流和學習!

一、環境及軟件

系統:CentOS 6.0、Ubuntu 12.04

軟件:KickStart、PXE、HTTPd、TFTPp、DHCP

二、正式安裝

本環境是基於在CentOS系統上搭建KickStart Ubuntu自動安裝服務端。

在服務器端執行:yum install dhcp* tftp* httpd* -y

安裝完後然後配置

1、配置ftfp:

  1. # default: off
  2. # description: The tftp server serves files using the trivial file transfer \
  3. # protocol. The tftp protocol is often used to boot diskless \
  4. # workstations, download configuration files to network-aware printers, \
  5. # and to start the installation process for some operating systems.
  6. service tftp
  7. {
  8. disable = no
  9. socket_type = dgram
  10. protocol = udp
  11. wait = yes
  12. user = root
  13. server = /usr/sbin/in.tftpd
  14. server_args = -s /var/lib/tftpboot
  15. per_source = 11
  16. cps = 100 2
  17. flags = IPv4
  18. }

把disable=yes改成disable=no即可!

安裝完tftp後,默認在/根目錄會生成/tftpboot文件夾,如果沒有請鏈接ln –s /var/lib/tftboot /即可。

掛載ubuntu12.04.iso文件

Mount /dev/cdrom /mnt &&cp /mnt/install/netboot/* /tftboot/下

然後修改vi /tftboot/ubuntu-installer/amd64/boot-screens/txt.cfg如下:

2、配置httpd、kickstart:

正如第二步截圖裡面有一個http://192.9.117.143/ubuntu/ks.cfg

默認安裝完後apache的發布目錄為/var/www/html

在/var/www/html下建立安裝源:

mkdir -p /var/www/html/ubuntu

然後將ubuntu光盤所有文件拷貝到/var/www/html/ubuntu下

cp -a /mnt/* /var/www/html/ubuntu

然後在/var/www/html/ubuntu目錄下新建ks.cfg文件,權限設置為chmod 777 ks.cfg

ks.cfg內容如下:

  1. install
  2. text
  3. lang en_US
  4. langsupport en_US
  5. keyboard us
  6. mouse
  7. timezone --utc Asia/Chongqing
  8. rootpw --disabled
  9. user tdt --fullname="tdt" --password wuguangke
  10. reboot
  11. url --url http://192.9.117.143/ubuntu
  12. bootloader --location=mbr
  13. zerombr yes
  14. clearpart --all --initlabel
  15. part /boot --fstype ext4 --size 200
  16. part swap --size 1024
  17. part / --fstype ext4 --size 1 --grow
  18. auth --useshadow --enablemd5
  19. network --bootproto=dhcp --device=eth0
  20. firewall --disabled
  21. skipx
  22. %packages
  23. penssh-server
  24. openssh-client
  25. nfs-kernel-server
  26. vim
Copyright © Linux教程網 All Rights Reserved