PXE自动化安装CentOS6/7
服务器为centos7
安装前准备:关闭防火墙和SELINUX
虚拟机准备第二块网卡,设置主机模式,关闭虚拟机网络配置中主机模式的DHCP功能,并设置静态IP
nmcli c a con-name ens37-dhcp type ethernet ifname ens37 ipv4.method manual ipv4.addresses 192.168.47.10/24 ipv4.gateway 192.168.47.1 ipv4.dns 114.114.114.114 connection.autoconnect yes
安装软件包
dhcp,httpd,tftp-server,syslinux,system-config-kickstart
配置dhcp:
vim /etc/dhcp/dhcpd.conf
option domain-name "linux123.tech"; 设置域名
option domain-name-servers 114.114.114.114, 8.8.8.8; DNS服务器,可以不要
default-lease-time 8560; 最长租约
max-lease-time 15400; 特殊情况的最长租约
subnet 192.168.47.0 netmask 255.255.255.0 { DHCP服务网段
range 192.168.47.50 192.168.47.100; 分配地址范围
filename "pxelinux.0"; 系统安装文件名
next-server 192.168.47.10; tftp服务器地址
}
systemctl start dhcpd 启动服务
用另一台主机模式的虚拟机自动获取IP,测试DHCP服务是否正常,
配置httpd
在目录下设置创建放置ISO文件和KS文件的目录
cd /var/www/html/
mkdir ksdir 创建ks文件夹
cp /root/ks7-* /var/www/html/ksdir/ 将制作好的ks文件拷入ks7-desktop.cfg,ks7-mini.cfg,ks6-mini.cfg
mkdir centos/7 -p
mkdir centos/6
mount /dev/sr1 centos/7 挂载centos7安装盘到网络路径
mount /dev/sr2 centos/6 挂载centos6
配置tftp
cd /var/lib/tftpboot/
rpm -ql syslinux 找到pxelinux.0和menu.c32的路径
cp /usr/share/syslinux/{pxelinux.0,menu.c32} .
cp /var/www/http/centos/6/isolinux/{vmlinuz,initrd.img} .6/ 从centos6光盘中拷贝驱动文件
cp /var/www/http/centos/7/isolinux/{vmlinuz,initrd.img} .7/ 从centos7光盘中拷贝驱动文件
mkdir pxelinux.cfg
cp /mnt/cd/isolinux/isolinux.cfg pxelinux.cfg/default 启动菜单
vim pxelinux.cfg/default 修改启动菜单项
default menu.c32
timeout 600
label linux
menu label Install ^Desktop CentOS 7
kernel 7/vmlinuz
append initrd=7/initrd.img ks=http://192.168.47.10/ksdir/k7-desktop.cfg
label check
menu label Install ^Mini CentOS 7
kernel 7/vmlinuz
append initrd=7/initrd.img ks=http://192.168.47.10/ksdir/k7-mini.cfg
label check
menu label Install ^Mini CentOS 7
kernel 6/vmlinuz
append initrd=6/initrd.img ks=http://192.168.47.10/ksdir/k6-mini.cfg
label local
menu default
menu label Boot from ^local drive
localboot 0xffff
menu end
最后,确保防火墙和selinux关闭
打开三项服务
systemctl httpd dhcpd tftp.service
空白虚拟机开机,centos7图形虚拟机的内存需要大于1.1G以上,磁盘空间也要大于分区的空间,否则会报错失败。
ks7-desktop.cfg ks7-mini.cfg相比较只是少了几个包,自行删除几个不需要的就可以了。
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
url --url=http://192.168.47.10/centos/7
# Use graphical install
firewall --disabled
selinux --disabled
text
reboot
# Run the Setup Agent on first boot
firstboot --disable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8
# Network information
network --bootproto=dhcp --device=ens33 --onboot=on --ipv6=auto --activate
network --hostname=centos7.magedu.com
# Root password
rootpw --plaintext 1234567890
# System services
services --disabled="chronyd"
# System timezone
timezone Asia/Shanghai --isUtc --nontp
# X Window System configuration information
xconfig --startxonboot
# System bootloader configuration
bootloader --location=mbr --boot-drive=sda
# Partition clearing information
zerombr
clearpart --all --initlabel
# Disk partitioning information
part swap --fstype="swap" --ondisk=sda --size=2048
part /boot --fstype="xfs" --ondisk=sda --size=1024
part / --fstype="xfs" --ondisk=sda --size=51200
part /app --fstype="xfs" --ondisk=sda --size=20480
eula --agreed
%packages
@base
@core
@dial-up
@fonts
@gnome-desktop
@guest-agents
@guest-desktop-agents
@internet-browser
@multimedia
@network-file-system-client
@networkmanager-submodules
@x11
%end
%addon com_redhat_kdump --disable --reserve-mb='auto'
%end
%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
%post
systemctl default multi-user.target
%end
ks6-mini.cfg
# Kickstart file automatically generated by anaconda.
#version=DEVEL
install
reboot
text
url --url=http://192.168.47.10/centos/6/
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto dhcp --noipv6
rootpw --plaintext 6803154
firewall --disabled
authconfig --enableshadow --passalgo=sha512
selinux --disabled
timezone Asia/Shanghai
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
clearpart --all
zerombr
part /boot --fstype=ext4 --size=1024
part / --fstype=ext4 --size=50000
part /app --fstype=ext4 --size=20000
part swap --size=2048
%packages
@base
@core
@debugging
%end
PXE自动化安装CentOS6/7的更多相关文章
- 配置pxe 自动化安装centos6.7
dhcp服务器是pxe自动化安装的必要条件,因此先搞定dhcp服务器,yum -y install dhcp, rpm -ql dhcp查看安装了哪些包,less /etc/dhcp/dhcpd.c ...
- Linux PXE自动化安装centos6,centos7系统
1.PXE是什么? pxe是Preboot Excution Environment的缩写,是intel公司研发,基于client/server的网络模式,支持远程主机通过网络从远端服务器下载镜,并由 ...
- CentOS 6.5自动化运维之基于DHCP和TFTP服务的PXE自动化安装centos操作系统详解
前言 如果要给很多台客户端主机安装操作系统,要是每一台都拿张安装光盘一台一台主机的去装系统那就太浪费时间和精力了.在生产环境中也不实际,要实现为多台主机自动安装操作系统,那我们怎么实现自动化安装 ...
- 使用Kickstart+pxe自动化安装部署无人值守的linux服务器
Kickstart+pxe Kickstart无人职守安装RHEL5过程分享(详细图解版) 启动应用有:httpd.dhcpd.named.xinetd 无人职守自动批量安装linux系统超详细 参考 ...
- PXE自动化安装系统
准备(以centos7为例) ①关闭防火墙 ②关闭selinux ③dhcp服务设置为静态IP ④安装软件包 http:充当yum源安装包仓库 tftp-server :在它的工作目录存在引导主机的工 ...
- Pxe自动化安装
Centos7环境 Systemctl stop firewalld Setenforce Yum本地源 cd /etc/yum.repos.d/ 进入/etc/yum.repos.d/ Ls 查看 ...
- kickstart自动化安装
preboot execute environment预启动执行环境--intel开发的技术,计算机可以通过pxe协议从网络引导启动. 工作模式为客户端/服务器端的c/s模式 客户端从远端服务器下载镜 ...
- kickstart+pxe+tftp+ntp(http)自动化安装平台的搭建
听说过"克隆"吗,对于这个科技术语20年前可能还很陌生,羊可以克隆,通过基因dna序列:机器同样可以克隆通过网络IP! 如下为自动化安装平台: PXE(preboot execut ...
- [PXE] Linux(centos6)中PXE 服务器搭建,PXE安装、启动及PXE理论详解
[PXE] Linux(centos6)中PXE 服务器搭建,PXE安装.启动及PXE理论详解 本篇blog主要讲述了[PXE] linux(centos)PXE无盘服务器搭建,安装,启动及pxe协议 ...
随机推荐
- 使用taobao的npm镜像源,同时安装nrm镜像工具
身在天朝.你面临的一个问题就是网络 安装好Nodejs 控制台 执行 npm config set registry https://registry.npm.taobao.org //配置指向源 然 ...
- DEDECMS v5.7 完美实现导航条下拉二级菜单
一.引言 好多人都问,织梦的下拉导航怎么做呢?其实很简单!即使你对代码一点也不熟悉,没关系! 按照我的步骤走!记住一步也不能错哦! 二.实现过程 1.首先: 将下面这段代码贴到templets\def ...
- js报错
1.如果出现找不到js方法,感觉写的js都正确就是调试报错,可能原因是js文件重复引用 2.在用ajax异步提交时千万别用 submit 控件,submit控件是表单提交控件,提交表单的同时不会执行异 ...
- C# 字节数组和十六进制字符串之间转换的另类写法
今天从http://www.cnblogs.com/NanaLich/archive/2012/05/24/2516860.html看到的,记录下来 主要是XmlSerializationReader ...
- MacOS python自动补全设置
1. 新建python自动补全脚步 $ cd <workdir> $ touch tab.py $ vim tab.py,输入如下内容后保存 $ chmod +x tab.py #!/us ...
- mysql测试和sysbench工具详解
前言 作为一名后台开发,对数据库进行基准测试,以掌握数据库的性能情况是非常必要的.本文介绍了MySQL基准测试的基本概念,以及使用sysbench对MySQL进行基准测试的详细方法. 文章有疏漏之处, ...
- Ienumerable和Ienumerator的使用
using UnityEngine; using System.Collections; public class TestCoroutine : MonoBehaviour { void Start ...
- 微软RPC技术学习小结
RPC,即Remote Procedure Call,远程过程调用,是进程间通信(IPC, Inter Process Communication)技术的一种.由于这项技术在自己所在项目(Window ...
- php读取mysql中文乱码
连接mysql的文件: <?php /***************************** *数据库连接 *****************************/ $conn = @m ...
- Linux与Windows区别——总结中
一:在Linux系统中,每一个文件都多加了很多的属性进来,尤其是用户组的概念 二:Windows下面一个文件是否具有执行的能力是通过“扩展名”来判断的,如:.exe,.bat,.com等 Linux下 ...