一 kickstart简介

ks是自动批量安装工具,它可以从网络自动安装操作系统,不需要与用户交互,对于需要安装大批量机器,可以很方便快速的安装和使用。

相关变量参数详解:

%packages   定义需要安装的包裹

%pre        预先安装

%post

ks配置文件详解:

url --url="ftp://xxxx"      指定URL

vnc  --password=redhat

clearpart:  clears the specified partitions before installation.

clearpart --all --drives=sda,sdb --initlabel

part :   specifies the size,format,and name of a partition.

part /home --fstype=ext4 --label=homes --size=4096 --maxsize=8128 --grow

ignoredisk :   ignores the specified disks when installing.

ignoredisk --drives=sdc

bootloader: defines where to install the bootloader.

bootloader --location=mbr -boot-drive=sda

volgroup,logvol: creates lvm volume groups and logical volumes.

part pv.01 --size=8192

volgroup myvg pv.0.1

logvol / --vgname=myvg --fstype=xfs --size=2048 --name=rootvol --grow

Network commands:

#启动网络配置为dhcp

network --device=eth0 --bootproto=dhcp

#启动防火墙

firewall --enabled --service=ssh,cups

#配置语言为utf8

lang en_US.UTF-8

#键盘

keyboard --vckeymap=us --xlayouts='us','us'

timezone --utc  --ntpservers=time.xxx.com Europe/ASIA

#root密码

rootpw --plaintext redhat

selinux --enforcing

services --disabled=network,iptables,ip6tables --enabled=firewalld

group --name=admins --gid=10001

user --name=cw --gecos="chen wei" --groups=admins --password=chenwei --plaintext

loggin --host=www --level=info

firstboot --disabled

检查语法工具:ksvalidator ks.cfg

二 安装配置

1.需要安装的有:

  • Network servers:FTP,HTTP,NFS

  • DHCP/TFTP SERVER

  • USB disk or CDROM

  • local hard disk

2.启动方式:

ks=http://server/dir/file

ks=ftp://server/dir/file

ks=nfs:server/dir/file

ks=cdrom:/dir/file

三  案例

使用system-config-kickstart工具,创建一个配置文件

#############################################################

一  tftp配置用于pxe启动

二  dhcp配置

三  kickstart文件配置

四  yum服务器

通过选择安装不同的linux。

比如:安装rhel6/rhel7等等

=============================================================

一 环境说明:

1.1  环境是

RHEL5.7 64

dhcp服务器 : 要求可以正常分配ip并且指定TFTP服务器

vsftp 服务器 : 用于存放 Yum 仓库

tftp  服务器 : 存放系统安装所需要的引导文件pxelinux.0文件、启动菜单、内核vmlinuz及initrd.img、ks无人值守配置文件ks.cfg

pxelinux.0 pxe专用启动引导文件,/usr/share/syslinux 目录中找到,直接存放在TFTP要目录即可(也可在/etc/dhcpd.conf 指定)

客户端需要

支持PXE启动的网卡

具体过程

建好Yum源,vsftp/PXE 启动的准备工作

二 安装步骤:

2.1 tftp安装配置

cd /var/lib/tftpboot/

[root@chenwei tftpboot]# cp /usr/lib/syslinux/pxelinux.0 .

[root@chenwei tftpboot]# ls

linux-install  pxelinux.0

[root@chenwei tftpboot]# mkdir pexlinux.cfg

[root@chenwei tftpboot]# cp /opt/yum/pub/isolinux/isolinux.cfg pexlinux.cfg/default

[root@chenwei tftpboot]# cp /opt/yum/pub/p_w_picpaths/

boot.iso      diskboot.img  minstg2.img   pxeboot/      README        stage2.img    TRANS.TBL     xen/

[root@chenwei tftpboot]# cp /opt/yum/pub/p_w_picpaths/pxeboot/initrd.img .

[root@chenwei tftpboot]# cp /opt/yum/pub/p_w_picpaths/pxeboot/vmlinuz .

[root@chenwei tftpboot]# ls

initrd.img  linux-install  pexlinux.cfg  pxelinux.0  vmlinuz

[root@chenwei tftpboot]# vi pxelinux.0

initrd.img     linux-install/ pexlinux.cfg/  pxelinux.0     vmlinuz

