PXE+KICKSTART部署过程基于centos7

PXE+KICKSTART部署过程基于centos7
摘要由CSDN通过智能技术生成

部署过程基于centos7

环境准备
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# getenforce
准备安装源

安装DHCP服务

[root@localhost ~]# yum install dhcp ntpdate syslinux -y 
[root@localhost ~]# timedatectl set-timezone Asia/Shanghai
[root@localhost ~]# ntpdate time.windows.com
[root@localhost ~]# cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak_$(date +%Y-%m-%d-%H-%M)
[root@localhost ~]# vim /etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet 192.168.217.0 netmask 255.255.255.0 {
  range 192.168.217.10 192.168.217.100;
  option domain-name-servers 114.114.114.114;
  option routers 192.168.217.155;
  next-server 192.168.217.155;
  filename "pxelinux.0";
}
[root@localhost ~]# systemctl start dhcpd.service
[root@localhost ~]# systemctl enable dhcpd.service

安装ftp

[root@localhost ~]# yum install -y vsftpd
[root@localhost ~]# mount /dev/cdrom /mnt
[root@localhost ~]# cp -rf /mnt/* /var/ftp/pub/
[root@localhost ~]# systemctl start vsftpd
[root@localhost ~]# systemctl enable vsftpd 

tftp安装

[root@localhost ~]# yum install -y tftp-server tftp syslinux-tftpboot
[root@localhost ~]# cp /etc/xinetd.d/tftp /etc/xinetd.d/tftp.bak_$(date +%Y-%m-%d-%H-%M)
 [root@localhost ~]# vim /etc/xinetd.d/tftp
 
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
}

配置tftp-server

[root@localhost ~]# cp -rf /usr/share/syslinux/* /var/lib/tftpboot
 
[root@localhost ~]# mkdir /var/lib/tftpboot/pxelinux.cfg
[root@localhost ~]# mkdir /var/lib/tftpboot/centos7
[root@localhost ~]# cp /mnt/images/pxeboot/vmlinuz /var/lib/tftpboot/centos7
[root@localhost ~]# cp /mnt/images/pxeboot/initrd.img /var/lib/tftpboot/centos7
[root@localhost ~]# touch /var/lib/tftpboot/pxelinux.cfg/default
[root@localhost ~]# chmod 755 /var/lib/tftpboot/pxelinux.cfg/default
 
 
[root@localhost ~]# vim /var/lib/tftpboot/pxelinux.cfg/default

default menu.c32
prompt 1
timeout 10

menu title ########## PXE Boot Menu ##########

label 1
menu label ^1) Install CentOS 7 x64 with Local Repo
menudefault
kernel centos7/vmlinuz
append initrd=centos7/initrd.img text ks=ftp://192.168.217.155/pub/ks.cfg
 
label 2
menu label ^2) Install CentOS 7 x64 with http://mirror.centos.org Repo
kernel centos7/vmlinuz
append initrd=centos7/initrd.img method=http://mirror.centos.org/centos/7/os/x86_64/ devfs=nomount ip=dhcp

label 3
menu label ^3) Install CentOS 7 x64 with Local Repo using VNC
kernel centos7/vmlinuz
append initrd=centos7/initrd.img method=ftp://192.168.217.155/pub devfs=nomount inst.vnc inst.vncpassword=password
配置Kickstart
[root@localhost ~]# vim /var/ftp/pub/ks.cfg
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use network installation
url --url="ftp://192.168.217.155/pub"
# 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

# Network information
network  --bootproto=dhcp --device=ens33 --ipv6=auto --no-activate
network  --hostname=localhost.localdomain

# Root password
rootpw --iscrypted $6$zfuB8B9/c1HSQYHs$00O4mwv9RrjmrsA6bxFlqe0mhW9nLiOdNNvhJD217V5DbEYrJn.fo4qmB/QXeyA79vK75xgDlNM83Yyl7wHTe0
# System services
services --enabled="chronyd"
# System timezone
timezone Asia/Shanghai --isUtc
user --groups=wheel --name=abc --password=$6$FseXU1ogh.yrPKOW$SITVcIB1ti2K1bpK9dbM1aChM3cosniGiGKKko6FkdgybGR8r3.PLRPPwe1uUdpm86MTAH16.GM.TQTV2W3Rc1 --iscrypted --gecos="abc"
# System bootloader configuration
bootloader --location=mbr --boot-drive=sda
# Partition clearing information
clearpart --none --initlabel
# Disk partitioning information
part / --fstype="ext4" --ondisk=sda --size=10240
part /boot --fstype="ext4" --ondisk=sda --size=200
part swap --fstype="swap" --ondisk=sda --size=1024

%packages
@^minimal
@core
chrony

%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

适当的给权限,

[root@localhost ~]# chmod 777 /var/ftp/pub/ks.cfg 
启动相应服务
[root@localhost ~]# systemctl restart tftp
[root@localhost ~]# systemctl restart vsftpd
[root@localhost ~]# systemctl restart dhcpd
测试

在这里插入图片描述

新建虚拟机

完成

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值