1. 关闭selinux
iptables
2. 安装dhcp xinetd
tftp-server nfs syslinux
1 |
yum install dhcp xinetd tftp-server nfs syslinux -y |
3. 新建/opt/iso/{6u7,ks} --放置镜像文件,ks配置文件
1 |
mkdir -p /opt/iso/{6u7,ks} |
4. 把tftp的主目录更改为/tftpboot
5. 拷贝pxelinux.0作为引导
1 |
cp /usr/share/syslinux/pxelinux.0 /tftpboot |
6. 挂载镜像
1 |
mount /dev/cdrom /opt/iso/6u7 |
7. 制作ks文件,使用linux自带的kickstart工具制作
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# base.ks #platform=x86, AMD64, or Intel EM64T #version=DEVEL # Firewall configuration firewall --disabled # Install OS instead of upgrade install # Use NFS installation media nfs --server=192.168.209.100 --dir=/opt/iso/6u7 # Root password rootpw --iscrypted $6$aljC4Kk9O.WCPonb$68xhODKqDM0lbN88l6uzYfE5kuCgdHbqqs25ZMK891FAFVKjjn2lS iRcsojKbtN/9Dx/VDv/V6rJfKucRTS3T1 # Network information network --bootproto=dhcp --device=eth0 --onboot=on # System authorization information auth --useshadow --passalgo=md5 # Use text mode install text firstboot --disable # System keyboard keyboard us # System language lang en_US # SELinux configuration selinux --disabled # Do not configure the X Window System skipx # Installation logging level logging --level=info # Reboot after installation reboot # System timezone timezone --isUtc Asia/Shanghai # System bootloader configuration bootloader --location=mbr --driveorder=sda --append="console=tty0 console=ttyS0,115200" # Clear the Master Boot Record zerombr # Partition clearing information clearpart --all --initlabel # Disk partitioning information part /boot --asprimary --fstype="ext4" --size=512 --ondrive=sda part swap --asprimary --fstype="swap" --size=2048 --ondrive=sda part / --asprimary --fstype="ext4" --grow --size=200 --ondrive=sda %packages @base @core %end %post reboot EOF |
8. 复制内核文件和启动程序
1 2 |
cp /opt/iso/6u7/isolinux/vmlinuz /tftpboot/ cp /opt/iso/6u7/isolinux/initrd.img /tftpboot/ |
9. 在tftpboot目录中新建pxelinux.cfg,放置defalut
1 2 |
mkdir /tftpboot/pxelinux.cfg cp /opt/iso/6u7/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default |
10. 配置dhcp
1 2 3 4 5 6 7 8 |
default-lease-time 60; max-lease-time 120; subnet 192.168.209.0 netmask 255.255.255.0 { option subnet-mask 255.255.255.0; range dynamic-bootp 192.168.209.1 192.168.209.100; next-server 192.168.209.100; filename "pxelinux.0"; } |
11. 配置/etc/exports文件
1 2 |
/opt/iso *(rw,sync,no_root_squash) /opt/iso/6u7 *(rw,sync,no_root_squash) |
12. 启动所有服务
1 2 3 4 |
service xinetd start service rpcbind start service nfs start service dhcp start |