Kickstart服务器

IP: 192.168.136.253   掩码:255.255.255.0   网关:192.168.136.2   DNS:192.168.136.2

  • 安装部署HTTP服务器

# mkdir -p /content/pub/rhel7/x86_64/{isos,dvd}/

上传RedHat安装光盘镜像至 /content/pub/rhel7/x86_64/isos/rhel-server-7.2-x86_64-dvd.iso

安装HTTP服务器(Nginx)

# rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
# yum -y install nginx

修改默认网站配置文件

# vi /etc/nginx/conf.d/default.conf

server {
listen ;
server_name localhost;
root /content;
index index.html index.htm; location ^~ /pub/ {
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
} error_page /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

启动Nginx服务并设置为开机启动

# systemctl start nginx
# systemctl enable nginx

修改网站目录SELinux类型

# chcon -t public_content_t -R /content/

设置开机自动挂载光盘镜像到/content/pub/rhel7/x86_64/dvd

# echo "/content/pub/rhel7/x86_64/isos/rhel-server-7.2-x86_64-dvd.iso   /content/pub/rhel7/x86_64/dvd   iso9660   loop,ro   0 0" >> /etc/fstab
# mount -a
  • 安装部署DHCP服务器
# yum -y install dhcp

修改配置文件

# vi /etc/dhcp/dhcpd.conf

log-facility local7;

option domain-name "example.com";
option domain-name-servers 192.168.136.2; default-lease-time ;
max-lease-time ; subnet 192.168.136.0 netmask 255.255.255.0 {
range 192.168.136.100 192.168.136.200;
option routers 192.168.136.2; #路由器IP,可以写网关IP
next-server 192.168.136.253; #TFTP Server 的IP地址
filename "pxelinux.0"; #pxelinux 启动文件位置
}

启动DHCP服务并设置为开机启动

# systemctl start dhcpd
# systemctl enable dhcpd
  • 安装部署TFTP服务器
# yum -y install tftp-server

修改配置文件

# vi /etc/xinetd.d/tftp

# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no #把这行改成no即可
per_source =
cps =
flags = IPv4
}

启动TFTP服务并设置为开机自启动

# systemctl start tftp
# systemctl enable tftp

将客户端所需启动文件复制到TFTP服务器

# yum -y install syslinux
# cp /usr/share/syslinux/pxelinux. /var/lib/tftpboot/

复制启动镜像文件和启动配置文件至TFTP共享目录

# cp /content/pub/rhel7/x86_64/dvd/isolinux/{boot.msg,splash.png,vmlinuz,initrd.img} /var/lib/tftpboot/
# mkdir /var/lib/tftpboot/pxelinux.cfg/
# cp /content/pub/rhel7/x86_64/dvd/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
# chmod /var/lib/tftpboot/pxelinux.cfg/default

修改启动配置文件

# vi /var/lib/tftpboot/pxelinux.cfg/default

default linux
timeout 600 ... label linux
menu label ^Install Red Hat Enterprise Linux 7.2
kernel vmlinuz
append initrd=initrd.img ks=http://192.168.136.253/ks-config/ks7.cfg
...
  • 创建Kickstart自动应答文件

# mkdir /content/ks-config/

# vi /content/ks-config/ks7.cfg

#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# Root password
rootpw --plaintext redhat
# System services
services --enabled="chronyd"
# System timezone
timezone Asia/Shanghai --isUtc
# Use network installation
url --url="http://192.168.136.253/pub/rhel7/x86_64/dvd"
# System language
lang en_US.UTF-8
# System authorization information
auth --enableshadow --passalgo=sha512
# Use graphical install
graphical # Network information
network --bootproto=dhcp --device=eth0
# Reboot after installation
reboot
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part swap --fstype="swap" --size=2048
part /boot --fstype="xfs" --size=256
part / --fstype="xfs" --grow --size=1

%packages
  @^minimal
  @core
  chrony
  kexec-tools

%end

%post
cat > /etc/yum.repos.d/rhel-dvd.repo << EOF
[rhel-dvd]
name=rhel dvd
baseurl=http://192.168.136.253/pub/rhel7/x86_64/dvd
gpgcheck=0
enabled=1
EOF
%end

或者在有图形界面的RedHat上安装kickstart图形化配置软件system-config-kickstart

# yum -y install system-config-kickstart

运行system-config-kickstart

# system-config-kickstart

  • 开通防火墙
# firewall-cmd --permanent --add-service={tftp,http}
# firewall-cmd --reload
  •  启动客户端,安装部署系统

在所有客户端主机的BIOS中,将第一启动方式设置为PXE网络启动。设置完成后,重启所有客户端计算机即可完成大规模集中安装部署操作系统。

