kickstart搭建
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了kickstart搭建相关的知识,希望对你有一定的参考价值。
---恢复内容开始---
1.1 kickstart的安装
1.1.1 系统环境准备
查看系统的版本:
[[email protected] ~]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core) CentOS release 6.9 (Final)
查看系统的内核:
[[email protected] ~]# uname -r
3.10.0-693.el7.x86_64
查看selinux是否关闭:
[[email protected] ~]# getenforce
Permissive
查看防火墙是否关闭:
[[email protected] ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
1.1.2 安装dhcp及配置
1.1.2.1 安装dhcp
[[email protected] ~]# yum -y install dhcp
查看是否安装成功:
[[email protected] ~]# rpm -qa |grep dhcp
dhcp-libs-4.2.5-58.el7.centos.x86_64
dhcp-4.2.5-58.el7.centos.x86_64
dhcp-common-4.2.5-58.el7.centos.x86_64
1.1.2.2 修改dhcp的配置文件
[[email protected] ~]# vim /etc/dhcp/dhcpd.conf
subent 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.100 10.0.0.200;
option subnet-mask 255.255.255.0;
default-lease-time 21600;
max-lease-time 43200;
next-server 10.0.0.201
filename "/pxelinux.0";
说明:
subent 10.0.0.0 分配的网段
netmask 255.255.255.0 子网掩码
range 10.0.0.100 10.0.0.200; 可分配的地址
option subnet-mask 255.255.255.0; 可分配的子网掩码
default-lease-time 21600; 设置默认的ip租用期限
max-lease-time 43200; 最大的租期期限
next-server 10.0.0.201 TFTP的服务器的ip地址
filename "/pxelinux.0"; 需要从 tftp服务器上下载的文件
1.1.2.3 启动dhcp服务
[[email protected] ~]# systemctl start dhcpd
1.2 安装TFTP服务
[[email protected] ~]# yum -y install tftp-server
查看是否安装成功:
[[email protected] ~]# rpm -qa |grep tftp-server
tftp-server-5.2-13.el7.x86_64
1.2.1 启动TFTP服务
[[email protected] ~]# systemctl start tftp.socket
1.2.2 安装pxelinux.0启动文件
[[email protected] ~]# yum -y install syslinux
把pxelinux.0启动文件移动到TFTP的根目录下:
[[email protected] ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
1.2.3 挂载镜像
[[email protected] ~]# mkdir -p /var/www/html/CentOS7
[[email protected] ~]# mount /dev/cdrom /var/www/html/CentOS7/
1.2.4 从镜像中找到相关的配置文件
[[email protected] ~]# cp -a /var/www/html/CentOS7/isolinux/* /var/lib/tftpboot/
[[email protected] ~]# mkdir -p /var/lib/tftpboot/pxelinux.cfg
[[email protected] ~]# cp /var/www/html/CentOS7/isolinux/isolinux.cfg /var/lib/t
[[email protected] ~]# cp /var/www/html/CentOS7/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
1.3 安装http服务
[[email protected] ~]# yum -y install httpd
[[email protected] ~]# systemctl start httpd.service
1.3.1 检查步骤
1.4 配置default
[[email protected] ~]# vim /var/lib/tftpboot/pxelinux.cfg/default
default ks
prompt 0
label ks
kernel vmlinuz
append initrd=initrd.img ks=http://172.16.1.201/ks_config/CentOS7-ks.cfg net.ifnames=0 biosdevname=0 ksdevice=eth1
1.5 配置启动文件
[[email protected] ~]# vim /var/www/html/ks_config/CentOS7-ks.cfg
# Kickstart Configurator for CentOS 7 by yao zhang
install
url --url="http://172.16.1.201/CentOS7/"
text
lang en_US.UTF-8
keyboard us
zerombr
network --hostname=Cobbler
#network --bootproto=dhcp --device=eth1 --onboot=yes --noipv6 --hostname=CentOS7
timezone --utc Asia/Shanghai
authconfig --enableshadow --passalgo=sha512
clearpart --all --initlabel
part /boot --fstype xfs --size 1024
part swap --size 1024
part / --fstype xfs --size 1 --grow
firstboot --disable
selinux --disabled
firewall --disabled
logging --level=info
reboot
%packages
@^minimal
@compat-libraries
@debugging
@development
tree
nmap
sysstat
lrzsz
dos2unix
telnet
wget
vim
bash-completion
%end
%post
systemctl disable postfix.service
%end
---恢复内容结束---
以上是关于kickstart搭建的主要内容,如果未能解决你的问题,请参考以下文章
KVM 搭建PXE+DHCP+DNS+vsftpd+tftp+KICKSTART
RedHat7搭建无人值守自动安装Linux操作系统(PXE+Kickstart)
centos7.2 搭建PXE+kickstart多版本系统安装