pxe安装CentOS6.9系统

Posted 传说中的黑桃Q

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了pxe安装CentOS6.9系统相关的知识,希望对你有一定的参考价值。

  • 配置DHCP服务器
  • 安装配置dhcp 
yum -y install dhcp
cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
cat /etc/dhcp/dhcpd.conf | grep -v "^$" | grep -v "^#"
[[email protected] html]# cat /etc/dhcp/dhcpd.conf | grep -v "^$" | grep -v "^#"
    option domain-name "parpar.com";
    option domain-name-servers 8.8.8.8;
    default-lease-time 3600;
    max-lease-time 7200;
    log-facility local7;
    subnet 192.168.153.0 netmask 255.255.255.0 {
        range 192.168.153.150 192.168.153.190;
        option routers 192.168.153.128;
        filename "pxelinux.0";
    }
  • 配置tftp+http+pxe服务器

         一、安装配置tftp

yum -y install tftp tftp-server
chkconfig tftp on
service xinetd start

         二、配置PXE工作环境

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

        三、提供引导内核文件

 

cp /mnt/images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/
cp /mnt/isolinux/{vesamenu.c32,boot.msg,splash.jpg} /var/lib/tftpboot
mkdir /var/lib/tftpboot/pxelinux.cfg
cp /mnt/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default

        四、安装配置httpd服务

yum -y install httpd
mkdir /var/www/html/centos6
mount --bind /mnt /var/www/html/centos6
service httpd start

         五、生成ks文件

    centos 默认在 /root/ 下有anaconda-ks.cfg  

   

mv anaconda-ks.cfg ks.cfg
mv ks.cfg /var/www/html/
[[email protected] html]# cat /var/www/html/ks.cfg
# Kickstart file automatically generated by anaconda.

#version=DEVEL
install
cdrom
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto dhcp --noipv6
rootpw  --iscrypted $6$57O/oFGl1oyNv5X5$vT8S3A/4oYzkJfpWWmSwWd3RX8S0xoWVV0dPAx0PFDkXqZuLveBlHNk88Kaw7o5DX4G7lNyYA0GpJ5zuwhAEl.
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --enforcing
timezone --utc Asia/Shanghai
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart --all --drives=sda
#volgroup VolGroup --pesize=4096 pv.008002
#logvol / --fstype=ext4 --name=lv_root --vgname=VolGroup --grow --size=1024 --maxsize=51200
#logvol swap --name=lv_swap --vgname=VolGroup --grow --size=4000 --maxsize=4000

#part /boot --fstype=ext4 --size=500
#part pv.008002 --grow --size=1
url --url="http://192.168.153.128/centos6"

repo --name="CentOS"  --baseurl=http://192.168.153.128/centos6 --cost=100

%packages --nobase
@core
%end

  修改 sk.cfg 权限 

chmod 777 sk.cfg

六、修改  

vim /var/lib/tftpboot/pxelinux.cfg/default
    label linux
    menu label ^Install or upgrade an existing system
    menu default
    kernel vmlinuz
    append ks=http://192.168.153.128/ks.cfg initrd=initrd.img

配置完成,新启动虚拟机即可自动安装系统

以上是关于pxe安装CentOS6.9系统的主要内容,如果未能解决你的问题,请参考以下文章

CentOS6.9上安装cobbler2.6实现自动化安装Linux系统

在centos7实现PXE支持centos5,6,7的系统安装

CentOS 6.9下PXE+Kickstart无人值守安装操作系统附常见问题

CentOS6.9 Min UEFI failed to create screen故障

Centos 7.3 PXE全自动安装

centos6.9系统的安装