Bo's Oracle Station

查看: 971|回复: 0

课程第8次:2020-02-26星期三

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2020-2-26 19:21:59 | 显示全部楼层 |阅读模式
1. KICKSTARTRHEL8(在环境脚本line 53 - line 167 ):
RHEL7:


  1. #version=DEVEL
  2. # System authorization information
  3. auth --enableshadow --passalgo=sha512
  4. url --url="nfs://192.168.0.104:/mnt"
  5. # Use CDROM installation media
  6. # Use graphical install

  7. # Run the Setup Agent on first boot
  8. firstboot --disable
  9. # Keyboard layouts
  10. keyboard --vckeymap=us --xlayouts='us'
  11. # System language
  12. lang en_US.UTF-8

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

  15. # Root password
  16. rootpw --plaintext redhat123
  17. # System services
  18. services --enabled="chronyd,sshd"
  19. # System timezone
  20. timezone Asia/Shanghai --isUtc
  21. # X Window System configuration information
  22. xconfig  --startxonboot
  23. # System bootloader configuration
  24. %include /tmp/disk.txt
  25. reboot

  26. %packages
  27. @^graphical-server-environment
  28. @base
  29. @core
  30. #@desktop-debugging
  31. #@dial-up
  32. @fonts
  33. @gnome-desktop
  34. @guest-agents
  35. @guest-desktop-agents
  36. @hardware-monitoring
  37. @input-methods
  38. @internet-browser
  39. @multimedia
  40. @print-client
  41. @x11
  42. chrony
  43. kexec-tools

  44. %end

  45. %post
  46. KS_IPADDR=$(ifconfig | head -n 2 | tail -n 1 | cut -c 14- | cut -d ' ' -f 1)
  47. KS_IPADDR_SHORT=$(ifconfig | head -n 2 | tail -n 1 | cut -c 14- | cut -d ' ' -f 1 | cut -d '.' -f 4)
  48. KS_DEVICE=$( ls /etc/sysconfig/network-scripts/ifcf* | grep -v ifcfg-lo | cut -d '/' -f 5)
  49. KS_DEVICE_SHORT=$( ls /etc/sysconfig/network-scripts/ifcf* | grep -v ifcfg-lo | cut -d '/' -f 5 | cut -d '-' -f 2)
  50. cat > /etc/sysconfig/network-scripts/$KS_DEVICE <<EOF
  51. DEVICE=$KS_DEVICE_SHORT
  52. IPADDR=$KS_IPADDR
  53. NETMASK=255.255.255.0
  54. GATEWAY=192.168.0.254
  55. EOF
  56. [ $KS_IPADDR_SHORT -le 100 ] && echo "desktop$KS_IPADDR_SHORT.example.com" >/etc/hostname
  57. [ $KS_IPADDR_SHORT -gt 100 ] && echo "server$[ $KS_IPADDR_SHORT - 100 ].example.com" >/etc/hostname
  58. [ $KS_IPADDR_SHORT -le 100 ] && echo "$KS_IPADDR  desktop$KS_IPADDR_SHORT.example.com  desktop$KS_IPADDR_SHORT" >> /etc/hosts
  59. [ $KS_IPADDR_SHORT -gt 100 ] && echo "$KS_IPADDR  server$[ $KS_IPADDR_SHORT -100 ].example.com  server$[ $KS_IPADDR_SHORT -100 ]" >> /etc/hosts

  60. echo "search example.com" > /etc/resolv.conf
  61. echo "nameserver 192.168.0.254" >> /etc/resolv.conf
  62. %end

  63. %pre
  64. # Partition Total 19028M
  65. echo "Starting PRE" > /dev/tty2

  66. DISKTYPE=$(cut -c 26-  /proc/partitions   |  head -n 3 | tail -n 1)
  67. # Partition clearing information
  68. # Disk partitioning information
  69. cat <<EOF >/tmp/disk.txt

  70. ignoredisk --only-use=$DISKTYPE

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

  72. # CLASSROOM MACHINE(c) NEED A DISK OF: 57000M
  73. clearpart --none  --initlabel
  74. part swap --fstype="swap"  --ondisk=$DISKTYPE --size=1024
  75. part pv.350 --fstype="lvmpv" --ondisk=$DISKTYPE --size=18579
  76. part /boot --fstype="xfs" --ondisk=$DISKTYPE --size=300
  77. volgroup rhel --pesize=4096 pv.350
  78. logvol /  --fstype="xfs" --size=17576 --name=root --vgname=rhel
  79. EOF

  80. %end
复制代码
https://access.redhat.com/labs/kickstartconfig/
https://access.redhat.com/labs/kickstartconvert/





回复

使用道具 举报

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

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-5-20 13:55 , Processed in 0.042289 second(s), 24 queries .

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