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

PXE全自动安装操作系统--centos7.3学习笔记

时间:2018-02-05 23:19:48      阅读:290      评论:0      收藏:0      [点我收藏+]

标签:cdrom   ast   partition   stage   word   miss   ide   initrd   安装   

PXE服务器:192.168.110.110

环境准备

安装软件

    # yum -y install dhcp tftp-server tftp vsftpd lftp

DHCP配置

# cd /var/dhcp
# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
# vim /etc/dhcp/dhcpd.conf
subnet 192.168.110.0 netmask 255.255.255.0 {
range 192.168.110.3 192.168.110.88;
next-server 192.168.110.110;
filename "pxelinux.0";
default-lease-time 600;
max-lease-time 7200;
}

TFTP配置

    # yum -y install xinetd
    # vim /etc/xinetd.d/tftp
disable =no
    # systemctl restart xinetd
    # systemctl stop firewalld
    # setenforce 0
    # chmod 777 /var/lib/tftpboot -R

拷贝引导文件:

    # yum provides */pexlinux.0
syslinux-4.05-13.el7.x86_64
    # yum install syslinux -y
    # cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot

准备default文件:

    # mkdir /var/lib/tftpboot/pxelinux.cfg
    # mount /dev/cdrom /mnt
    # cp /mnt/isolinux/* /var/lib/tftpboot/
    # cp /mnt/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
    # vim /var/lib/tftpboot/pxelinux.cfg/default
    label linux
    menu lable ^install CentOS Linux 7
    append initrd=initrd.img
    inst.stage2=ftp://192.168.110.110/centos7u3 inset.repo=ftp://192.168.110.110/centos7u3 ks=ftp://192.168.110.110/ks.cfg

vsftpd配置

    # cd /var/ftp/
    # mkdir centos7u3
    # mount /dev/cdrom centos7u3
    # systemctl start vsftpd

ks.cfg

    # platform=x86, AMD64, 或 Intel EM64T
    # version=DEVEL
    # Install OS instead of upgrade
        install
    # Keyboard layouts
    keyboard ‘us‘
    # Root password
    rootpw --iscrypted $1$mxXMfdmL$Sqdg6BBzPf76kWD4WpaU.1
user --name=martin --password=$6$qxZqHFOqqG.q3S1E$BDsWv00mnyllWVsDvfscFDDVLOXdoR/qplm5MISsUczVFZTc.HVGCEdKPmWJox5ZYfzIFafuSDq51nE8URJAA1 --iscrypted --gecos="martin"
    # System timezone
    timezone Asia/Shanghai --isUtc
    # Use network installation
        url --url="ftp://192.168.87.101/centos7"
    # System language
        lang en_US
    # Firewall configuration
    firewall --enabled
    # System authorization information
        auth  --useshadow  --passalgo=sha512
    # Use graphical install
        graphical
        firstboot --disable
    # SELinux configuration
            selinux --disable
    # Network information
            network  --bootproto=dhcp --device=eth0
    # Reboot after installation
            reboot
    # System bootloader configuration
            bootloader --location=mbr
    # Clear the Master Boot Record
    zerombr
    # Partition clearing information
    clearpart --all --initlabel
    # Disk partitioning information
    part /boot --fstype="xfs" --size=200
    part swap --fstype="swap" --size=2048
    part / --fstype="xfs" --grow --size=1

    %packages
    @core
    @base
    bash-completion
    vim-enhanced
    %end

%post
mkdir /etc/yum.repos.d/default
mv /etc/yum.repos.d/C* /etc/yum.repos.d/default
cat << eof > /etc/yum.repos.d/centos.repo
[centos]
name=centos
baseurl=ftp://172.16.8.100
enabled=1
gpgcheck=0
eof
%end

PXE全自动安装操作系统--centos7.3学习笔记

标签:cdrom   ast   partition   stage   word   miss   ide   initrd   安装   

原文地址:http://blog.51cto.com/13523939/2069192

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