kickstart自动化安装centos6.8

一、系统环境

centos6.8_x86-64,ip地址为192.168.17.26

二、需要安装哪些软件

tftp-server dhcp syslinux rpcbind nfs-utils

三、tftp-server的配置

1、安装软件

# yum install -y tftp-server

2、将配置文件内容改为如下

[root@linux-node3 ~]# cat /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                 = no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
四、dhcp的配置

1、安装dhcp软件

# yum install -y dhcp

2、配置dhcp文件内容如下

[root@linux-node3 ~]# cat /etc/dhcp/dhcpd.conf 
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
#   see 'man 5 dhcpd.conf'
#
next-server 192.168.17.26;
filename "pxelinux.0";
subnet 192.168.17.0 netmask 255.255.255.0 {
  range 192.168.17.230 192.168.17.240;
  option domain-name-servers 192.168.17.2;
}
五、nfs的配置

1、安装nfs软件

# yum install -y rpcbind nfs-utils

2、配置nfs共享目录

[root@linux-node3 ~]# cat /etc/exports 
/data   192.168.17.0/24(rw,sync)
/media  192.168.17.0/24(rw,sync)
六、复制各种文件

1、给tftp建立软链接

ln -s /var/lib/tftpboot/ /

2、拷贝启动文件到tftpboot

# mount /dev/sr0 /media
# cp /usr/share/syslinux/pxelinux.0 /tftpboot/
# cp /media/images/pxeboot/{vmlinuz,initrd.img} /tftpboot/

3、创建pxelinux.cfg文件夹和复制文件到pxelinux.cfg里面

mkdir /tftpboot/pxelinux.cfg
cp /media/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
chmod u+w /tftpboot/pxelinux.cfg/default

4、修改pxelinux.cfg/default配置文件如下

[root@linux-node3 ~]# cat /tftpboot/pxelinux.cfg/default 
default linux
#prompt 1
timeout 600

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 linux
  menu label ^Install or upgrade an existing system
  menu default
  kernel vmlinuz
  append ks=nfs:192.168.17.26:/data/ks.cfg ksdevice=eth0 initrd=initrd.img
label vesa
  menu label Install system with ^basic video driver
  kernel vmlinuz
  append initrd=initrd.img nomodeset
label rescue
  menu label ^Rescue installed system
  kernel vmlinuz
  append initrd=initrd.img rescue
label local
  menu label Boot from ^local drive
  localboot 0xffff
label memtest86
  menu label ^Memory test
  kernel memtest
  append -

5、创建ks.cfg文件

[root@linux-node3 ~]# cat /data/ks.cfg 
#platform=x86, AMD64, 或 Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use NFS installation media
nfs --server=192.168.17.26 --dir=/media
# Root password
rootpw 123456
# System authorization information
auth  --useshadow  --passalgo=sha512
# Use text mode install
text
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# Installation logging level
logging --level=info

key --skip

# Reboot after installation
reboot
# System timezone
timezone  Asia/Shanghai
# 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 swap --fstype="swap" --size=1024
part / --fstype="ext4" --grow --size=1

%packages
@base
@compat-libraries
@core
@debugging
@development
@server-policy
@workstation-policy
python-dmidecode
sgpio
device-mapper-persistent-data
systemtap-client
%end

6、给ks.cfg文件授权

# chmod 777 /data/ks.cfg

其他内容:
ks.cfg文件可以使用system-config-kickstart.noarch这个软件来生成
但是使用这个软件需要图形化界面
方法如下:
安装桌面:

# yum groupinstall "X Window System"
# yum  groupinstall "Desktop"

安装kickstart生成文件

# yum install -y system-config-kickstart
七、自动化安装还没有部署的相关内容

1、主机名
2、ip地址
3、相关的优化
这些东西都可以在ks.cfg配置文件中定义脚本。

八、安装完成后的图片如下

自动化安装中

安装完成后

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值