星空网 > 软件开发 > 操作系统

运维自动化工具 Kickstart


简介:

批量安装操作系统工具之 Kickstart ,RedHat 早前推出的产品( 不多说了,现在都玩 Cobbler 啦 )。

测试环境:CentOS 6.6 x86_64 minimal

一、安装软件包

shell > yum -y install dhcp tftp-server syslinux nfs-utils kickstart

二、配置 DHCP

shell > cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.confcp:是否覆盖"/etc/dhcp/dhcpd.conf"? yshell > vim /etc/dhcp/dhcpd.conf# dhcpd.conf# option definitions common to all supported networks...option domain-name-servers 192.168.214.2, 202.106.46.151;# A slightly different configuration for an internal subnet.subnet 192.168.214.0 netmask 255.255.255.0 {range 192.168.214.100 192.168.214.120;option routers 192.168.214.2;option subnet-mask 255.255.255.0;filename "/pxelinux.0";default-lease-time 600;max-lease-time 7200;}

三、配置 tftp

shell > vim /etc/xinetd.d/tftpservice tftp{socket_type = dgramprotocol = udpwait = yesuser = rootserver = /usr/sbin/in.tftpdserver_args = -s /var/lib/tftpbootdisable = no ## 原为 yesper_source = 11cps = 100 2flags = IPv4}

四、pxelinux.0

shell > cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/shell > mount /dev/cdrom /mnt/shell > cp /mnt/isolinux/* /var/lib/tftpboot/shell > cd /var/lib/tftpboot/shell > mkdir pxelinux.cfgshell > mv isolinux.cfg pxelinux.cfg/default

五、配置 NFS

shell > vim /etc/exports/mnt 192.168.0.0/24(ro,sync)

六、最后的调整

shell > chkconfig --add nfsshell > chkconfig --add dhcpdshell > chkconfig --add xinetdshell > chkconfig --add rpcbindshell > chkconfig --level 35 nfs onshell > chkconfig --level 35 dhcpd onshell > chkconfig --level 35 xinetd onshell > chkconfig --level 35 rpcbind onshell > exportfs -arshell > service dhcpd restart关闭 dhcpd: [确定]正在启动 dhcpd: [确定]shell > service xinetd restart停止 xinetd: [确定]正在启动 xinetd: [确定]shell > service rpcbind restart停止 rpcbind: [确定]正在启动 rpcbind: [确定]shell > service nfs restart关闭 NFS 守护进程: [确定]关闭 NFS mountd: [确定]关闭 NFS 服务: [确定]Shutting down RPC idmapd: [确定]启动 NFS 服务: [确定]启动 NFS mountd: [确定]启动 NFS 守护进程: [确定]正在启动 RPC idmapd: [确定]shell > setenforce 0shell > service iptables stop

七、测试 PXE 引导安装

1、客户机设置从网络引导(其实不用设置,本地找不到自然会去网络找),就可以看到安装界面

2、选择语言( Chinese Simplified )

3、OK

4、选择键盘( us )OK

5、选择媒**置( NFS Directory )OK

6、配置网络( 默认即可 )OK

7、设置 NFS 服务( NFS server name: 192.168.214.10 ## NFS 服务器地址
                           CentOS directroy: /mnt ## ISO 存放位置 )OK

8、这里出现正常的安装界面,证明没有问题( 跟光盘安装一模样即可 )

## 这是实现了 PXE 引导安装,想要无人干预还得配置 Kickstart !

八、安装桌面环境

## 以下操作直接在虚拟机中执行,非终端连接 !(不是必要的)

shell > yum grouplist | grep -iP "(x window system|desktop)"DesktopX Winsow System

## 其中搜索出来的这两个包是我们需要安装的。

shell > yum update ## 首先需要更新一下 yumshell > yum -y groupinstall "X Window System"shell > yum -y groupinstall "Desktop"shell > yum -y groupinstall "Chinese Support" ## 安装中文支持shell > init 5

## 现在已经进入桌面环境

1、设置字体(不是必须的)

## 打开终端时,默认显示的字体简直难看到极致,中间还有空格乱入,对处女座来说根本忍不了!

系统--首选项--外观--字体--( 将等宽字体改为 AR PL UKai CN )--确定即可

2、安装软件包 system-config-kickstart

shell > yum -y install system-config-kickstartshell > system-config-kickstart ## 启动 Kickstart 配置程序

## 接下来就全是鼠标点点点啦 !

·基本配置
                 默认语言 :简体中文,也可以默认 ( English )
                 键盘 :默认即可
                 时区 :Asia/Shanghai ,按实际情况来
                 UTC 时钟 :勾选
                 根口令 :123456
                 确认根口令:123456
                 根口令加密:默认是勾上的,不用管

                 高级配置
                       安装后重新引导系统:勾选
·安装方法
                 执行新安装:勾选
                 选择 NFS :
                       NFS 服务器:192.168.214.10
                       NFS 目录 :/mnt ## NFS 共享的 ISO 存放目录
·引导装载程序选项

                 安装类型
                       安装新引导装载程序:勾选
                 安装选项
                       在主引导记录(MBR)上安装引导装载程序
·分区信息
                 主引导记录
                       清除主引导记录:勾选
                 分区
                       删除所有现存分区:勾选
                 磁盘标签
                       初始化磁盘标签:勾选
                 布局
                       添加分区( 跟装真机一样 )
·网络配置
                 添加网络设备--网络设备(eth0)--网络类型(DHCP)--确认即可
·验证
                 默认
·防火墙配置
                 全部禁用
·显示配置
                 安装图形环境:不勾选(如果不想安装的话)
                 禁用
·软件包选择
                 默认
·预安装脚本
                 默认
·安装后脚本
                 默认

选择--文件--保存--(将文件保存到 /root 目录下,文件名为 ks.cfg)

shell > mkdir /nfsdirshell > cp ks.cfg /nfsdirshell > chown 777 /nfsdir/ks.cfgshell > vim /etc/exports/mnt 192.168.214.0/24(ro,sync)/nfsdir 192.168.214.0/24(ro,sync) ## 添加共享目录shell > exportfs -arshell > vim /var/lib/tftpboot/pxelinux.cfg/defaultdefault vesamenu.c32#prompt 1timeout 50display boot.msgmenu background splash.jpgmenu title Welcome to CentOS 6.6!menu color border 0 #ffffffff #00000000menu color sel 7 #ffffffff #ff000000menu color title 0 #ffffffff #00000000menu color tabmsg 0 #ffffffff #00000000menu color unsel 0 #ffffffff #00000000menu color hotsel 0 #ff000000 #ffffffffmenu color hotkey 7 #ffffffff #ff000000menu color scrollbar 0 #ffffffff #00000000label linuxmenu label ^Install or upgrade an existing systemmenu defaultkernel vmlinuzappend ks=nfs:192.168.214.10:/nfsdir/ks.cfg initrd=initrd.imglabel vesamenu label Install system with ^basic video driverkernel vmlinuzappend initrd=initrd.img xdriver=vesa nomodesetlabel rescuemenu label ^Rescue installed systemkernel vmlinuzappend initrd=initrd.img rescuelabel localmenu label Boot from ^local drivelocalboot 0xfffflabel memtest86menu label ^Memory testkernel memtestappend -

## 其中,timeout 50 ( 这个参数原为 600 ,就是一进去系统时那个选择模式的时间,我们不想等待太长时间所以调为 5 秒 )

## 在第一个 label 中加入了:ks=nfs:192.168.214.10:/nfsdir/ks.cfg ( 定义 ks.cfg 路径 )

label linuxmenu label ^Install or upgrade an existing systemmenu defaultkernel vmlinuzappend ks=nfs:192.168.214.10:/nfsdir/ks.cfg initrd=initrd.img

## 下面贴一下 ks.cfg 的文件内容( 不需要修改 )

shell > vim /nfsdir/ks.cfg#platform=x86, AMD64, 或 Intel EM64T#version=DEVEL# Firewall configurationfirewall --disabled# Install OS instead of upgradeinstall# Use NFS installation medianfs --server=192.168.214.10 --dir=/mnt# Root passwordrootpw --iscrypted $1$56NxQt/e$3fz.wnuWl7Ak7q9TIpwl0.# System authorization informationauth --useshadow --passalgo=sha512# Use graphical installgraphical# System keyboardkeyboard us# System languagelang zh_CN# SELinux configurationselinux --disabled# Do not configure the X Window Systemskipx# Installation logging levellogging --level=info# Reboot after installationreboot# System timezonetimezone --isUtc Asia/Shanghai# Network informationnetwork --bootproto=dhcp --device=eth0 --onboot=on# System bootloader configurationbootloader --location=mbr# Clear the Master Boot Recordzerombr# Partition clearing informationclearpart --all --initlabel# Disk partitioning informationpart /boot --fstype="ext4" --size=200part swap --fstype="swap" --size=1024part / --fstype="ext4" --grow --size=1

4、重新启动服务,测试无人值守

## 执行第 六 步操作

## 现在客户机只需开机( 引导方式为网络引导,其实不用设置,自己会去找的),即可 !

## 经测试没问题 !




原标题:运维自动化工具 Kickstart

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

Amazon刷单:https://www.goluckyvip.com/tag/6440.html
各种名牌鞋子标志:https://www.goluckyvip.com/tag/64400.html
感光度标志的国际标准用什么表示:https://www.goluckyvip.com/tag/64403.html
世界遗产标志图的含义:https://www.goluckyvip.com/tag/64407.html
世界非物质文化遗产标志:https://www.goluckyvip.com/tag/64408.html
世界反战标志:https://www.goluckyvip.com/tag/64409.html
丽人丽妆2023年扭亏为盈 玉容初、美壹堂等自有品牌增速超40% :https://www.kjdsnews.com/a/1836576.html
一天拿下10万美金预售!深圳大卖出海第一年成为亚马逊供应商:https://www.kjdsnews.com/a/1836577.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流