Open always-waiting opened 3 years ago
ks.cfg
auth --enableshadow --passalgo=sha512
cdrom
graphical
firstboot --enable
keyboard --vckeymap=cn --xlayouts='cn'
lang zh_CN.UTF-8
network --bootproto=dhcp --device=eth0 --ipv6=auto --activate network --hostname=localhost.localdomain
rootpw --iscrypted $6$owsYZffHmB.UhDFZ$Y/XNBqU0oLMl8qfDwuSRoHxLDGEefk4RIEXJIzwD91lvm71aTOxsGGY8I1Xe.N8hmKEWaUV50agAMNo/nHJpz.
services --enabled="chronyd"
timezone Asia/Shanghai --isUtc
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda autopart --type=lvm
clearpart --none --initlabel
%packages @^minimal @core chrony kexec-tools
%end
%addon com_redhat_kdump --enable --reserve-mb='auto'
%end
%anaconda pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty %end
default
default vesamenu.c32
timeout 600
MENU TITLE welcome to centos.
label local menu label Boot from ^local drive localboot 0xffff
MENU SEPARATOR label linux menu label ^Install or upgrade an existing system for ks
menu default kernel vmlinuz append initrd=initrd.img ks=http://172.18.41.133/ks_config/CentOS7-ks.cfg
MENU SEPARATOR label vesa menu label Install system with ^basic video driver kernel vmlinuz append initrd=initrd.img xdriver=vesa nomodeset
1.安装基础软件,如果是最小化安装的话 yum install -y bash-completion vim lrzsz wget expect net-tools nc nmap tree dos2unix htop iftop iotop unzip telnet sl psmisc nethogs glances bc ntpdate
2.配置yum源 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo yum clean all yum makecache
3.关闭防火墙 [root@kickstart yum.repos.d]# systemctl stop firewalld [root@kickstart yum.repos.d]# systemctl disable firewalld Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@client01 ~]# sed -i 's/enforcing/disabled/g' /etc/selinux/config [root@kickstart ~]# getenforce Disabled
4.关闭vmware的dhcp服务,设置linux静态ip [root@kickstart ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33 TYPE="Ethernet" PROXY_METHOD="none" BROWSER_ONLY="no" BOOTPROTO="static" DEFROUTE="yes" IPV4_FAILURE_FATAL="no" IPV6INIT="yes" IPV6_AUTOCONF="yes" IPV6_DEFROUTE="yes" IPV6_FAILURE_FATAL="no" IPV6_ADDR_GEN_MODE="stable-privacy" NAME="ens33" UUID="b4c06569-fc94-4e94-9c63-0391c7a35432" DEVICE="ens33" ONBOOT="yes" IPADDR=172.18.41.133 NETMASK=255.255.255.0 DNS1=1.2.4.8 GATEWAY=172.18.41.2
5.系统检查 [root@kickstart ~]# cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core)
[root@kickstart ~]# uname -r 3.10.0-862.el7.x86_64
[root@kickstart ~]# ifconfig ens33 |awk 'NR==2 {print $2}' 172.18.41.133
[root@kickstart ~]# iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination
Chain FORWARD (policy ACCEPT) target prot opt source destination
Chain OUTPUT (policy ACCEPT) target prot opt source destination
6.时间同步更新 [root@kickstart ~]# ntpdate -u ntp.aliyun.com 修改时区 [root@kickstart ~]# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime [root@kickstart ~]# date Tue Jul 21 19:05:06 CST 2020
PXE准备流程
关防火墙 systemctl stop firewalld
安装dhcp服务 yum install dhcp -y cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example ./dhcpd.conf 根据需求,修改配置文件/etc/dhcp/dhcpd.conf systemctl start dhcpd
安装tftp服务 yum install tftp-server tftp -y systemctl start tftp.socket
安装必要启动文件 yum install syslinux -y cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/ 去镜像文件中拷贝vmlinuz 拷贝内存系统
创建pxe启动文件 mkdir pxelinux.cfg vim pxelinux.cfg/default
1.安装febootstrap https://www.dwhd.org/20160630_111307.html
2.构建目录结构
initramfs.gz就是需要的内存镜像,如果需要对内存镜像做定制化处理,可是使用chroot命令。例如:
3.参考链接 https://cloud.tencent.com/developer/article/1454524 https://www.dwhd.org/20160630_111307.html https://cloud.tencent.com/developer/article/1584786 http://linuxcoming.com/blog/2019/06/21/build_ram_os.html