linux运维平台工具,Linux运维自动化工具 Kickstart
簡(jiǎn)介:
批量安裝操作系統(tǒng)工具之 Kickstart ,RedHat 早前推出的產(chǎn)品( 不多說了,現(xiàn)在都玩 Cobbler 啦,見 http://www.linuxidc.com/Linux/2016-04/129977.htm?)。
測(cè)試環(huán)境: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.conf
cp:是否覆蓋"/etc/dhcp/dhcpd.conf"? y
shell > 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/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no ## 原為 yes
per_source = 11
cps = 100 2
flags = 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.cfg
shell > mv isolinux.cfg pxelinux.cfg/default
五、配置 NFS
shell > vim /etc/exports
/mnt 192.168.0.0/24(ro,sync)
六、最后的調(diào)整
shell > chkconfig --add nfs
shell > chkconfig --add dhcpd
shell > chkconfig --add xinetd
shell > chkconfig --add rpcbind
shell > chkconfig --level 35 nfs on
shell > chkconfig --level 35 dhcpd on
shell > chkconfig --level 35 xinetd on
shell > chkconfig --level 35 rpcbind on
shell > exportfs -ar
shell > service dhcpd restart
關(guān)閉 dhcpd: [確定]
正在啟動(dòng) dhcpd: [確定]
shell > service xinetd restart
停止 xinetd: [確定]
正在啟動(dòng) xinetd: [確定]
shell > service rpcbind restart
停止 rpcbind: [確定]
正在啟動(dòng) rpcbind: [確定]
shell > service nfs restart
關(guān)閉 NFS 守護(hù)進(jìn)程: [確定]
關(guān)閉 NFS mountd: [確定]
關(guān)閉 NFS 服務(wù): [確定]
Shutting down RPC idmapd: [確定]
啟動(dòng) NFS 服務(wù): [確定]
啟動(dòng) NFS mountd: [確定]
啟動(dòng) NFS 守護(hù)進(jìn)程: [確定]
正在啟動(dòng) RPC idmapd: [確定]
shell > setenforce 0
shell > service iptables stop
七、測(cè)試 PXE 引導(dǎo)安裝
1、客戶機(jī)設(shè)置從網(wǎng)絡(luò)引導(dǎo)(其實(shí)不用設(shè)置,本地找不到自然會(huì)去網(wǎng)絡(luò)找),就可以看到安裝界面
2、選擇語言( Chinese Simplified )
3、OK
4、選擇鍵盤( us )OK
5、選擇媒體位置( NFS Directory )OK
6、配置網(wǎng)絡(luò)( 默認(rèn)即可 )OK
7、設(shè)置 NFS 服務(wù)( NFS server name: 192.168.214.10 ## NFS 服務(wù)器地址
CentOS directroy: /mnt ## ISO 存放位置 )OK
8、這里出現(xiàn)正常的安裝界面,證明沒有問題( 跟光盤安裝一模樣即可 )
## 這是實(shí)現(xiàn)了 PXE 引導(dǎo)安裝,想要無人干預(yù)還得配置 Kickstart !
八、安裝桌面環(huán)境
## 以下操作直接在虛擬機(jī)中執(zhí)行,非終端連接 !(不是必要的)
shell > yum grouplist | grep -iP "(x window system|desktop)"
Desktop
X Winsow System
## 其中搜索出來的這兩個(gè)包是我們需要安裝的。
shell > yum update ## 首先需要更新一下 yum
shell > yum -y groupinstall "X Window System"
shell > yum -y groupinstall "Desktop"
shell > yum -y groupinstall "Chinese Support" ## 安裝中文支持
shell > init 5
## 現(xiàn)在已經(jīng)進(jìn)入桌面環(huán)境
1、設(shè)置字體(不是必須的)
## 打開終端時(shí),默認(rèn)顯示的字體簡(jiǎn)直難看到極致,中間還有空格亂入,對(duì)處女座來說根本忍不了!
系統(tǒng)--首選項(xiàng)--外觀--字體--( 將等寬字體改為 AR PL UKai CN )--確定即可
2、安裝軟件包 system-config-kickstart
shell > yum -y install system-config-kickstart
shell > system-config-kickstart ## 啟動(dòng) Kickstart 配置程序
## 接下來就全是鼠標(biāo)點(diǎn)點(diǎn)點(diǎn)啦 !
·基本配置
默認(rèn)語言 :簡(jiǎn)體中文,也可以默認(rèn) ( English )
鍵盤 :默認(rèn)即可
時(shí)區(qū) :Asia/Shanghai ,按實(shí)際情況來
UTC 時(shí)鐘 :勾選
根口令 :123456
確認(rèn)根口令:123456
根口令加密:默認(rèn)是勾上的,不用管
高級(jí)配置
安裝后重新引導(dǎo)系統(tǒng):勾選
·安裝方法
執(zhí)行新安裝:勾選
選擇 NFS :
NFS 服務(wù)器:192.168.214.10
NFS 目錄 :/mnt ## NFS 共享的 ISO 存放目錄
·引導(dǎo)裝載程序選項(xiàng)
安裝類型
安裝新引導(dǎo)裝載程序:勾選
安裝選項(xiàng)
在主引導(dǎo)記錄(MBR)上安裝引導(dǎo)裝載程序
·分區(qū)信息
主引導(dǎo)記錄
清除主引導(dǎo)記錄:勾選
分區(qū)
刪除所有現(xiàn)存分區(qū):勾選
磁盤標(biāo)簽
初始化磁盤標(biāo)簽:勾選
布局
添加分區(qū)( 跟裝真機(jī)一樣 )
·網(wǎng)絡(luò)配置
添加網(wǎng)絡(luò)設(shè)備--網(wǎng)絡(luò)設(shè)備(eth0)--網(wǎng)絡(luò)類型(DHCP)--確認(rèn)即可
·驗(yàn)證
默認(rèn)
·防火墻配置
全部禁用
·顯示配置
安裝圖形環(huán)境:不勾選(如果不想安裝的話)
禁用
·軟件包選擇
默認(rèn)
·預(yù)安裝腳本
默認(rèn)
·安裝后腳本
默認(rèn)
選擇--文件--保存--(將文件保存到 /root 目錄下,文件名為 ks.cfg)
shell > mkdir /nfsdir
shell > cp ks.cfg /nfsdir
shell > chown 777 /nfsdir/ks.cfg
shell > vim /etc/exports
/mnt 192.168.214.0/24(ro,sync)
/nfsdir 192.168.214.0/24(ro,sync) ## 添加共享目錄
shell > exportfs -ar
shell > vim /var/lib/tftpboot/pxelinux.cfg/default
default vesamenu.c32
#prompt 1
timeout 50
display boot.msg
menu background splash.jpg
menu title Welcome to CentOS 6.6!
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.214.10:/nfsdir/ks.cfg initrd=initrd.img
label vesa
menu label Install system with ^basic video driver
kernel vmlinuz
append initrd=initrd.img xdriver=vesa 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 -
## 其中,timeout 50 ( 這個(gè)參數(shù)原為 600 ,就是一進(jìn)去系統(tǒng)時(shí)那個(gè)選擇模式的時(shí)間,我們不想等待太長(zhǎng)時(shí)間所以調(diào)為 5 秒 )
## 在第一個(gè) label 中加入了:ks=nfs:192.168.214.10:/nfsdir/ks.cfg ( 定義 ks.cfg 路徑 )
label linux
menu label ^Install or upgrade an existing system
menu default
kernel vmlinuz
append ks=nfs:192.168.214.10:/nfsdir/ks.cfg initrd=initrd.img
## 下面貼一下 ks.cfg 的文件內(nèi)容( 不需要修改 )
shell > vim /nfsdir/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.214.10 --dir=/mnt
# Root password
rootpw --iscrypted $1$56NxQt/e$3fz.wnuWl7Ak7q9TIpwl0.
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
graphical
# System keyboard
keyboard us
# System language
lang zh_CN
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone --isUtc 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 /boot --fstype="ext4" --size=200
part swap --fstype="swap" --size=1024
part / --fstype="ext4" --grow --size=1
4、重新啟動(dòng)服務(wù),測(cè)試無人值守
## 執(zhí)行第 六 步操作
## 現(xiàn)在客戶機(jī)只需開機(jī)( 引導(dǎo)方式為網(wǎng)絡(luò)引導(dǎo),其實(shí)不用設(shè)置,自己會(huì)去找的),即可 !
## 經(jīng)測(cè)試沒問題 !
使用PXE+DHCP+Apache+Kickstart無人值守安裝CentOS5.8 x86_64 http://www.linuxidc.com/Linux/2012-12/76913p4.htm
Linux PXE無人值守安裝出現(xiàn) PXE-E32:TFTP OPen timeout的解決辦法 http://www.linuxidc.com/Linux/2014-03/98986.htm
RHCE認(rèn)證之無人值守安裝Linux系統(tǒng)(FTP+TFTP+DHCP+Kickstart+PXE) http://www.linuxidc.com/Linux/2013-10/91013.htm
總結(jié)
以上是生活随笔為你收集整理的linux运维平台工具,Linux运维自动化工具 Kickstart的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MathCAD求解方程组
- 下一篇: linux服务器下降,linux - 远