Kickstart无人值守安装

简介:

Kickstart无人值守安装操作系统

1.      什么是PXE?

他是一种引导方式.全称pre-bootexecution environment.通过网络接口启动计算机,不依赖本地存储设备(如硬盘)或本地已安装的操作系统;

一篇博客:http://www.zyops.com/autoinstall-kickstart

  1. 无人值守安装

总共分几个部分:

·        安装桌面:yum install –y “Desktop” “XWindow System”

·        安装httpd: yum install –y httpd

·        挂载ISO镜像文件,拷贝镜像文件到/var/www/html

·        Tftp-server配置:yum install –y tftp-server

Vi /etc/xinetd.d/tftp-server文件,修改disable值为no; server_args   = -s/tftpboot ;重启xinetd:service xinetd restart

建立/tftpboot目录,复制pxelinux.0文件到他下面.

Cp /usr/share/syslinux/pxelinux.0  /tftpboot/ 注意:如果这里找不到pxelinux.0文件需要我们安装syslinux

下面我们还需要复制另外3个文件到/tftpboot下面:

Cp /var/www/html/images/pxeboot/initrd.img  /tfptboot

Cp /var/www/html/images/pxeboot/vmlinuz   /tfptboot

Cp /var/www/html/isolinx/* /tfptboot

/tfptboot下面建立一个目录:

Mkdir  -p/tfptboot/pxelinux.cfg

复制文件isolinux.cfgpxelinux.cfg:

Cp /var/www/html/isolinux/isolinux.cfg  /tftpboot/pxelinux.cfg/default

这里我们需要修改/tftpboot/pxelinux.cfg/default文件黄色标注的值为被改过的值:

#default text ks = http://192.168.42.130/abc/ks.cfg

#default vesamenu.c32

defaultks

#prompt 1

#timeout 600

timeout1

 

display boot.msg

 

menu background splash.jpg

menu title Welcome to CentOS 6.8!

menu color border 0 #ffffffff #00000000

menu color sel 7 #ffffffff #ff000000

menu color title 0 #ffffffff #00000000

menu color tabmsg 0 #ffffffff #00000000

menu color unsel 0 #ffffffff #00000000

menu color hotsel 0 #ff000000 #ffffffff

menu color hotkey 7 #ffffffff #ff000000

menu color scrollbar 0 #ffffffff #00000000

 

labelks

  menu label ^Installor upgrade an existing system

  menu default

  kernel vmlinuz

  appendinitrd=initrd.img ks=http://192.168.42.130/abc/ks.cfg

label vesa

  menu label Installsystem with ^basic video driver

  kernel vmlinuz

  appendinitrd=initrd.img nomodeset

label rescue

  menu label ^Rescueinstalled system

  kernel vmlinuz

  appendinitrd=initrd.img rescue

label local

  menu label Boot from^local drive

  localboot 0xffff

label memtest86

  menu label ^Memorytest

  kernel memtest

  append -

  • Dhcp配置:yum install dhcp –y 注意:新建的VM需要使用NAT模式

编辑配置文件:vi/etc/dhcp/dhcpd.conf

#

# DHCP Server Configuration file.

#   see/usr/share/doc/dhcp*/dhcpd.conf.sample

#   see 'man 5dhcpd.conf'

ddns-update-style interim;

log-facility local7;

ignore client-updates;

next-server192.168.42.130;  tftp-server服务器地址

filename"/pxelinux.0"; PXE启动文件

subnet 192.168.42.0 netmask 255.255.255.0 {

  range dynamic-bootp192.168.42.100 192.168.42.200;

  optiondomain-name-servers 192.168.42.2;

  option routers192.168.42.2;

  option subnet-mask255.255.255.0;

  default-lease-time21600;

  max-lease-time72000;

}

  • kickstart配置:记录人工干预填写的各个参数,生成ks.cfg文件.首先需要我们安装包:yuminstall –y system-config-kickstart之后执行这个命令即可.

Pxe配置:

spacer.gif

 

#platform=x86, AMD64, or Intel EM64T

#version=DEVEL

# Firewall configuration

firewall --disabled

# Install OS instead of upgrade

install

# Use network installation

url--url="http://192.168.42.130/OS"

# Root password

rootpw --iscrypted $1$LdXzG2rY$1ojDCc5//hi5EhFpp.E/z0

# System authorization information

auth  --useshadow  --passalgo=sha512

# Use graphical install

graphical

firstboot --disable

# System keyboard

keyboard us

# System language

lang en_US

# SELinux configuration

selinux --enforcing

# Installation logging level

logging --level=info

 

# System timezone

timezone America/Los_Angeles

# Network information

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

# System bootloader configuration

bootloader --location=mbr

# Clear the Master Boot Record

zerombr

# Partition clearing information

clearpart --all --initlabel

# Disk partitioning information

part / --fstype="ext4" --size=50000

part /boot --fstype="ext4" --size=256

part /home --fstype="ext4" --grow --size=1

 

%post--interpreter=/bin/bash

echo "kickstart">/root/testok.txt

%end

 

  1. 报错:

Could not find kernel image text

spacer.gif

这个的根本原因是/tfptboot/pxelinux.cfg/default配置错误,正确的配置如下:

#default text ks = http://192.168.42.130/abc/ks.cfg

#default vesamenu.c32

default ks

#prompt 1

#timeout 600

timeout 1

 

display boot.msg

 

menu background splash.jpg

menu title Welcome to CentOS 6.8!

menu color border 0 #ffffffff #00000000

menu color sel 7 #ffffffff #ff000000

menu color title 0 #ffffffff #00000000

menu color tabmsg 0 #ffffffff #00000000

menu color unsel 0 #ffffffff #00000000

menu color hotsel 0 #ff000000 #ffffffff

menu color hotkey 7 #ffffffff #ff000000

menu color scrollbar 0 #ffffffff #00000000

 

label ks

  menu label ^Installor upgrade an existing system

  menu default

  kernel vmlinuz

  appendinitrd=initrd.img ks=http://192.168.42.130/abc/ks.cfg

label vesa

  menu label Installsystem with ^basic video driver

  kernel vmlinuz

  appendinitrd=initrd.img nomodeset

label rescue

  menu label ^Rescueinstalled system

  kernel vmlinuz

  appendinitrd=initrd.img rescue

label local

  menu label Boot from^local drive

  localboot 0xffff

label memtest86

  menu label ^Memorytest

  kernel memtest

  append -

 

 










本文转自chenzudao51CTO博客,原文链接:http://blog.51cto.com/victor2016/1949502 ,如需转载请自行联系原作者




相关文章
|
存储 网络协议 Linux
搭建PXE实现Kickstart无人值守安装(一)
1、搭建PXE远程安装服务器 2、实现kicstart无人值守安装
搭建PXE实现Kickstart无人值守安装(一)
|
安全 Linux 网络安全
搭建PXE实现Kickstart无人值守安装(二)
1、搭建PXE远程安装服务器 2、实现kicstart无人值守安装
搭建PXE实现Kickstart无人值守安装(二)
|
Linux 网络安全 开发工具
cobbler 无人值守-安装
环境准备 准备两台主机,如centos6和centos7 centos7当作server服务器 关闭selinux 关闭防火墙 安装 cobbler包光盘里是没有的,要配置epel源,这里就说怎么配置epel源了,在yum.
1191 0
|
Web App开发 Linux Apache
|
数据安全/隐私保护
|
开发工具 数据安全/隐私保护

热门文章

最新文章