无人值守自动装机

前端之家收集整理的这篇文章主要介绍了无人值守自动装机前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。


系统Centos6.5x86_64

ip:192.168.1.201

测试所需设备:(注意自己的dhcp网段修改,还有ip地址)

1.DHCP服务器

2.TFTP服务器

3.KickStart所生成的ks.cfg配置文件

4.一台存放系统安装文件的服务器,如NFS、HTTP或FTP服务器,本文选择HTTP进行

5.带有一个PXE支持网卡的将安装的主机

1、安装相应的软件包

# yum install httpd tftp-server system-config-kickstart dhcpsyslinux -y

挂载CentOS6.5的DVD光盘,并复制第一张光盘下的所有内容到/var/www/html/centos6/

# mkdir-p/var/www/html/centos6

# mount-r /dev/cdrom/mnt

# cp-rf/mnt/*/var/www/html/centos6

2、配置tftp,启动http、tftp服务

# vim/etc/xinetd.d/tftp

#default:off

#description:Thetftpserverservesfilesusingthetrivialfiletransfer\

#protocol.Thetftpprotocolisoftenusedtobootdiskless\

#workstations,downloadconfigurationfilestonetwork-awareprinters,\

#andtostarttheinstallationprocessforsomeoperatingsystems.

servicetftp

{

socket_type=dgram

protocol=udp

wait=yes

user=root

server=/usr/sbin/in.tftpd

server_args=-s@H_404_132@/tftpboot

disable=@H_404_132@no

per_source=11

cps=1002

flags=IPv4

}

3、配置dhcp

# vim /etc/dhcp/dhcpd.conf

#dhcpd.conf

optiondomain-name "cnlinux.com";

optiondomain-name-servers 114.114.114.114;

default-lease-time86400;

max-lease-time86400;

log-facilitylocal7;

subnet192.168.1.0 netmask 255.255.255.0 {

range 192.168.1.240 192.168.1.250;

option routers 192.168.1.1;

filename "pxelinux.0";

next-server 192.168.1.202;

}

4、配置支持PXE启动

# mkdir-p/tftpboot/pxelinux.cfg

# cp /usr/share/syslinux/pxelinux.0 /tftpboot/

# cd/mnt/images/pxeboot/;cpinitrd.imgvmlinuz/tftpboot

# cp /mnt/isolinux/boot.msg/tftpboot/

# cp /mnt/isolinux/vesamenu.c32 /tftpboot/

# cp /mnt/isolinux/splash.jpg/tftpboot/

# cp /mnt/isolinux/isolinux.cfg/tftpboot/pxelinux.cfg/default

# servicedhcpdrestart

# servicexinetdrestart

# servicehttpdrestart

# chkconfig--level35httpdon

# chkconfig--level35dhcpdon

# chkconfig--level35xinetdon

关闭selinux

# setenforce 0

# sed -i "s@SELINUX=enforcing@SELINUX=disabled@g"/etc/sysconfig/selinux

关闭iptables

# /etc/init.d/iptables stop

# chkconfig iptables off

# vim/tftpboot/pxelinux.cfg/default

default linux

#prompt 1

timeout 600

display boot.msg

menu background splash.jpg

menu title Welcome to CentOS 6.7!

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 anexisting system

menu default

kernel vmlinuz

append initrd=initrd.imgks=http://192.168.1.201/centos6/ks.cfg

label vesa

menu label Install system with ^basicvideo driver

append initrd=initrd.img xdriver=vesanomodeset

label rescue

menu label ^Rescue installed system

append initrd=initrd.img rescue

label local

menu label Boot from ^local drive

localboot 0xffff

label memtest86

menu label ^Memory test

kernel memtest

append -

# vim/var/www/html/centos6/ks.cfg

install

text

url --url http://192.168.1.201/centos6

lang en_US.UTF-8

keyboard us

network --onboot no --device eth0--bootproto dhcp --noipv6

970823

firewall --disabled

authconfig --enableshadow--passalgo=sha512

selinux --disabled

timezone Asia/Shanghai

bootloader --location=mbr--driveorder=sda --append="crashkernel=auto rhgb quiet"

clearpart --all --initlabel

zerombr yes

part /boot --fstype=ext4 --size=200

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

part swap --size=2000

%packages

@core

@server-policy

@workstation-policy

%end

reboot

最后构建一台服务器,会自动装机。

下图是在安装途中的。

wKiom1g67GjBilusAABdBSI8aCc374.png


下面是安装成功后 自动重启 然后输入密码登入的机器

wKiom1g67UayHFWpAABWgNyT4gU443.png

猜你在找的CentOS相关文章