RedHat7搭建无人值守自动安装Linux操作系统(PXE+Kickstart)的更多相关文章

  1. PXE无人值守实现批量化自动安装Linux系统

    设想一个场景:假如让你给1000台服务器装系统,你会怎么做?跑去每一台服务器给它安装系统吗?显然不会.. 一.概括 通过网络引导系统的做法可以不必从硬盘.软盘或CD-ROM硬盘,而是完全通过网络来引导 ...

  2. pxe+kickstart实现无人值守批量安装linux

    pxe+kickstart实现无人值守批量安装linux 实验准备:主机myrhel2作为服务器端,新建一个没有安装操作系统的虚拟主机,而且其与服务器端在同一个网段 安装的条件: 服务器端:      ...

  3. PXE网络启动无人值守自动安装 centos 全程实录

    PXE网络启动无人值守自动安装 centos 全程实录 http://shayi1983.blog.51cto.com/4681835/1549854/ 搭建Pxe服务器无人听应答全自动安装CentO ...

  4. (转)Cobbler无人值守批量安装Linux系统

    本文目录: 1.1 pxe安装系统 1.2 cobbler基本介绍 1.3 安装和配置cobbler 1.3.1 安装cobbler 1.3.2 配置dhcp和tftp 1.4 cobbler从本地光 ...

  5. 探索PHP+Nginx(一) 安装Linux操作系统

    每次学习一种新的开发语言的时候,都要经历一个很纠结的过程,除非你运气很好或者准备工作充分,否则你在这个过程中总会耗费大量的时间和精力,当然你也会受益很多.而这个过程就是,开发环境的基础搭建,看似是装几 ...

  6. 自动安装 linux 系统

    实现自动安装 centos 6 和 centos 7 实现自动安装 Linux 系统需要在虚拟机上安装三个服务:apache .tftp.dhcp 三个服务放在一台虚拟机上即可 一.DHCP 服务器的 ...

  7. 安装linux操作系统--浪潮服务器

    一直都是在虚拟机上进行安装linux操作系统,在服务器上安装的很少,也没有碰到过没找到驱动的情况,例如什么raid卡驱动,网卡驱动等异常情况的发生. 这次安装了两台服务器,浪潮的提供的服务器,硬盘是两 ...

  8. 安装Linux操作系统,学习Liunx基础

    安装Linux操作系统 遇到的问题以及解决方法 问题1:安装虚拟机时出现以下界面 解决方法 我的电脑--右击--管理--服务和应用服务--服务--在服务里启动:Device Install Servi ...

  9. 在虚拟机里面安装Linux操作系统

    在这篇文章中以VMware14为例,Linux操作系统采用CentOS7进行讲解如何在虚拟机中安装Linux操作系统. 一.选择创建新的虚拟机 二.在选择虚拟机配置界面选择“自定义(高级)”选项,然后 ...

随机推荐

  1. 【GDOI 2011 DAY2 T3】零什么的最讨厌了 (快速求阶乘、中国剩余定理)

    问题描述: 林记在做数学习题的时候,经常遇到这种情况:苦思冥想了很久终于把问题解出来,结果发现答案是0,久而久之林记在得到习题答案是0的时候就没有了做出一道难题的成就感.于是林记决定:以后出题,答案一 ...

  2. Android listview.item.clear()与listview.clear()的区别

    listview.clear()与listview.item.clear()的区别就是使用了listview.item.clear()后,listview控件中仍然保存着listviewitem项的结 ...

  3. 《unix网络编程》笔记

    inet_pton和inetntop函数.字母p和n代表presentation和numeric.地址的表达presentation格式通常是ASCIL串,数值(numeric)格式则是存在于套接字地 ...

  4. poj2154

    利用bzoj2705的结论我们很容易优化这道等价类计数的问题 sum(n^gcd(i,n))/n mod p (1<=i<=n) =sum(phi(n/L)*n^L)/n mod p (n ...

  5. Hash Killer I II

    题意大概: 1.字符串hash不取模,自动溢出  构造数据卡这种hash 2.字符串hash取模1000000007,构造数据卡这种hash 题解传送门:VFleaKing http://vfleak ...

  6. JS思维导图

  7. C# Get Desktop Screenshot ZZ

    I found this feature while looking inside Graphics class and since it was so simple to use, I decide ...

  8. 初学acm感想

    初学acm,觉得大部分题对我来说都是陌生的,好多类型没见过,好多题没思路,打击确实不小,或许这个阶段正是比较能考验人的时候吧,因为只有坚持下来才有收获,没有人生下来就是大神,所以不能气馁更不能放弃,有 ...

  9. HDOJ/HDU 1085 Holding Bin-Laden Captive!(非母函数求解)

    Problem Description We all know that Bin-Laden is a notorious terrorist, and he has disappeared for ...

  10. HDOJ/HDU 1087 Super Jumping! Jumping! Jumping!(经典DP~)

    Problem Description Nowadays, a kind of chess game called "Super Jumping! Jumping! Jumping!&quo ...