Bo's Oracle Station

查看: 1686|回复: 0

课程第20次

[复制链接]

27

主题

27

帖子

183

积分

超级版主

Rank: 8Rank: 8

积分
183
发表于 2019-8-22 21:51:10 | 显示全部楼层 |阅读模式
完整的kickstart文件:
主节:
  1. #version=DEVEL
  2. # System authorization information
  3. auth --enableshadow --passalgo=sha512
  4. url --url="http://192.168.0.254/pub/rhel7/dvd/"
  5. # Use CDROM installation media
  6. # Use graphical install
  7. text
  8. # Run the Setup Agent on first boot
  9. firstboot --disable
  10. # Keyboard layouts
  11. keyboard --vckeymap=us --xlayouts='us'
  12. # System language
  13. lang en_US.UTF-8

  14. # Network information
  15. network  --bootproto=dhcp

  16. # Root password
  17. rootpw --plaintext redhat123
  18. # System services
  19. services --enabled="chronyd,sshd"
  20. # System timezone
  21. timezone Asia/Shanghai --isUtc
  22. # X Window System configuration information
  23. xconfig  --startxonboot
  24. # System bootloader configuration
  25. # Partition clearing information
  26. # Disk partitioning information
  27. %include /tmp/disk.txt
复制代码
包节:
  1. %packages
  2. @^web-server-environment
  3. %end
复制代码
后节:
  1. %post
  2. KS_IPADDR=$(ifconfig | head -n 2 | tail -n 1 | cut -c 14- | cut -d ' ' -f 1)
  3. KS_IPADDR_SHORT=$(ifconfig | head -n 2 | tail -n 1 | cut -c 14- | cut -d ' ' -f 1 | cut -d '.' -f 4)
  4. KS_DEVICE=$( ls /etc/sysconfig/network-scripts/ifcf* | grep -v ifcfg-lo | cut -d '/' -f 5)
  5. KS_DEVICE_SHORT=$( ls /etc/sysconfig/network-scripts/ifcf* | grep -v ifcfg-lo | cut -d '/' -f 5 | cut -d '-' -f 2)
  6. cat > /etc/sysconfig/network-scripts/$KS_DEVICE <<EOF
  7. DEVICE=$KS_DEVICE_SHORT
  8. IPADDR=$KS_IPADDR
  9. NETMASK=255.255.255.0
  10. GATEWAY=192.168.0.254
  11. EOF
  12. echo "station$KS_IPADDR_SHORT.example.com" >/etc/hostname
  13. echo "$KS_IPADDR  station$KS_IPADDR_SHORT.example.com  station$KS_IPADDR_SHORT" >> /etc/hosts
  14. %end
复制代码
前节:
  1. %pre
  2. DISKTYPE=$(cut -c 26-  /proc/partitions   |  head -n 3 | tail -n 1)
  3. # Partition clearing information
  4. # Disk partitioning information
  5. cat <<EOF >/tmp/disk.txt

  6. ignoredisk --only-use=$DISKTYPE

  7. bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=$DISKTYPE

  8. clearpart --none  --initlabel
  9. part swap --fstype="swap"  --ondisk=$DISKTYPE --size=1024
  10. part pv.350 --fstype="lvmpv" --ondisk=$DISKTYPE --size=18579
  11. part /boot --fstype="xfs" --ondisk=$DISKTYPE --size=300
  12. volgroup rhel --pesize=4096 pv.350
  13. logvol /  --fstype="xfs" --size=17576 --name=root --vgname=rhel
  14. EOF

  15. %end
  16.                        
复制代码


QQ图片20190822223600.png






回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-5-10 02:35 , Processed in 0.144510 second(s), 27 queries .

快速回复 返回顶部 返回列表