kickstart+pxe+httpd+dhcp+tftp自动安装Ubuntu 12.04

简介:

   前言* kickstart很多运维人员都非常熟悉,我们大多数都用它来实现自动安装系统,常见的用自动安装redhat,最近由于业务需求,需要安装Ubuntu,redhat还是有一些区别,记录安装步骤,供大家相互交流和学习!

一、环境及软件

系统:Centos6.0Ubuntu12.04

软件:kickstartpxehttpdtftpdhcp

二、正式安装

本环境是基于在centos系统上搭建kickstart ubuntu自动安装服务端。

在服务器端执行:yum install dhcp* tftp* httpd* -y

安装完后然后配置

1、配置ftfp

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

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、配置httpdkickstart:

正如第二步截图里面有一个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 

3、配置dhcp:

下面贴出我真实环境的DHCP配置内容:

 
  1. ddns-update-style interim;  
  2. ignore client-updates;  
  3. next-server 192.9.117.143;  
  4. filename "pxelinux.0";  
  5. allow booting;  
  6. allow bootp;  
  7. subnet 192.9.117.0 netmask 255.255.255.0 {  
  8. # — default gateway  
  9.  
  10. option routers 192.9.117.254;  
  11.  
  12. option subnet-mask 255.255.255.0;  
  13.  
  14. # option nis-domain “domain.org”;  
  15.  
  16. option domain-name "tdt.com";  
  17.  
  18. option domain-name-servers 202.106.0.20;  
  19.  
  20. option time-offset -18000; # Eastern Standard Time  
  21.  
  22. range 192.9.117.140 192.9.117.160;  
  23. }

三、启动服务

以上所有配置完毕,启动所有相关服务

/etc/init.d/dhcpd  start ;/etc/init.d/xinetd start ;/etc/init.d/httpd start 即可!

四、测试kickstart是否成功

找一台客户机,BIOS修改成网卡启动即可!

安装图集:

这一步需要手动回车,之后就不需要回车了:

格式化磁盘

安装软件包

 参考以下文章,非常感谢!

http://bbs.linuxtone.org/thread-10957-1-1.html 

http://renlixing.blog.51cto.com/731561/326880

http://scmbob.org/kickstart_deploy_ubuntu_server.html


本文转自 wgkgood 51CTO博客,原文链接:http://blog.51cto.com/wgkgood/891152


相关文章
|
21天前
|
Ubuntu NoSQL 关系型数据库
Ubuntu系统下安装常用软件
Ubuntu系统下安装常用软件
42 0
Ubuntu系统下安装常用软件
|
1月前
|
Ubuntu Linux C语言
Ubuntu下安装vscode,并解决终端打不开vscode的问题
Ubuntu下安装vscode,并解决终端打不开vscode的问题
134 0
|
2月前
|
存储 Ubuntu 网络协议
|
1月前
|
Ubuntu Docker 容器
如何在Ubuntu上安装Docker?
【2月更文挑战第10天】
239 0
|
2月前
|
负载均衡 Ubuntu 应用服务中间件
|
23天前
|
Ubuntu 关系型数据库 MySQL
Ubuntu 中apt 安装MySQL数据库
Ubuntu 中apt 安装MySQL数据库
66 0
|
2天前
|
Ubuntu 数据安全/隐私保护
在UBUNTU虚拟机上安装R软件包
在UBUNTU虚拟机上安装R软件包
|
2天前
|
存储 编解码 Ubuntu
0-零基础安装ubuntu(超详细安装步骤)
0-零基础安装ubuntu(超详细安装步骤)
|
3天前
|
Ubuntu Linux 定位技术
手把手教你优雅的安装虚拟机 Ubuntu —— 图文并茂
手把手教你优雅的安装虚拟机 Ubuntu —— 图文并茂
|
17天前
|
Ubuntu Linux 虚拟化
【Linux】ubuntu安装samba服务器
【Linux】ubuntu安装samba服务器