用PXE批量部署系统

在部署操作系统的时候可以选择安装centos6还是centos7

用PXE批量部署系统

clipb9oard

在部署操作系统的时候可以选择安装centos6还是centos7
关闭防火墙和selinux
挂centos6和centos7的光盘
echo ‘- – -‘ > /sys/class/scsi_host/host0/scan
yum install httpd dhcp tftp-server syslinux -y
systemctl enable httpd dhcpd tftpd.socket 开机启动
systemctl start httpd tftp.socket
配置DHCP服务
option domain-name “example.org”;
option domain-name-servers 114.114.114.114;
default-lease-time 86400;
max-lease-time 200000;
subnet 192.168.63.0 netmask 255.255.255.0 {
range 192.168.63.100 192.168.63.200;
option routers 192.168.63.1;
next-server 192.168.63.134;
filename “pxelinux.0”;
}
systemctl restart dhcpd 启动服务
配置yum源
mkdir /var/www/html/centos/{6,7} -pv
/dev/sr0 /var/www/html/centos/7 iso9660 defaults 0 0
/dev/sr1 /var/www/html/centos/6 iso9660 defaults 0 0
~
配置应答文件
mkdir /var/www/html/ksdir
[root@localhost ksdir]# cp /root/ks7_desktop.cfg /var/www/html/ksdir/
[root@localhost ksdir]# cp /root/ks_mini.cfg /var/www/html/ksdir/
vim /var/www/html/ksdir/ks_mini.cfg
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard ‘us’
# Root password
rootpw –iscrypted $1$R3VaLZ60$6ivf/Qc89KVNf3SGYXP351
# Use network installation
url –url=http://192.168.63.134/centos/7
# System language
lang en_US
# Firewall configuration
firewall –disabled
# System authorization information
auth –useshadow –passalgo=sha512
# Use text mode install
text
# SELinux configuration
selinux –disabled
# Do not configure the X Window System
skipx
# Network information
network –bootproto=dhcp –device=ens33 –onboot=on –ipv6=auto –activate
# Reboot after installation
reboot
# System timezone
timezone Asia/Shanghai
# System bootloader configuration
bootloader –append=”selinux=0″ –location=mbr –password=”123456″
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart –all –initlabel
# Disk partitioning information
part swap –fstype=”swap” –size=2048
part / –fstype=”xfs” –size=20000
part /boot –fstype=”xfs” –size=5048
part /home –fstype=”xfs” –size=10000
%post
rm -rf /etc/yum.repos.d/*
mkdir /etc/yum.repos.d/bak
cat > /etc/yum.repos.d/base.repo <<EOF
[base]
name=base
baseurl=file:///mnt/cdroot
gpgcheck=0
EOF
mkdir /mnt/cdroot
mount /dev/sr0 /mnt/cdroot
%end
%packages
@base
@core
vim
%end
配置TFTP
cd /var/lib/tftpboot/
[root@localhost tftpboot]# mkdir pxelinux.cfg
[root@localhost tftpboot]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
[root@localhost tftpboot]# mkdir centos{6,7} 由于有两个内核,所以创建两个文件夹,一个放7的一个放6的
[root@localhost tftpboot]# cp /var/www/html/centos/6/isolinux/{vmlinuz,initrd.img} /var/lib/tftpboot/centos6/
[root@localhost tftpboot]# cp /var/www/html/centos/7/isolinux/{vmlinuz,initrd.img} /var/lib/tftpboot/centos7/
[root@localhost tftpboot]# cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot/ 拷贝简单版菜单
[root@localhost tftpboot]# cp /var/www/html/centos/7/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default 拷贝菜单文件并改名
vim /var/lib/tftpboot/pxelinux.cfg/default
default menu.c32
timeout 600
menu title CentOS 7
label centos7
menu label ^Install Mini CentOS 7
kernel centos7/vmlinuz
append initrd=centos7/initrd.img ks=http://192.168.63.134/ksdir/ks7_mini.cfg
label centos6
menu label ^install Mini CentOS 6
kernel centos6/vmlinuz
append initrd=centos6/initrd.img ks=http://192.168.63.134/ksdir/ks_mini.cfg
label local
menu default
menu label Boot from ^local drive
localboot 0xffff
menu end

本文来自投稿,不代表Linux运维部落立场,如若转载,请注明出处:http://www.178linux.com/99623

(0)
周亚飞周亚飞
上一篇 2018-05-27
下一篇 2018-05-27

相关推荐

  • 第六次作业

    简述osi七层模型和TCP/IP五层模型 OSI:是ISO(国际标准化组织)组织在1985年研究的网络互连模型。 OSI将网络定义为7层,每一层实现各自的功能和协议,并完成与相邻层的接口通信。 物理层: 这一层是指物理设备 数据链路层:这层通过帧封装进行传递 网络层: 通过ip寻址来建立两个节点之间的连接这一层就是我们经常说的IP协议层。IP协议是Inter…

    Linux笔记 2018-08-08
  • 2018第十届GOPS全球运维大会9月上海召开!

    第十届 GOPS 全球运维大会将于2018年9月14日-15日在上海召开。大会为期2天,侧重方向是 AIOps、运维自动化和 DevOps。目前已经有全国各地大公司组团前来参加。

    2018-06-22
  • Linux_bash基础特性_命令行展开

    Linux_bash基础特性_命令行展开

    2018-06-08
  • 计算机原理与Linux基础

    计算机的组成及功能 1、其实计算机的组织分为内部设备和外部设备, 内部设备:         CPU:运算器、寄存器、缓存         存储器:内存,RAM(Random Access Memory)         控制器:控制器是整个计算机系统的控制中心,它指挥计算机各部分协调地工作,保证计算机按照预先规定的目标和步骤有条不紊地进行操作及处理。 外部…

    Linux笔记 2018-05-13
  • MYSQL数据库基本使用

    MYSQL数据库基本使用

    2018-06-08
  • linux ACL访问控制列表

    1.ACL介绍 Linux 下用户对文件的操作权限有 r-读, w-写, x-可执行三种,而对linux 下的文件而言,用户身份分为:所有者, 所属组, 其它人, 且文件的所有者,所属组都只能是一个,所以在对文件分配用户的使用权限时,只能对这三种身份进行分配rwx 权限.Linux 主要作为服务器系统使用,用户众多.所以在实际使用场景中,这三种身份并不能很好…

    Linux笔记 2018-04-08