码迷,mamicode.com
首页 > 其他好文 > 详细

centos7 pxe kickstart

时间:2017-03-24 14:39:00      阅读:244      评论:0      收藏:0      [点我收藏+]

标签:linux   kickstart   

#kickstart for centos 7.pxe
#CentOS Linux release 7.2.1511 (Core)

#IP 10.0.7.34 
#service dhcp httpd tftp-server

#关闭防火墙及selinux
[root@localhost ~]#systemctl stop iptables
[root@localhost ~]#systemctl stop firewalld
[root@localhost ~]#setenforce 0
#安装dhcp
[root@localhost ~]#yum install dhcp
[root@localhost ~]# cat /etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
log-facility local7;

subnet 10.0.7.0 netmask 255.255.255.0 {
        option routers                  10.0.7.1;
        option subnet-mask              255.255.255.0;
        option time-offset              -18000; # Eastern Standard Time  
        range dynamic-bootp 10.0.7.11 10.0.7.29;
        default-lease-time 21600;
        max-lease-time 43200;
        next-server 10.0.7.34;
        filename "pxelinux.0";
}


[root@localhost ~]#yum install tftp-server xinetd -y
[root@localhost ~]# 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  #修改yes 为 no
	per_source		= 11
	cps			= 100 2
	flags			= IPv4
}

#下载内核,启动文件;此文件可从安装光盘中查看对应文件。
[root@localhost ~]#cd /var/lib/tftpboot/
[root@localhost ~]#wget http://mirrors.163.com/centos/7/os/x86_64/images/pxeboot/initrd.img
[root@localhost ~]#wget http://mirrors.163.com/centos/7/os/x86_64/images/pxeboot/vmlinuz
[root@localhost ~]#wget http://mirrors.163.com/centos/7/os/x86_64/isolinux/vesamenu.c32
[root@localhost ~]#wget http://mirrors.163.com/centos/7/os/x86_64/isolinux/boot.msg

[root@localhost ~]#mkdir pxelinux.cfg
[root@localhost ~]#cat /var/lib/tftpboot/pxelinux.cfg/default 
default linux
prompt 1
timeout 60
display boot.msg
label linux
  kernel vmlinuz
  append initrd=initrd.img text ks=http://10.0.7.34/ks.cfg
  
[root@localhost ~]#yum install syslinux -y
[root@localhost ~]#cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
#ks.cfg安装文件;此文件可从~/anaconda-ks.cfg复制,并修改
[root@localhost ~]# cat /var/www/html/ks.cfg 
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Install OS instead of upgrade  
install  
# Use network installation  此处为ISO地址,一般为内网地址
url --url=http://10.0.1.231/CentOS/7/os/x86_64
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=us --xlayouts=‘us‘
# System language
lang en_US.UTF-8 --addsupport=zh_CN.UTF-8

# Network information
network  --bootproto=dhcp --device=em1 --onboot=off --ipv6=auto
network  --bootproto=dhcp --device=em2 --onboot=off --ipv6=auto
network  --bootproto=dhcp --device=em3 --onboot=off --ipv6=auto
network  --bootproto=dhcp --device=em4 --onboot=off --ipv6=auto
network  --hostname=localhost.localdomain

# Root password
rootpw --iscrypted $6$XnDH3wP0.n1Tn9YJ$I/my1AH6B.9BxhB6O1cGUjmuTBD9BVKP19R.2nQrU0Q0NjcGB7HP3BTeOLBy3HkJtB8Qh4wEvrOGxShOUyoLc.
# System services
services --disabled="chronyd"
# System timezone
timezone Asia/Shanghai --isUtc --nontp
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
autopart --type=lvm
# Partition clearing information
clearpart --all --initlabel --drives=sda

%packages
@^minimal
@core
kexec-tools

%end

%addon com_redhat_kdump --disable --reserve-mb=‘auto‘

%end

##############################################################


本文出自 “运维基础” 博客,请务必保留此出处http://phospherus.blog.51cto.com/7824598/1909894

centos7 pxe kickstart

标签:linux   kickstart   

原文地址:http://phospherus.blog.51cto.com/7824598/1909894

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!