RHEL7下PXE+NFS+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.50 192.168.1.90;
  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.30;
  filename "pxelinux.0";
  default-lease-time 600;
  max-lease-time 7200;
}
6.启动服务和开机自启动
systemctl start 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文件
label PXE-linux
  menu label ^Install System from PXE-RHEL7.0
  kernel vmlinuz
  append initrd=initrd.img ks=nfs://192.168.1.30/rhel7/ks.cfg ksdevice=eno16777736 ip=dhcp quiet
8.配置tftp-server syslinux
vim /etc/xinetd.d/tftp
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
10.安装配置NFS
yum -y install nfs*                           #安装nfs服务
mkdir /rhel7                                    #根下创建安装文件目录
cd /rhel7                                        #进入RHEL7.0目录
cp -rf /mnt/* /rhel7/                       #复制光盘内容到rhel7目录下
vim /etc/exports                           #nfs共享系统文件  
/rhel7 192.168.1.0/24(rw,sync,no_root_squash,no_all_squash)
11.启动服务
systemctl start nfs-server
systemctl enable nfs-server
12.无图形界面配置kickstart一键安装应答文件
vim /rhel7/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
# 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
 
# Use NFS installation media
nfs --server=192.168.1.30 --dir=/rhel7
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --asprimary --fstype="xfs" --size=500
part swap --asprimary --fstype="swap" --size=2048
part / --asprimary --fstype="xfs" --size=10240
part /home --fstype="xfs" --grow --size=1
 
%packages                      
@base
@core
@desktop-debugging
@dial-up
@fonts
@gnome-desktop
@guest-agents
@guest-desktop-agents
@input-methods
@internet-browser
@kde-desktop
@multimedia
@print-client
@x11
%end
图形化系统可以安装Kickstart
yum -y install system-config-kickstart.noarch
system-config-kickstart
13.修改SELinux状态
vim /etc/sysconfig/selinux
SELINUX=disabled
14.开放防火墙服务和端口
firewall-cmd --permanent --add-service=dhcp
firewall-cmd --permanent --add-service=nfs
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

配置文件详细内容
1.dhcpd.conf文件内容
[root@localhost tftpboot]# cat /etc/dhcp/dhcpd.conf
subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.50 192.168.1.90;
  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.30;
  filename "pxelinux.0";
  default-lease-time 600;
  max-lease-time 7200;
}
2.tftp文件内容
[root@localhost tftpboot]# cat /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
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}
3.default文件内容
[root@localhost tftpboot]# cat /var/lib/tftpboot/pxelinux.cfg/default
default vesamenu.c32
timeout 600
 
display boot.msg
 
# Clear the screen when exiting the menu, instead of leaving the menu displayed.
# For vesamenu, this means the graphical background is still displayed without
# the menu itself for as long as the screen remains in graphics mode.
menu clear
menu background splash.png
menu title Red Hat Enterprise Linux 7.0
menu vshift 8
menu rows 18
menu margin 8
#menu hidden
menu helpmsgrow 15
menu tabmsgrow 13
 
# Border Area
menu color border * #00000000 #00000000 none
 
# Selected item
menu color sel 0 #ffffffff #00000000 none
 
# Title bar
menu color title 0 #ff7ba3d0 #00000000 none
 
# Press [Tab] message
menu color tabmsg 0 #ff3a6496 #00000000 none
 
# Unselected menu item
menu color unsel 0 #84b8ffff #00000000 none
 
# Selected hotkey
menu color hotsel 0 #84b8ffff #00000000 none
 
# Unselected hotkey
menu color hotkey 0 #ffffffff #00000000 none
 
# Help text
menu color help 0 #ffffffff #00000000 none
 
# A scrollbar of some type? Not sure.
menu color scrollbar 0 #ffffffff #ff355594 none
 
# Timeout msg
menu color timeout 0 #ffffffff #00000000 none
menu color timeout_msg 0 #ffffffff #00000000 none
 
# Command prompt text
menu color cmdmark 0 #84b8ffff #00000000 none
menu color cmdline 0 #ffffffff #00000000 none
 
# Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message.
 
menu tabmsg Press Tab for full configuration options on menu items.
 
menu separator # insert an empty line
menu separator # insert an empty line
 
label PXE-linux
  menu label ^Install System from PXE-RHEL7.0
  kernel vmlinuz
  append initrd=initrd.img ks=nfs://192.168.1.30/rhel7/ks.cfg ksdevice=eno16777736 ip=dhcp quiet
 
label linux
  menu label ^Install Red Hat Enterprise Linux 7.0
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.0\x20Server.x86_64 quiet
 
label check
  menu label Test this ^media & install Red Hat Enterprise Linux 7.0
  menu default
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.0\x20Server.x86_64 rd.live.check quiet
 
menu separator # insert an empty line
 
# utilities submenu
menu begin ^Troubleshooting
  menu title Troubleshooting
 
label vesa
  menu indent count 5
  menu label Install Red Hat Enterprise Linux 7.0 in ^basic graphics mode
  text help
        Try this option out if you're having trouble installing
        Red Hat Enterprise Linux 7.0.
  endtext
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.0\x20Server.x86_64 xdriver=vesa nomodeset quiet
 
label rescue
  menu indent count 5
  menu label ^Rescue a Red Hat Enterprise Linux system
  text help
        If the system will not boot, this lets you access files
        and edit config files to try to get it booting again.
  endtext
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.0\x20Server.x86_64 rescue quiet
 
label memtest
  menu label Run a ^memory test
  text help
        If your system is having issues, a problem with your
        system's memory may be the cause. Use this utility to
        see if the memory is working correctly.
  endtext
  kernel memtest
 
menu separator # insert an empty line
 
label local
  menu label Boot from ^local drive
  localboot 0xffff
 
menu separator # insert an empty line
menu separator # insert an empty line
 
label returntomain
  menu label Return to ^main menu
  menu exit
 
menu end
4.ks.cfg文件内容
[root@localhost tftpboot]# cat /rhel7/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
# System timezone
timezone Asia/Shanghai
# 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
 
# Use NFS installation media
nfs --server=192.168.1.30 --dir=/rhel7
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --asprimary --fstype="xfs" --size=500
part swap --asprimary --fstype="swap" --size=2048
part / --asprimary --fstype="xfs" --size=10240
part /home --fstype="xfs" --grow --size=1
 
%packages                      
@base
@core
@desktop-debugging
@dial-up
@fonts
@gnome-desktop
@guest-agents
@guest-desktop-agents
@input-methods
@internet-browser
@kde-desktop
@multimedia
@print-client
@x11
%end
5.tftpboot目录下的文件
[root@localhost tftpboot]# pwd
/var/lib/tftpboot
[root@localhost tftpboot]# ll
总用量 39688
-rw-r--r--. 1 root root       74 6月   4 17:10 boot.msg
-r--r--r--  1 root root 35544564 6月   4 17:28 initrd.img
-rw-r--r--  1 root root    26460 6月   4 17:29 pxelinux.0
drwxr-xr-x. 2 root root       20 6月   4 17:10 pxelinux.cfg
-r--r--r--  1 root root   155792 6月   4 17:33 vesamenu.c32
-r-xr-xr-x  1 root root  4902000 6月   4 17:28 vmlinuz
6.pxelinux.cfg目录下的文件
[root@localhost pxelinux.cfg]# pwd
/var/lib/tftpboot/pxelinux.cfg
[root@localhost pxelinux.cfg]# ll
总用量 4
-r--r--r--. 1 root root 3343 6月   4 17:10 default

RHEL7下PXE+NFS+Kickstart无人值守安装操作系统的更多相关文章

  1. RHEL7下PXE+Apache+Kickstart无人值守安装操作系统

    RHEL7下PXE+Apache+Kickstart无人值守安装操作系统 1.配置yum源 vim /etc/yum.repos.d/development.repo [development] na ...

  2. RHEL7下PXE+FTP+Kickstart无人值守安装操作系统

    1.配置yum源 vim /etc/yum.repos.d/development.repo [development] name=yum server baseurl=file:///mnt ena ...

  3. [转]CentOS 6.4下PXE+Kickstart无人值守安装操作系统

    一.简介 1.1 什么是PXE PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持 ...

  4. CentOS 6.4下PXE+Kickstart无人值守安装操作系统 转

    一.简介 1.1 什么是PXE PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持 ...

  5. CentOS 6.6下PXE+Kickstart无人值守安装操作系统

    一.简介 1.1 什么是PXE PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持 ...

  6. 【转载】CentOS 6.4下PXE+Kickstart无人值守安装操作系统

    [转载]CentOS 6.4下PXE+Kickstart无人值守安装操作系统 转自:CentOS 6.4下PXE+Kickstart无人值守安装操作系统 - David_Tang - 博客园 http ...

  7. Centos下PXE+Kickstart无人值守安装操作系统

    一.简介 1.1 什么是PXE PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持 ...

  8. CentOS 7下PXE+Kickstart无人值守安装操作系统

    1.简介 1.1. 什么是PXE PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支 ...

  9. CentOS 6.5下PXE+Kickstart无人值守安装操作系统centos7.3

    CentOS 6.5下PXE+Kickstart无人值守安装操作系统centos7.3 一.简介 1.1 什么是PXE PXE(Pre-boot Execution Environment,预启动执行 ...

随机推荐

  1. Centos下安装配置LAMP(Linux+Apache+MySQL+PHP)

    Centos下安装配置LAMP(Linux+Apache+MySQL+PHP)   关于LAMP的各种知识,还请大家自行百度谷歌,在这里就不详细的介绍了,今天主要是介绍一下在Centos下安装,搭建一 ...

  2. Ubuntu14 或是其他系统当中关于sublimeSFTP超时解决方法

    一直都使用Sublime的SFTP功能,感觉还不错,好用,但是最近不知道怎么了,使用不成了,提示超时了,于是在网上找一下解决方法,没有找到,于是自己想着试试看,于在搞了一会,发现只要把配制文件当中的s ...

  3. Unable to find the ncurses libraries or the required header files解决

    问题: 解决方法: sudo apt-get install ncurses-dev 参考:Unable to find the ncurses libraries or the required h ...

  4. Spark的RDD编程(二)公众号undefined110

    创建RDD有两种方式:①读取外部数据集,lines=sc.textFile("README.md").②对一个集合进行并行化,lines=sc.parallelize([" ...

  5. java interface

  6. IOS中UIButton和UIImageView的区别

    1.使用场合 UIImageView:如果仅仅是为了显示图片,不需要监听图片的点击事件 UIButton:既要显示图片,又要监听图片等点击事件 2.相同点 都能显示图片 3.不同点 UIButton能 ...

  7. ASP.NET内置对象

    ASP.NET中有六个内置对象 Response:向客户端输出信息或设置客户端输出状态. Request:获取客户端信息. Server:访问服务器的方法和属性. Application:用于将信息保 ...

  8. Spring基础介绍

    Spring属于轻量级还是重量级框架?   这需针对使用Spring的功能而言,比如我们常使用其核心服务整合SSH,这样则为轻量级. 如果使用其大部分服务则可以理解为重量级.   普通JAVA项目环境 ...

  9. hiho #1044 : 状态压缩·一

    描述 小Hi和小Ho在兑换到了喜欢的奖品之后,便继续起了他们的美国之行,思来想去,他们决定乘坐火车前往下一座城市——那座城市即将举行美食节! 但是不幸的是,小Hi和小Ho并没有能够买到很好的火车票—— ...

  10. CSS样式中字体乱码

    今天写程序时,明明设置了label标签的属性font-family:"微软雅黑"的,但是字体的显示的效果就是宋体,后来查看了一下网页源代码,结果发现设置的字体为中文的都是乱码,难怪 ...