[root@chenwei tftpboot]# mv pexlinux.cfg pxelinux.cfg

[root@chenwei tftpboot]# vi pxelinux.cfg/default

default linux

prompt 1          #prompt用来设置是否等待用户选择

timeout 6

display boot.msg

F1 boot.msg

F2 options.msg

F3 general.msg

F4 param.msg

F5 rescue.msg

label linux

kernel vmlinuz

append initrd=initrd.img

label text

kernel vmlinuz

append initrd=initrd.img text

label ks

kernel vmlinuz

append ks initrd=initrd.img

label local

localboot 1

label memtest86

kernel memtest

append -

~

~

~

~

~

~

~

~

~

~

[root@chenwei tftpboot]# ls

[root@hb-node2 ~]# vi /etc/xinetd.d/tftp

# default: off

# description: The tftp server serves files using the trivial file transfer \

#       protocol.  The tftp protocol is often used to boot diskless \

#       workstations, download configuration files to network-aware printers, \

#       and to start the installation process for some operating systems.

service tftp

{

socket_type             = dgram

protocol                = udp

wait                    = yes

user                    = root

server                  = /usr/sbin/in.tftpd

server_args             = -s /var/lib/tftpboot

disable                 = yes

per_source              = 11

cps                     = 100 2

flags                   = IPv4

}

~

~

~

~

~

~

[root@hb-node2 ~]# service xinetd restart

Stopping xinetd: [FAILED]

Starting xinetd: [  OK  ]

[root@hb-node2 ~]#

2.2 yum install dhcp

2.3 配置dhcp

[root@chenwei tftpboot]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf

