转自:http://www.mamicode.com/info-detail-1646465.html

kickstart用于在内网自动安装系统。

使用pxe安装系统需要安装dhcp,tftp,http等服务(当然也可以使用其他文件共享方式比如nfs,ftp)。

实验环境:

1. vmware 12

2.网段 10.0.0/8, PXE服务器IP:10.0.0.100

一、安装dhcp服务

可以选择安装isc-dhcp-Server 或者 dnsmasq(这个在openstack中使用较多,而且它也包含tftp服务,配置也非常方便,我因为已经安装dhcp和tftp就懒得换了)。

我选择安装了isc-dhcp-Server:   apt-get install isc-dhcp-Server -y

vim /etc/default/isc-dhcp-server

INTERFACES="eth0"    # 或者你要指定的网络接口名字。

vim /etc/dhcp/dhcpd.conf

在文件末尾添加:

subnet 10.0.0.0 netmask 255.0.0.0 {
  range 10.0.0.101 10.0.0.200;
  option subnet-mask 255.0.0.0;
  option routers 10.0.0.100;
  option broadcast-address 10.255.255.255;
  filename "pxelinux.0";
  next-server 10.0.0.100;
}

子网,掩码可以根据自己的需要设置

filename "pxelinux.0";
next-server 10.0.0.100;    指定pxe启动文件名和ip地址,next-server也是指tftp服务器IP。

配置完重启服务:

service isc-dhcp-server restart

二、安装tftp服务

apt-get install tftpd-hpa -y

安装完就OK了,使用默认的即可,记得tftp的目录是 /var/lib/tftpboot/ 哦,后面要用到!

三、安装apache2

apt-get install apache2 -y

也是安装完就可以了,http根目录是 /var/www/html/ 。

将下载好的ubuntu-14.04.5-server-amd64.iso放到某个目录。比如 ~ 目录,然后如下操作;

cd ~

mkdir /var/www/html/ubuntu

