标签:dev gre art map cal ann server packages loader
部署kickstart无人值守
环境介绍:使用一台虚拟机模拟DHCP/TFTP/HTTP服务器,虚拟机ip地址为172.16.1.61,网卡为eth0
1.准备环境,确保selinux和iptables关闭
cat /etc/redhat-release
CentOS release 6.8 (Final)
uname -r
2.6.32-642.el6.x86_64
getenforce
Disabled
/etc/init.d/iptables status
iptables: Firewall is not running.
2.部署DHCP服务
yum install -y dhcp
cat >>/etc/dhcp/dhcpd.conf<<EOF
subnet 172.16.1.0 netmask 255.255.255.0 {
range 172.16.1.101 172.16.1.200;
option subnet-mask 255.255.255.0;
default-lease-time 21600;
max-lease-time 43200;
next-server 172.16.1.61;
filename "/pxelinux.0";
}
EOF
/etc/init.d/dhcpd start
echo /etc/init.d/dhcpd start >>/etc/rc.local
netstat -lntup|grep dhcp
3.部署TFTP服务
yum install -y tftp-server
#修改配置文件中 disable = yes 为 no
sed -i ‘14s/no/yes/‘ /etc/xinetd.d/tftp
#配置文件中 server_args = -s /var/lib/tftpboot 指定目录,保持默认,不用修改
/etc/init.d/xinetd start
echo /etc/init.d/xinetd start >>/etc/rc.local
netstat -lntup|grep xinetd
4.配置HTTP服务,yum安装apache服务(没有编译需求)
yum -y install httpd
sed -i "227i ServerName 127.0.0.1:80" /etc/httpd/conf/httpd.conf
/etc/init.d/httpd start
echo /etc/init.d/httpd start >>/etc/rc.local
netstat -lntup|grep httpd
mkdir /var/www/html/centos-6.7 -p
mount /dev/cdrom /var/www/html/centos-6.7/
df -h|grep centos
/dev/sr0 3.7G 3.7G 0 100% /var/www/html/centos-6.7
# /var/www/html 是yum安装apache的html默认路径
# 挂载cdrom时,保证cdrom已经连接,否则会失败
#生产环境不使用挂载光驱(速度有限),而是将镜像复制到 /var/www/html/centos-6.7 目录下
5.配置支持PXE启动程序
安装pxe引导配置syslinux
yum -y install syslinux
复制启动菜单程序文件
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
复制光盘中开机启动菜单等内容
cp -a /var/www/html/centos-6.7/isolinux/* /var/lib/tftpboot/
新建一个pxelinux.cfg的目录
mkdir -p /var/lib/tftpboot/pxelinux.cfg
cp /var/www/html/centos-6.7/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
6.创建ks.cfg文件,阅读kickstart配置文件的手册。用任何一个文本编辑器都可以创建你自己的kickstart配置文件。
cat >>/var/www/html/ks_config/centos-6.7-ks.cfg<<EOF
# Kickstart Configurator for CentOS 6.7 by me
install
url --url="http://172.16.1.61/centos-6.7/"
text
lang en_US.UTF-8
keyboard us
zerombr
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
network --bootproto=dhcp --device=eth0 --onboot=yes --noipv6 --hostname=CentOS6
timezone --utc Asia/Shanghai
authconfig --enableshadow --passalgo=sha512
rootpw --iscrypted $6$n6EHz.alzANnwlZ1$6Ih2fxe.bokADnuFaeRvRdFNo9mYHFpR4C.vvqoByxafiTm4d9F
Zdx2dwW4UaIQbQXX.T3i4e6p.tTA6DDIyu.
clearpart --all --initlabel
part /boot --fstype=ext4 --asprimary --size=200
part swap --size=1024
part / --fstype=ext4 --grow --asprimary --size=200
firstboot --disable
selinux --disabled
firewall --disabled
logging --level=info
reboot
%packages
@base
@compat-libraries
@debugging
@development
tree
nmap
sysstat
lrzsz
dos2unix
telnet
%end
EOF
7.整合编辑default配置文件
vim /var/lib/tftpboot/pxelinux.cfg/default
default ks
prompt 0
label ks
kernel vmlinuz
append initrd=initrd.img ks=http://172.16.1.61/ks_config/centos-6.7-ks.cfg ksdevice=eth0
8.新建一台没有系统的虚拟器,设置eth0网卡与本机模式均为NAT即可,然后开机即可进入自动安装
部署kickstart无人值守
标签:dev gre art map cal ann server packages loader
原文地址:http://www.cnblogs.com/fly-always/p/7231199.html