cp: overwrite `/etc/dhcpd.conf'? y

[root@chenwei tftpboot]#

[root@chenwei tftpboot]# cat /etc/dhcpd.conf

ddns-update-style interim;

ignore client-updates;

subnet 192.168.1.0 netmask 255.255.255.0 {

# --- default gateway

option routers                  192.168.1.1;

option subnet-mask              255.255.255.0;

#       option nis-domain               "domain.org";

#       option domain-name              "domain.org";

option domain-name-servers      192.168.1.1;

option time-offset              -18000; # Eastern Standard Time

#       option ntp-servers              192.168.1.1;

#       option netbios-name-servers     192.168.1.1;

# --- Selects point-to-point node (default is hybrid). Don't change this unless

# -- you understand Netbios very well

#       option netbios-node-type 2;

allow booting;

allow bootp;

next-server 192.168.1.99;   #指定tftp服务器

filename "/pxelinux.0";    #指定启动文件

range dynamic-bootp 192.168.1.80 192.168.1.90;  #分配IP地址

default-lease-time 21600;

max-lease-time 43200;

# we want the nameserver to appear at a fixed address

host ns {

next-server marvin.redhat.com;

hardware ethernet 12:34:56:78:AB:CD;

fixed-address 207.175.42.254;

}

}

[root@chenwei tftpboot]#

[root@chenwei tftpboot]# service dhcpd restart

Starting dhcpd: [  OK  ]

三 编辑kickstart文件

[root@chenwei tftpboot]# yum install system-config-kickstart

[root@chenwei ~]# more /opt/yum/ks.cfg

#platform=x86, AMD64, or Intel EM64T

# System authorization information

key --skip

auth  --useshadow  --enablemd5

# System bootloader configuration

bootloader --location=mbr

# Partition clearing information

clearpart --none

# Use graphical install

graphical

# Firewall configuration

firewall --disabled

# Run the Setup Agent on first boot

firstboot --disable

# System keyboard

keyboard us

# System language

lang en_US

# Installation logging level

logging --level=info

# Use network installation

url --url=ftp://192.168.1.99/pub

# Network information

network --bootproto=dhcp --device=eth0 --onboot=on

#Root password

rootpw --iscrypted $1$ykHcHjmI$2TnvnafG2p1LyRi3Lpod3/

# SELinux configuration

selinux --enforcing

# System timezone

timezone  America/New_York

# Install OS instead of upgrade

install

# X Window System configuration information

xconfig  --defaultdesktop=GNOME --depth=8 --resolution=640x480

# Disk partitioning information

clearpart --all --initlabel   #clear all data

part /boot --bytes-per-inode=4096 --fstype="ext3" --size=100

part swap --bytes-per-inode=4096 --fstype="swap" --size=2048

part / --bytes-per-inode=4096 --fstype="ext3" --grow --size=1

%packages

@admin-tools

@base

@core

@development-libs

@development-tools

@mysql

@network-server

@openfabrics-enterprise-distribution

@server-cfg

@x-software-development

@base-x

[root@chenwei ~]#

四 yum服务器 ----参考其它配置

[root@chenwei ~]# cd /opt/yum/pub/

[root@chenwei pub]# ls

Cluster         README-or.html         RELEASE-NOTES-ml.html     RELEASE-NOTES-U7-ml.html

ClusterStorage  README-pa.html         RELEASE-NOTES-mr.html     RELEASE-NOTES-U7-mr.html

EULA            README-pt_BR.html      RELEASE-NOTES-or.html     RELEASE-NOTES-U7-or.html

eula.en_US      README-ru.html         RELEASE-NOTES-pa.html     RELEASE-NOTES-U7-pa.html

GPL             README-si.html         RELEASE-NOTES-pt_BR.html  RELEASE-NOTES-U7-pt_BR.html

p_w_picpaths          README-ta.html         RELEASE-NOTES-ru.html     RELEASE-NOTES-U7-ru.html

isolinux        README-te.html         RELEASE-NOTES-si.html     RELEASE-NOTES-U7-si.html

README-as.html  README-zh_CN.html      RELEASE-NOTES-ta.html     RELEASE-NOTES-U7-ta.html

README-bn.html  README-zh_TW.html      RELEASE-NOTES-te.html     RELEASE-NOTES-U7-te.html

README-de.html  RELEASE-NOTES-as.html  RELEASE-NOTES-U7-as.html  RELEASE-NOTES-U7-zh_CN.html

README-en       RELEASE-NOTES-bn.html  RELEASE-NOTES-U7-bn.html  RELEASE-NOTES-U7-zh_TW.html

README-en.html  RELEASE-NOTES-de.html  RELEASE-NOTES-U7-de.html  RELEASE-NOTES-zh_CN.html

README-es.html  RELEASE-NOTES-en       RELEASE-NOTES-U7-en       RELEASE-NOTES-zh_TW.html

README-fr.html  RELEASE-NOTES-en.html  RELEASE-NOTES-U7-en.html  repodata

README-gu.html  RELEASE-NOTES-es.html  RELEASE-NOTES-U7-es.html  RPM-GPG-KEY-redhat-beta

README-hi.html  RELEASE-NOTES-fr.html  RELEASE-NOTES-U7-fr.html  RPM-GPG-KEY-redhat-release

README-it.html  RELEASE-NOTES-gu.html  RELEASE-NOTES-U7-gu.html  Server

README-ja.html  RELEASE-NOTES-hi.html  RELEASE-NOTES-U7-hi.html  TRANS.TBL

README-kn.html  RELEASE-NOTES-it.html  RELEASE-NOTES-U7-it.html  VT

README-ko.html  RELEASE-NOTES-ja.html  RELEASE-NOTES-U7-ja.html

README-ml.html  RELEASE-NOTES-kn.html  RELEASE-NOTES-U7-kn.html

README-mr.html  RELEASE-NOTES-ko.html  RELEASE-NOTES-U7-ko.html

[root@chenwei pub]#

转载于:https://blog.51cto.com/chenwei/1841989

学习笔记 十八: kickstart相关推荐

  1. python3.4学习笔记(十八) pycharm 安装使用、注册码、显示行号和字体大小等常用设置...

    python3.4学习笔记(十八) pycharm 安装使用.注册码.显示行号和字体大小等常用设置 Download JetBrains Python IDE :: PyCharm http://ww ...

  2. windows内核开发学习笔记十八:IRP 处理的标准模式

    windows内核开发学习笔记十八:IRP 处理的标准模式 在 Windows 内核中的请求基本上是通过 I/O Request Packet 完成的. I/O manager ---> Dis ...

  3. Polyworks脚本开发学习笔记(十八)-用SDK开发Polyworks插件

    Polyworks脚本开发学习笔记(十八)-用SDK开发Polyworks插件 插件是由PolyWorks加载的动态链接库(DLL文件),然后查询Polyworks模块,以确定它们具有哪些功能,提供给 ...

  4. 学习笔记(十八):MoRe-Fi用深度学习网络从非线性信号中恢复呼吸波形

    <MoRe-Fi: Motion-robust and Fine-grained Respiration Monitoring via Deep-Learning UWB Radar>学习 ...

  5. 【D3D11游戏编程】学习笔记十八:模板缓冲区的使用、镜子的实现

    (注:[D3D11游戏编程]学习笔记系列由CSDN作者BonChoix所写,转载请注明出处:http://blog.csdn.net/BonChoix,谢谢~) 模板缓冲区(Stencil Buffe ...

  6. three.js学习笔记(十八)——调整材质

    介绍 到现在为止,我们都在创建新的着色器材质,但是如果我们想要修改一个Three.js内置的材质呢?或许我们对MeshStandardMaterial的处理结果感到满意,但是希望往里边添加顶点动画. ...

  7. 【theano-windows】学习笔记十八——混合蒙特卡洛采样

    #前言 继续之前的Theano学习,本次主要学习混合蒙特卡洛(Hybrid Monte-Carlo Sampling)采样算法. 国际惯例,参考网址 Hybrid Monte-Carlo Sampli ...

  8. JavaScript权威设计--事件冒泡,捕获,事件句柄,事件源,事件对象(简要学习笔记十八)...

    1.事件冒泡与事件捕获 2.事件与事件句柄   3.事件委托:利用事件的冒泡技术.子元素的事件最终会冒泡到父元素直到跟节点.事件监听会分析从子元素冒泡上来的事件. 事件委托的好处:     1.每个函 ...

  9. JSTL标签引入(web基础学习笔记十八)

    一.JSTL包下载和引入 1.0.简介 JSTL全名为JavaServer Pages Standard Tag Library 1.1.下载包 下载地址:http://archive.apache. ...

最新文章

  1. 分享memcache和memcached安装过程
  2. Mysql中varchar类型的猫腻!
  3. mysql是哪五个字符集_MySQL中涉及的几个字符集
  4. 远程桌面提示:身份验证错误 要求的函数不受支持
  5. ios开发跳转safari_iOS 跳转网页的四种方法
  6. 中国餐馆过程(Chinese restaurant process)
  7. 鸿蒙渊之后是什么任务,都说这次主线好,那我来唱唱反调吧
  8. 全国省份、城市、地区全数据(SQL版与XML版)包括各城市邮编
  9. 如何才能招募更多合伙人?合伙人裂变的核心是什么?
  10. 【原创】Proton在Android上的编译
  11. c语言程序改错:求两个整数的最小公倍数,【C语言】求两个整数的最大公约数、最小公倍数...
  12. 前端技术周刊 2018-08-06:ES Module
  13. 机器视觉入门资料大全
  14. VBM后的双样本t检验
  15. Mstar的Monitor方案OSD 菜单制作(二)————主体架构
  16. 特写:美国B2C网站惨淡经营
  17. ubuntu+svn+apache配置
  18. 信息化赋能,打造数字化董事会
  19. linux的垃圾箱是哪个文件夹,Ubuntu命令行的垃圾箱Trash CLI,远离 rm 命令误删除重要文件的阴影...
  20. 用SVG技术实现动态图形输出的嵌入式Web服务

热门文章

  1. Redis的安装过程步骤
  2. 计算机科学与技术范文,计算机科学与技术专业(范文).doc
  3. python做软件测试需要那些条件_做软件测试需要学什么
  4. graphics | 基础绘图系统(八)——棘状图、符号图、多边形(路径)图、Cohen-Friendly关联图、条件密度图...
  5. python thread模块_【Python@Thread】thread模块
  6. sendmsg返回值_[求助]怎么处理sendmessage的返回值
  7. 怎么查电脑系统版本_查中考分数线小程序功能更新,填志愿必备参考
  8. 本科生如何系统地学习前端开发?
  9. C 语言传递数组给函数的三种形式
  10. 汇编语言:程序如下,编写code段中的代码,将a段和b段中的数据一次相加,结果放到c段中