mount ubuntu-14.04.5-server-amd64.iso /var/www/html/ubuntu      或者 mount ubuntu-14.04.5-server-amd64.iso /media  然后 cp -r * /media/* /var/www/html/ubuntu

cp -r /var/www/html/ubuntu/install/netboot/*   /var/lib/tftpboot/

cp /var/www/html/ubuntu/preseed/ubuntu-server.seed /var/www/html/

然后 vim /var/www/html/ubuntu-server.seed

在文件末尾添加:

d-i live-installer/net-image string http://10.0.0.100/ubuntu/install/filesystem.squashfs

因为在ubuntu12.10版本以后,安装一些包会依赖于预配置的文件系统,这就是导致使用kickstart方式无法成功安装的原因。

四、安装kickstart

kickstart需要GUI界面,我因为是安装的server,所以需要安装桌面(如果是desktop版本就不需要),如下安装;

apt-get install ubuntu-desktop system-config-kickstart -y

安装完之后,重启一下进入桌面,直接startx在虚拟机里卡桌面。

kickstart界面操作很简单,实验过一遍就知道主要还是ks.cfg。如果vm的界面较小,需要远程的话,可以安装xrdp, vnc4server, 然后vim ~/.xsession 输入:xfc4-session

这里就不多说了,搜索一下就很多远程ubuntu的文章。

在界面操作完之后保存ks.cfg到/var/www/html/

ks.cfg 内容如下:

#Generated by Kickstart Configurator
#platform=AMD64 or Intel EM64T #System language
lang en_US
#Language modules to install
langsupport en_US
#System keyboard
keyboard us
#System mouse
mouse
#System timezone
timezone --utc Asia/Shanghai
#Root password
rootpw --disabled
#Initial user
user trait --fullname "trait" --iscrypted --password $1$Umx1cgrj$..pRArN7AP66XBosYbU4N1
#Reboot after installation
reboot
#Use text mode install
text
#Install OS instead of upgrade
install
#Use Web installation
url --url http://10.0.0.100/ubuntu
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel
#Disk partitioning information
part / --fstype ext4 --size 1024 --asprimary --ondisk sda
part swap --size 800 --ondisk sda
#System authorization infomation
auth --useshadow --enablemd5
#Firewall configuration
firewall --disabled
#Do not configure the X Window System
skipx
%packages
openssh-server
%post

然后修改一下 vim /var/lib/tftpboot/ubuntu-installer/amd64/boot-screens/txt.cfg:

default install
label install
menu label ^Install
menu default
kernel ubuntu-installer/amd64/linux
append ks=http://10.0.0.100/ks.cfg preseed/url=http://10.0.0.100/ubuntu-server.seed vga=788 initrd=ubuntu-installer/amd64/initrd.gz --- quiet
label cli
menu label ^Command-line install
kernel ubuntu-installer/amd64/linux
append tasks=standard pkgsel/language-pack-patterns= pkgsel/install-language-support=false vga=788 initrd=ubuntu-installer/amd64/initrd.gz --- quiet

ok,现在可以创建一个空的虚拟机来验证安装了。

测试结果基本成功,几个注意点:

1. 由于我用的服务器是虚拟机,并且是桥接方式,ip:192.168.0.220, 所以测试用的服务器也要用桥接方式
2. 修改virtualbox的默认网段10.x.x.x为桥接网络地址192.168.0.0/24,服务机和测试机都要改
3. 怀疑我的镜像是损坏过的,安装到一半提示镜像可能出错
4. 安装过程中提示要我写nameserver,需要修正一下配置
 
 
 
 
centos上搞pxe+kickstart
 
 

ubuntu14.04部署kickstart的更多相关文章

  1. [原创]ubuntu14.04部署ELK+redis日志分析系统

    ubuntu14.04部署ELK+redis日志分析系统 [环境] host1:172.17.0.4 搭建ELK+redis服务 host2:172.17.0.3 搭建logstash+nginx服务 ...

  2. ubuntu14.04 部署nfs服务

    安装nfs服务 apt-get install nfs-kernel-server 修改配置文件,共享目录为/var/www,*号可替换为客户端IP地址,*默认为任何部署了nfs客户端的IP可以挂载该 ...

  3. Ubuntu14.04部署pyspider的过程

    1.安装,安装官方文档,应该先执行 sudo apt-get install python python-dev python-distribute python-pip libcurl4-opens ...

  4. 阿里云 Ubuntu14.04 部署 LAMP

    1.更新软件源 sudo apt-get update 2.安装Apache sudo apt-get install apache2 3.查看Apache是否安装成功 apache2 –v 如下所示 ...

  5. Ubuntu14.04 Django Mysql安装部署全过程

    Ubuntu14.04 Django Mysql安装部署全过程   一.简要步骤.(阿里云Ubuntu14.04) Python安装 Django Mysql的安装与配置 记录一下我的部署过程,也方便 ...

  6. ubuntu14.04下nodejs + npm + bower的安装、调试和部署

      1. 简介 本文介绍ubuntu14.04下nodejs+npm+bower的安装.调试和部署 参考文档 https://docs.npmjs.com/getting-started https: ...

  7. PXE+kickstart自动安装ubuntu14.04

    本文参考了诸多文章,先感谢这些文章的作者. 使用pxe安装系统需要安装dhcp,tftp,http等服务(当然也可以使用其他文件共享方式比如nfs,ftp). 实验环境: 1. vmware 12 2 ...

  8. 使用openshit在ubuntu14.04下一键部署openstack(juno版本)

    一.基本介绍 本实验是在vmware workstation上虚拟机ubuntu14.04(64bit,desktop)上部署openstack(Juno版本).采用的工具是openshit.open ...

  9. Ubuntu14.04下Mongodb(离线安装方式|非apt-get)安装部署步骤(图文详解)(博主推荐)

    不多说,直接上干货! 说在前面的话  首先,查看下你的操作系统的版本. root@zhouls-virtual-machine:~# cat /etc/issue Ubuntu LTS \n \l r ...

随机推荐

  1. 关于Redis的常识

    原文出自:http://blog.jobbole.com/44476/ 版本:V3.0.2 2013-7-13 (江南白衣版权所有,转载请保留出处) 1. Overview 1.1 资料 <Th ...

  2. linux: cat more less tail head查看文件内容

  3. 109. Convert Sorted List to Binary Search Tree (List; Divide-and-Conquer, dfs)

    Given a singly linked list where elements are sorted in ascending order, convert it to a height bala ...

  4. 少一些套路,多一些真诚 ——groovy消灭表现层套路

      初次认识groovy是在2009年,当时看了Manning出版的<Groovy in Action 1st Edition>,对groovy这个语言的交互性shell,以及灵活的语法留 ...

  5. Unix进程特性

    本篇文章主要总结分享记录一下运维工作中经常打交道的Unix进程.程序是代码的集合,而进程是运行中的程序产生的.那么进程都有那些特性呢?且看下文,部分经典且难懂的地方,使用python代码实现,可以让读 ...

  6. 万能头文件#include<bits/stdc++.h>

    最近在打cf时赛后翻阅别人的代码总是会发现一个陌生而奇怪的头文件#include<bits/stdc++.h> 奇怪之处就在于基本上所有的代码只要用了这个头文件就不再写其他头文件了. 百度 ...

  7. noi2729 Blah数集

    Blah数集 大数学家高斯小时候偶然间发现一种有趣的自然数集合Blah,对于以a为基的集合Ba定义如下: (1) a是集合Ba的基,且a是Ba的第一个元素: (2)如果x在集合Ba中,则2x+1和3x ...

  8. 洛谷 P3659 [USACO17FEB]Why Did the Cow Cross the Road I G

    //神题目(题目一开始就理解错了)... 题目描述 Why did the cow cross the road? Well, one reason is that Farmer John's far ...

  9. RobotFramework学习-问题

    RobotFramework,基于Python的自动化测试框架.近期学习中遇到过一些问题. 1.运行ride时,报错[ ERROR ] option --monitorcolors not recog ...

  10. configparser模块读写ini配置文件

    在自动化测试过程中,为了提高脚本的可读性和降低维护成本,将一些通用信息写入配置文件,将重复使用的方法写成公共模块进行封装,使用时候直接调用即可. 这篇博客,介绍下python中利用configpars ...