# 树莓派部署 kickstart 服务器 [TOC] ## dhcp ```bash sudo apt install isc-dhcp-server cat > /etc/dhcp/dhcpd.conf < /etc/xinetd.d/tftp < /var/lib/tftpboot/pxelinux.cfg/default << EOF DEFAULT menu PROMPT 0 MENU TITLE PrideCloud TIMEOUT 200 TOTALTIMEOUT 6000 ONTIMEOUT local LABEL local MENU LABEL (local) MENU DEFAULT LOCALBOOT -1 LABEL centos7-x86_64 kernel /images/centos7-x86_64/vmlinuz MENU LABEL centos7-x86_64 append initrd=/images/centos7-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://192.168.10.50/kickstart/centos7.ks ipappend 2 MENU end EOF ``` ## 挂载镜像 ```bash sudo mount -t iso9660 -o loop,ro ~/CentOS-7-x86_64-Minimal-2003.iso /var/www/images/centos7 # 编辑kickstart 文件 sudo vim /var/www/kickstart/centos7.ks ``` ```bash # /var/www/kickstart/centos7.ks # platform =x86, AMD64, or Intel EM64T # os=centos7 # Install OS instead of upgrade install # Use text mode install text # System keyboard keyboard us # System language lang en_US # System timezone timezone Asia/ShangHai # System authorization information auth --useshadow --enablemd5 rootpw --iscrypted $1$XiTkwMpL$Y9cGAcWZC2koVK68De7LZ. # Firewall configuration firewall --disabled # SELinux configuration selinux --disabled # Use network installation url --url=http://192.168.10.50/images/centos7 # Clear the Master Boot Record zerombr # System bootloader configuration # bootloader --location=mbr # interface can be named as eth* bootloader --location=mbr --append="net.ifnames=0 biosdevname=0 rhgb quiet" # Partition clearing information clearpart --all --initlabel # Allow anaconda to partition the system as needed autopart # or # # create 1MB biosboot type partition, centos7 and centos8 . # part biosboot --fstype=biosboot --size=1 # # Disk partitioning information # part /boot --fstype=xfs --size=300 # part pv.122 --fstype="lvmpv" --grow # volgroup VolGroup00 --pesize=16384 pv.122 # logvol / --fstype="xfs" --size=10000 --name=LogVol00 --vgname=VolGroup00 # If any cobbler repo definitions were referenced in the kickstart profile, include them here. # repo --name=Centos7-Base --baseurl=http://192.168.10.50/repo/Centos7-Base # repo --name=Centos7-Updates --baseurl=http://192.168.10.50/repo/Centos7-Updates # repo --name=Centos7-extras --baseurl=http://192.168.10.50/repo/Centos7-extras # repo --name=Centos7-Epel --baseurl=http://192.168.10.50/repo/Centos7-Epel # repo --name=source-1 --baseurl=http://192.168.10.50/images/centos7 # add repo manually # repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream # Network information network --bootproto=dhcp --device=eth0 --onboot=on # Do not configure the X Window System skipx # Run the Setup Agent on first boot firstboot --disable # Reboot after installation reboot %pre set -x -v exec 1>/tmp/ks-pre.log 2>&1 # Once root's homedir is there, copy over the log. while : ; do sleep 10 if [ -d /mnt/sysimage/root ]; then cp /tmp/ks-pre.log /mnt/sysimage/root/ logger "Copied %pre section log to system" break fi done & # Enable installation monitoring %end %packages # if you need puppet to install pkgs, just uncomment it # @core @base tree nmap wget telnet zsh docker python-pip %end %post --nochroot set -x -v exec 1>/mnt/sysimage/root/ks-post-nochroot.log 2>&1 %end %post set -x -v exec 1>/root/ks-post.log 2>&1 wget http://192.168.10.50/pride/init.sh -O /tmp/init.sh chmod u+x /tmp/init.sh /tmp/init.sh # wget http://192.168.10.60/cblr/pride/init.sh -O /tmp/init.sh && chmod u+x /tmp/init.sh && /tmp/init.sh %end ```