kickstack自动化安装服务器的部署

介绍几种自动化安装服务器的方法

1.通过挂载光盘镜像文件的方式
待安装主机可以使用光盘里的镜像或者vsftpd共享出来的镜像来安装
2.通过pxe网络安装服务器
从合理性来讲,让每个主机都挂载一个光盘,显然也不符合实际,所以实际中使用PXE网络安装服务器

一.kickstack自动化安装脚本

rhel7中:
1.安装system-config-kickstart

yum install system-config-kickstart

2.图形制作ks文件的工具

system-config-kickstart 

3.这个图形工具是有bug的,需要手动添加某些文件内容

vim ks.cfg
%packages
@base ##软件组
lftp ##软件包
%end

4.检查ks.cfg文件是否有语法错误

ksvalidator /mnt/ks.cfg

5.发布ks文件

yum install vsftpd -y
systemctl start vsftpd
systemctl stop firewalld
mkdir /var/ftp/ksfile
mv ks.cfg /var/ftp/ksfile

6.检测发布
firefox ftp://192.168.1.33/ksfile/ks.cfg

二.通过挂载镜像光盘方式安装

在安装界面按<tab>
输入:
ks=ftp://192.168.1.33/ksfile/ks.cfg
回车
进入到自动安装过程
注意:
使用kickstart安装系统时环境中必须有dhcp服务器否则网络资源访问不到

使用网络资源安装系统

通过ftp服务发布镜像资源到网络

访问网络镜像资源
ftp://192.168.1.33/rhel7.0
更改ks.cfg
vim ks.cfg
#cdrom ##注释使用光盘资源
url --url=“ftp://192.168.1.33/rhel7.0” ##使用网络资源

二.pxe网络安装服务器

1.部署vsftpd

1.共享ks文件
2.共享安装源

mount /dev/cdrom /var/ftp/rhel8.0/

2.搭建dhcpd服务器

分配ip等信息到客户端
具体教程参见博客地址:
https://blog.csdn.net/chaos_oper/article/details/104332080

3.部署pxe环境

dnf install syslinux-nonlinux-6.04-1.el8.noarch -y ##获得pxelinux.0文件
dnf install tftp-server.x86_64 ##pxelinux.0共享服务器
systemctl start tftp
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/ ##共享pxelinux.0
cp /var/ftp/rhel8/isolinux/* /var/lib/tftpboot/ ##共享安装环境所要读取的文件
mkdir /var/lib/tftpboot/pxelinux.cfg/
cp /var/lib/tftpboot/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default ##生成pxelinux.0默认读取文件

4.dhcpd服务配置分发pxelinux.0

vim /etc/dhcp/dhcpd.conf 
1 # dhcpd.conf
2 #
3 # Sample configuration file for ISC dhcpd
4 #
5 
6 # option definitions common to all supported networks...
7 option domain-name "example.com";
8 option domain-name-servers 114.114.114.114;
9 
10 default-lease-time 600;
11 max-lease-time 7200;
12 
13 # Use this to enble / disable dynamic dns updates globally.
14 #ddns-update-style none;
15 
16 # If this DHCP server is the official DHCP server for the local
17 # network, the authoritative directive should be uncommented.
18 #authoritative;
19 
20 # Use this to send dhcp log messages to a different log file (you also
21 # have to hack syslog.conf to complete the redirection).
22 log-facility local7;
23 
24 # No service will be given on this subnet, but declaring it helps the 
25 # DHCP server to understand the network topology.
26 
27 
28 # This is a very basic subnet declaration.
29 
30 subnet 192.168.1.0 netmask 255.255.255.0 {
31   range 192.168.1.120 192.168.1.150;
32   option routers 192.168.1.10;
33   next-server 192.168.1.10;   		##tftp服务器地址
34   filename "pxelinux.0";				##需要读取的文件名称
35 }

5.设定pxelinux.cfg/default

 2  timeout 50 					##安装界面等待时间
 10 menu background splash.png  ##安装界面壁纸
 11 menu title Red Hat Enterprise Linux 8.0.0   ##安装标题
 61 label linux
 62   menu label ^Install Red Hat Enterprise Linux 8.0.0
 63   menu default 				##设定默认选择标题
 64   kernel vmlinuz
 65   append initrd=initrd.img repo=ftp://192.168.1.10/rhel8.0 ks=ftp://192.168.1.10/ksfile/ks.cfg   ##指定安装源和ks文件

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章