RHEL7下PXE+Apache+Kickstart无人值守安装操作系统
Posted 随风☆飘扬
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了RHEL7下PXE+Apache+Kickstart无人值守安装操作系统相关的知识,希望对你有一定的参考价值。
RHEL7下PXE+Apache+Kickstart无人值守安装操作系统
1.配置yum源
vim /etc/yum.repos.d/development.repo
[development]
name=yum server
baseurl=file:///mnt
enabled=1
gpgcheck=0
2.挂载光盘
mount /dev/sr0 /mnt
3.安装相关软件包
yum install dhcp syslinux xinetd tftp-server
4.配置dhcp
vim /etc/dhcp/dhcpd.conf
5.添加内容
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.121 192.168.1.200; //ip地址池
option domain-name-servers 192.168.1.1; //网关地址
option domain-name "internal.example.org";
option routers 192.168.1.1; //网关地址
option broadcast-address 192.168.1.255;
next-server 192.168.1.32; //Apache服务器地址
filename "pxelinux.0";
default-lease-time 600;
max-lease-time 7200;
}
6.启动服务和开机自启动
systemctl start dhcpd.service
systemctl enable dhcpd.service
systemctl enable dhcpd.service
7.复制启动文件
cd /var/lib/tftpboot/ #进入/var/lib/tftpboot/
cp /mnt/isolinux/initrd.img /var/lib/tftpboot #复制initrd.img到/var/lib/tftpboot目录下
cp /mnt/isolinux/vmlinuz /var/lib/tftpboot/ #复制vmlinuz到/var/lib/tftpboot目录下
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/ #复制pxelinux.0到/var/lib/tftpboot目录下
cp /mnt/isolinux/vesamenu.c32 /var/lib/tftpboot/ #复制vesamenu.c32到/var/lib/tftpboot目录下
cp /mnt/isolinux/boot.msg /var/lib/tftpboot/ #复制boot.msg到/var/lib/tftpboot目录下
cd /var/lib/tftpboot/ #进入/var/lib/tftpboot目录下
mkdir pxelinux.cfg #在/var/lib/tftpboot目录下创建pxelinux.cfg目录
cd pxelinux.cfg/ #进入pxelinux.cfg目录下
cp /mnt/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default #复制isolinux.cfg到pxelinux.cfg目录下并命名为default
vim default #在/var/lib/tftpboot/pxelinux.cfg目录下修改default文件
cp /mnt/isolinux/initrd.img /var/lib/tftpboot #复制initrd.img到/var/lib/tftpboot目录下
cp /mnt/isolinux/vmlinuz /var/lib/tftpboot/ #复制vmlinuz到/var/lib/tftpboot目录下
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/ #复制pxelinux.0到/var/lib/tftpboot目录下
cp /mnt/isolinux/vesamenu.c32 /var/lib/tftpboot/ #复制vesamenu.c32到/var/lib/tftpboot目录下
cp /mnt/isolinux/boot.msg /var/lib/tftpboot/ #复制boot.msg到/var/lib/tftpboot目录下
cd /var/lib/tftpboot/ #进入/var/lib/tftpboot目录下
mkdir pxelinux.cfg #在/var/lib/tftpboot目录下创建pxelinux.cfg目录
cd pxelinux.cfg/ #进入pxelinux.cfg目录下
cp /mnt/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default #复制isolinux.cfg到pxelinux.cfg目录下并命名为default
vim default #在/var/lib/tftpboot/pxelinux.cfg目录下修改default文件
添加内容:
label PXE-linux
menu label ^Install System from PXE-RHEL7.0
menu default
kernel vmlinuz
append initrd=initrd.img ks=http://192.168.1.32/ks.cfg ksdevice=eno16777736 ip=dhcp quiet
8.配置tftp-server syslinux
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
9.启动服务和开机自启动
systemctl start xinetd.service
systemctl enable xinetd.service
systemctl enable xinetd.service
10.安装配置httpd
yum -y install httpd
mkdir /var/www/html/iso
cp -rf /mnt/* /var/www/html/iso
11.启动服务
systemctl start httpd
systemctl enable httpd
systemctl enable httpd
12.无图形界面配置kickstart一键安装应答文件
vim /var/www/html/ks.cfg
#platform=x86, AMD64, 或 Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard ‘us‘# Reboot after installation
reboot
# Root password
rootpw --iscrypted $1$FyasdJen$q2zUDfVq.ln1FmIlP8O/m0 //root密码为7788521
# System timezone
timezone Asia/Shanghai
# Use network installation
url --url="http://192.168.1.32/iso"
# System language
lang en_US
# Firewall configuration
firewall --disabled
# Network information
network --bootproto=dhcp --device=eno16777736
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# SELinux configuration
selinux --disabled
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part swap --asprimary --fstype="swap" --size=2048
part /boot --asprimary --fstype="xfs" --size=500
part / --asprimary --fstype="xfs" --grow --size=1
%packages
@base
@compat-libraries
@core
%end
有图形化系统可以安装Kickstart生产ks.cfg文件
yum -y install system-config-kickstart.noarch
system-config-kickstart
13.修改SELinux状态
vim /etc/sysconfig/selinux
SELINUX=disabled
SELINUX=disabled
14.开放防火墙服务和端口
firewall-cmd --permanent --add-service=dhcp
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-port=69/udp
firewall-cmd --permanent --add-port=111/tcp
firewall-cmd --permanent --add-port=111/udp
firewall-cmd --permanent --add-port=20048/tcp
firewall-cmd --permanent --add-port=20048/udp
firewall-cmd --reload
以上是关于RHEL7下PXE+Apache+Kickstart无人值守安装操作系统的主要内容,如果未能解决你的问题,请参考以下文章
Linux学习日志day1——无人值守系统安装DHCP+TFTP+PXE+Kickstar
RHEL7下PXE+NFS+Kickstart无人值守安装操作系统
RHEL7下PXE+NFS+Kickstart无人值守安装操作系统
RHEL7下PXE+FTP+Kickstart无人值守安装操作系统