注:因为咱们是作实验,用一台服务器提供所须要的服务。linux
一. 在服务器上安装DHCP ,TFTP,HTTP 服务。 centos
三. 准备好kickstart应答文件。
方法一:安装带图形的制做工具 yum -y install system-config-kickstart
方法二:找一台都得安装成功的机器,在他的家目录里有一个anaconda-ks.cfg文件,拿过来改改就能够了。
把应答文件放到http服务的文件夹下 地址要和 tftpboot/pxelinux.cfg/default里的设置匹配
这里提供一个我本身的基于centos7最小化的ks文件供参考。服务器
#platform=x86, AMD64, or Intel EM64T #version=DEVEL # Install OS instead of upgrade install # Keyboard layouts keyboard 'us' # Root password rootpw --plaintext centos # Use network installation url --url="http://192.168.37.3/centos/7/os/x86_64" #这里要写上安装盘的http地址 # System language lang en_US # System authorization information auth --useshadow --passalgo=sha512 # Use text mode install text firstboot --disable # SELinux configuration selinux --disabled # Firewall configuration firewall --disabled # Network information network --bootproto=dhcp --device=eth0 # Reboot after installation reboot # System timezone timezone Asia/Shanghai # System bootloader configuration bootloader --append="net.ifnames=0" --location=mbr # Clear the Master Boot Record zerombr # Partition clearing information clearpart --all # Disk partitioning information part / --fstype="xfs" --size=100000 part /boot --fstype="xfs" --size=1000 part swap --fstype="swap" --size=2000 %packages @^minimal autofs %end %post mkdir /root/.ssh chmod 700 /root/.ssh #cat > /root/.ssh/authorized_keys <<EOF #ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSi4WucaraQXLsyyrluMBuKjClLscLulnLLzTshTX/L3t7c6Lw+Ap0zMbPuGer0NRuvnkESfsRNtnBXmuTDcuOYeOosMe59zGGmv04BZFipyDi7Acw94IeNF2HaU3pk6WIqkpqYlOnUAvAJg0fN+hEkVBy0S1pghVK7SWA0KFAUKuSrvd8ZNj3NK1Vj+ZPLXGDrnF8JyvfBz8oq+M+70dZRNhSsXCegHUfLY2tRvXOkjYb6tLQlQAgSifzI+FqB0Ix/VmsIspdAep/jwsKNjTf93fngoQ1ovdSu5ybzo95VF+UxAou1+9kNhr9/qJhSGp3StQHAVbERJdgjguhoA7h root@centos7.localdomain #EOF #chmod 600 /root/.ssh/authorized_keys mkdir /etc/yum.repos.d/bak mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak cat > /etc/yum.repos.d/test.repo <<EOF [base] baseurl=http://192.168.37.3/centos/7/os/x86_64 gpgcheck=0 EOF %end
四. 测试效果 架构