默认计划
930人加入学习
(23人评价)
Linux安全基础
价格 ¥ 399.00
该课程属于 高校公益行 | 网络安全实践训练营 请加入后再学习

适用场景:大规模安装linux服务器,需要安装过程统一且标准化

过程:1. 需要一个DHCP服务器

yum install dhcp

cd /usr/share/doc/dhcp-xx/

cp dhcpd.conf.example /etc/dhcp/dhcpd.conf

vim /etc/dhcp/dhcpd.conf

---


#/etc/dhcp/dhcpd.conf

default-lease-time 600;

max-lease-time 7200;

log-facility local7;

subnet 10.11.11.0 netmask 255.255.255.0{

    range 10.11.11.26 10.11.11.30; // 要改成自己用的

    option routers 10.11.11.254;

    option broadcast-address 10.11.11.255;

    default-lease-time 600;

    max-lease-time 7200;

    next-server 10.11.11.1; // 指定PXE引导服务器 就是当前服务器ip

    filename "pxelinux.0"; // 指定引导文件

}

Q: 这个配置文件的每一行什么意思,配置什么的

---

systemctl start dhcp

systemctl status dhcpd.service

2. tftp和syslinux

tftp 用于远程linux的引导

syslinux提供引导块,引导模块的远程启动服务

yum install tftp-server syslinux

vim /etc/xinetd.d/tftp

把disable=yes改成no

顺便,server的目录是tftp共享的目录

systemctl restart xinetd

netstat -aupn |grep 69

cd /var/lib/tftpboot // tftp的根目录

cp /usr/share/syslinux/pxelinux.0 ./

// 以下是系统光盘的内容

cp /var/ftp/yum/isolinux/vmlinuz ./

                                          inittrd.img

                                          vesamenu.c32

                                          boot.msg

// 然后编辑启动菜单配置文件

mkdir /var/lib/tftpboot/pxelinux.cfg

cp /var/ftp/yum/isolinux/isolinux.cfg pxelinux.cfg/default

vim 这个default

在label linux行前添加

label centos

 menu label ^Install CentOS7.1

 menu default

 kernel vmlinuz

// 目标是ftpxxx 自动化脚本配置文件是xxxks什么的

 append initrd=initrd.img inst.stage2=ftp://10.11.11.1/yum inst.ks=ftp://10.11.11.1/ks.cfg.quiet

然后删了menu label Test this ^ media & install CentOS7前面的menu default行删了

3.安装kickstart

yum install system-config-kickstart

system-config-kickstart

kickstart不能配置软件包安装

ks.cfg加上@packages@end之后,保存到/var/ftp

 

firewall-cmd --permanent --add-port=69/udp

--add-service=dhcp

ftp

 

--reload

 

新建的主机自动就默认去用PXE了……猜测是整个网段都会自动走这个流程0 v 0

 

 

 

 

[展开全文]

PXE,就是预启动执行环境,是一种引导启动的方式。这种协议一般由两部分构成,一部分是服务器端,一个是客户端。简单来说,我们通过这种方式可以自己创建一个“安装源”,在安装系统的时候只要能找到这个“源”便可以实现系统的安装。在实现无人值守的安装前,我们必须要搭建一些服务,来实现“安装源”的建立,例如ftp、http、tftp、dhcp等。

[展开全文]

利用PXE远程装机服务批量部署Linux

1、安装并配置DHCP服务器

2、安装tftp-server与syslinux,并配置

3、安装kickstart,并配置自动化安装步骤

4、配置防火墙,并进行测试

[展开全文]

pxe远程批量部署 Linux

  1.安装配置dhcp服务器

   yum -y  install dhcp

cp dhcpd.conf.example /etc/dhcp/dhcpd.conf

vim /etc/dhcp/dhcp/dhcpd.conf

