码迷,mamicode.com
首页 > 其他好文 > 详细

pxe安装CentOS6.9系统

时间:2018-05-23 18:59:14      阅读:170      评论:0      收藏:0      [点我收藏+]

标签:end   ftp   shanghai   app   sam   expr   3.1   menu   html   

  • 配置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 "^#"
[root@localhost 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/
[root@localhost 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系统

标签:end   ftp   shanghai   app   sam   expr   3.1   menu   html   

原文地址:https://www.cnblogs.com/heitaoq/p/9078151.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!