default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet   ip地址 netmask 255.255.255.0 {
range  ;
option routers  xxx.xxx ;
option broadcast-address 5;
default-lease-time 600;
max-lease-time 7200;
next-server 服务器地址;

2.安装tftp-Server与syslinux,配置

yum -y install syslinux
 yum -y install tftp-server
 vim /etc/xinetd.d/tftp
“disable = yes”修改成disable=no

systemctl start xinetd

cd /var/lib/tftpboot

 cp /usr/share/syslinux/pxelinux.0 ./
 cp /var/ftp/yum/isolinux/vmlinuz ./
 cp /var/ftp/yum/isolinux/initrd.img ./
 cp /var/ftp/yum/isolinux/vesamenu.c32./    cp /var/ftp/yum/isolinux/boot.msg ./

mkdir pxelinux.cfg

编辑启动菜单配置文件

cp /var/ftp/yum/isolinux/ioslinux.cfg ./pxelinux.cfg/default

vim pxelinux.cfg/default

“label linux”这一行前添加:
label centos     //创建标签
menu label ^Install CentOS 7.1
menu default
kernel vmlinuz
append initrd=initrd.img inst.stage2=ftp://yumip/yum inst.ks=ftp://yumip/ks.cfg quiet

找到“menu label Test this ^media & install CentOS 7”,后面的
“menu default”行删除
3.安装Kickstart,配置自动化安装

yum -y install system-config-kickstart

system-config-kickstart

Kickstart配置   时区的选择 

安装方法 选择ftp  安装新的引导  分区选项

 安装后脚本

system-config-kickstart

mkdir /etc/yum.repos.d/old
cp -rf /etc/yum.repos.d/*
/etc/yum/repos.d/old/
rm -f /etc/yum.repos.d/*
echo '[base]
name= CentOS 7.1 Setup
baseurl=ftp://yum ip/yum
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7'>
/etc/yum.repos.d/CentOS7Setup.repo

保存 root/ks.cfg

vim anaconda-ks.cfg

复制
“%packages
@base
……
@x11
%end”段

vim  ks.cfg

在“part / --fstype="xfs" --grow --size=1
%post --interpreter=/bin/bash”两行之间粘贴“%packages … … %end”段

cp ks.cfg  /var/ftp/

firewall-cmd --permanent --add-service=dhcp success
 firewall-cmd --permanent --add-service=ftp success
 firewall-cmd --permanent --add-port=69/udp success
 firewall-cmd --reload

 

 

 

 

 
 
G
M
T
 
 
  Detect languageAfrikaansAlbanianArabicArmenianAzerbaijaniBasqueBelarusianBengaliBosnianBulgarianCatalanCebuanoChichewaChinese (Simplified)Chinese (Traditional)CroatianCzechDanishDutchEnglishEsperantoEstonianFilipinoFinnishFrenchGalicianGeorgianGermanGreekGujaratiHaitian CreoleHausaHebrewHindiHmongHungarianIcelandicIgboIndonesianIrishItalianJapaneseJavaneseKannadaKazakhKhmerKoreanLaoLatinLatvianLithuanianMacedonianMalagasyMalayMalayalamMalteseMaoriMarathiMongolianMyanmar (Burmese)NepaliNorwegianPersianPolishPortuguesePunjabiRomanianRussianSerbianSesothoSinhalaSlovakSlovenianSomaliSpanishSundaneseSwahiliSwedishTajikTamilTeluguThaiTurkishUkrainianUrduUzbekVietnameseWelshYiddishYorubaZulu
 
AfrikaansAlbanianArabicArmenianAzerbaijaniBasqueBelarusianBengaliBosnianBulgarianCatalanCebuanoChichewaChinese (Simplified)Chinese (Traditional)CroatianCzechDanishDutchEnglishEsperantoEstonianFilipinoFinnishFrenchGalicianGeorgianGermanGreekGujaratiHaitian CreoleHausaHebrewHindiHmongHungarianIcelandicIgboIndonesianIrishItalianJapaneseJavaneseKannadaKazakhKhmerKoreanLaoLatinLatvianLithuanianMacedonianMalagasyMalayMalayalamMalteseMaoriMarathiMongolianMyanmar (Burmese)NepaliNorwegianPersianPolishPortuguesePunjabiRomanianRussianSerbianSesothoSinhalaSlovakSlovenianSomaliSpanishSundaneseSwahiliSwedishTajikTamilTeluguThaiTurkishUkrainianUrduUzbekVietnameseWelshYiddishYorubaZulu
 
 
 
 
 
 
 
 
 
Text-to-speech function is limited to 200 characters
 
 
 
Options : History : Feedback : Donate Close
 
 
G
M
T
 
 
  Detect languageAfrikaansAlbanianArabicArmenianAzerbaijaniBasqueBelarusianBengaliBosnianBulgarianCatalanCebuanoChichewaChinese (Simplified)Chinese (Traditional)CroatianCzechDanishDutchEnglishEsperantoEstonianFilipinoFinnishFrenchGalicianGeorgianGermanGreekGujaratiHaitian CreoleHausaHebrewHindiHmongHungarianIcelandicIgboIndonesianIrishItalianJapaneseJavaneseKannadaKazakhKhmerKoreanLaoLatinLatvianLithuanianMacedonianMalagasyMalayMalayalamMalteseMaoriMarathiMongolianMyanmar (Burmese)NepaliNorwegianPersianPolishPortuguesePunjabiRomanianRussianSerbianSesothoSinhalaSlovakSlovenianSomaliSpanishSundaneseSwahiliSwedishTajikTamilTeluguThaiTurkishUkrainianUrduUzbekVietnameseWelshYiddishYorubaZulu
 
AfrikaansAlbanianArabicArmenianAzerbaijaniBasqueBelarusianBengaliBosnianBulgarianCatalanCebuanoChichewaChinese (Simplified)Chinese (Traditional)CroatianCzechDanishDutchEnglishEsperantoEstonianFilipinoFinnishFrenchGalicianGeorgianGermanGreekGujaratiHaitian CreoleHausaHebrewHindiHmongHungarianIcelandicIgboIndonesianIrishItalianJapaneseJavaneseKannadaKazakhKhmerKoreanLaoLatinLatvianLithuanianMacedonianMalagasyMalayMalayalamMalteseMaoriMarathiMongolianMyanmar (Burmese)NepaliNorwegianPersianPolishPortuguesePunjabiRomanianRussianSerbianSesothoSinhalaSlovakSlovenianSomaliSpanishSundaneseSwahiliSwedishTajikTamilTeluguThaiTurkishUkrainianUrduUzbekVietnameseWelshYiddishYorubaZulu
 
 
 
 
 
 
 
 
 
Text-to-speech function is limited to 200 characters
 
 
 
Options : History : Feedback : Donate Close
 
 
G
M
T
 
 
Detect languageAfrikaansAlbanianArabicArmenianAzerbaijaniBasqueBelarusianBengaliBosnianBulgarianCatalanCebuanoChichewaChinese (Simplified)Chinese (Traditional)CroatianCzechDanishDutchEnglishEsperantoEstonianFilipinoFinnishFrenchGalicianGeorgianGermanGreekGujaratiHaitian CreoleHausaHebrewHindiHmongHungarianIcelandicIgboIndonesianIrishItalianJapaneseJavaneseKannadaKazakhKhmerKoreanLaoLatinLatvianLithuanianMacedonianMalagasyMalayMalayalamMalteseMaoriMarathiMongolianMyanmar (Burmese)NepaliNorwegianPersianPolishPortuguesePunjabiRomanianRussianSerbianSesothoSinhalaSlovakSlovenianSomaliSpanishSundaneseSwahiliSwedishTajikTamilTeluguThaiTurkishUkrainianUrduUzbekVietnameseWelshYiddishYorubaZulu
 
AfrikaansAlbanianArabicArmenianAzerbaijaniBasqueBelarusianBengaliBosnianBulgarianCatalanCebuanoChichewaChinese (Simplified)Chinese (Traditional)CroatianCzechDanishDutchEnglishEsperantoEstonianFilipinoFinnishFrenchGalicianGeorgianGermanGreekGujaratiHaitian CreoleHausaHebrewHindiHmongHungarianIcelandicIgboIndonesianIrishItalianJapaneseJavaneseKannadaKazakhKhmerKoreanLaoLatinLatvianLithuanianMacedonianMalagasyMalayMalayalamMalteseMaoriMarathiMongolianMyanmar (Burmese)NepaliNorwegianPersianPolishPortuguesePunjabiRomanianRussianSerbianSesothoSinhalaSlovakSlovenianSomaliSpanishSundaneseSwahiliSwedishTajikTamilTeluguThaiTurkishUkrainianUrduUzbekVietnameseWelshYiddishYorubaZulu
 
 
 
 
 
 
 
 
 
Text-to-speech function is limited to 200 characters
 
 
Options : History : Feedback : Donate Close
[展开全文]

=====利用PXE远程安装服务批量装机
==安装并配置DHCP服务器
yum -y install dhcp
cd /user/share/doc/dhcp-4.2.5/
cp dhcpd.conf.example /etc/dhcp/dhcpd.conf
vim /etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet 网段 netmask 子网掩码 {
range 开始ip 结束ip;
option routers 路由;
option broadcast-address ;
default-lease-time 600;
max-lease-time 7200;
next-server 服务器ip; #指定引导服务器
filename "pxelinux.0"; #指定引导文件
}
重启服务 systemctl restart dhcpd
==安装tftp-Server与syslinux
#tftp用于发布
#syslinux用于引导
yum -y intall tftp-server
yum -y install syslinux
==配置tftp
vim /etc/xinetd.d/tftp
将其中的
disable=yes
改为
disable=no
保存退出
systemctl start xinetd
==拷贝引导文件
cd /var/lib/tftpboot
cp /user/share/syslinux/pxelinux.0 ./
cp /var/ftp/yum/isolinux/vmlinuz ./
cp /var/ftp/yum/isolinux/initrd.img ./
cp /var/ftp/yum/isolinux/vesamenu.c32 ./
cp /var/ftp/yum/isolinux/boot.msg ./
==获取编辑启动菜单
mkdir /var/lib/tftpboot/pxelinux.cfg
cp /vaar/ftp/yum/isolinux/isolinux.cfg pxelinux.cfg/default
vim ./pxelinux.cfg/default
找到"label linux"行,在此行前添加:
label centos
menu label ^Install CentOS 7.1
menu default
kernel vmlinuz
append initrd=initrd.img inst.stage2=ftp://ip/yum inst.ks=ftp://ip/ks.cfg quiet
删除"menu label Test this⋯⋯"后边的"menu default" 行删除
保存退出
==配置自动安装脚本
yum -y install system-config-kickstart
system-config-kickstart

[展开全文]

pxe远程安装

统一,高效,标准,安全

安装Kickstart

添加BOOT分区,根分区20480系统类型

网络配置跳过预安装脚本

保存到ROOT目录下

打开anaconda-ks.cfg软件包信息复制再编辑ks文件

配置防火墙

[展开全文]

安装并配置DHCP服务器

cd dhcp-4.2.5/

cp dhcpd.conf.example /etc/dhcp/dhcp.conf

覆盖文件

粘贴进去

启动DHCP服务

步骤二安装tftp-server 与syslinux

yum -y install 进行安装

然后启动tftp但tftp不能直接启动 依赖 xinetd.d

所以编辑 vim /etc/xinetd.d/tftp

//找到 “disable=yes”,修改成no

然后启动

systemctl restart xinetd

然后拷贝引导模块

安装KICKSTART自动化安装

 

 

 

[展开全文]

授课教师

高级讲师

课程特色

视频(35)
下载资料(3)