Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.23 KB | None | 0 0
  1. ################################# Install mode #################################
  2.  
  3. # Install Linux instead of upgrade
  4. install
  5.  
  6. # Graphical install mode with VNC
  7. vnc
  8.  
  9. ################################# Network setup ################################
  10.  
  11. # By default, use DHCP
  12. network --bootproto=dhcp --device=eth0
  13.  
  14. ################################# Repositories #################################
  15.  
  16. # Base URL of CentOS 6 repository, should be adapted regarding geographical location
  17. url --url=http://ftp.heanet.ie/pub/centos/6/os/x86_64/
  18.  
  19. # CentOS updates repository
  20. repo --name=updates --mirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=updates
  21.  
  22. # Epel repository containing some ComodIT dependencies
  23. repo --name=epel --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=x86_64
  24.  
  25. ########################## System configuration ################################
  26.  
  27. # Do not configure the X Window System
  28. skipx
  29.  
  30. # Set system language
  31. lang en_US
  32.  
  33. # Set keyboard layout
  34. keyboard us
  35.  
  36. # Set time zone
  37. timezone --utc Etc/UTC
  38.  
  39. # Set root password
  40. rootpw --iscrypted $1$nRsAkzCe$R75MFWSa7Uqe/1GFRRDre1
  41.  
  42. # Request reboot after installation
  43. reboot
  44.  
  45. # Do not run the Setup Agent on first boot
  46. firstboot --disabled
  47.  
  48. # Firewall configuration
  49. firewall --disabled
  50.  
  51. # SELinux configuration
  52. selinux --permissive
  53.  
  54. # Configure the logging level
  55. logging --level=info
  56.  
  57. # System authorization information
  58. authconfig --enableshadow --passalgo=sha512
  59.  
  60. # Enable necessary services.
  61. services --enabled="acpid"
  62.  
  63. ############################# Disk partitioning ################################
  64.  
  65. # System bootloader configuration
  66. bootloader --location=mbr
  67.  
  68. # Disk partitioning information
  69. part / --onpart=/dev/xvde1
  70. part swap --onpart=/dev/xvde2
  71.  
  72. ############################### Packages #######################################
  73.  
  74. %packages
  75.  
  76. @Base
  77. epel-release
  78. cloud-init
  79.  
  80. ######################### Pre-install script ##################################
  81.  
  82. %pre
  83.  
  84. REAL_DISK=/dev/xvde
  85.  
  86. # Clear the MBR and reset partition table
  87. dd if=/dev/zero of=$REAL_DISK bs=512 count=1
  88. parted -s $REAL_DISK mklabel msdos
  89.  
  90. TOTAL=`parted -s $REAL_DISK unit mb print free | grep $REAL_DISK | awk '{print $3}' | cut -d "M" -f1`
  91.  
  92. # Calculate swap partition start point
  93. let SWAP_START=$TOTAL-512
  94.  
  95. # Create partitions
  96. parted -s $REAL_DISK mkpart primary 0 $SWAP_START
  97. parted -s $REAL_DISK mkpart primary $SWAP_START $TOTAL
  98.  
  99. ######################### Post-install script ##################################
  100.  
  101. %post
  102.  
  103. # Create ec2-user user
  104. /usr/sbin/useradd ec2-user
  105. /bin/echo -e 'ec2-user\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers
  106.  
  107. # Configure cloud-init
  108. cat <<EOF > /etc/cloud/cloud.cfg
  109. user: ec2-user
  110. disable_root: 0
  111. ssh_pwauth: 1
  112.  
  113. cc_ready_cmd: ['/bin/true']
  114. locale_configfile: /etc/sysconfig/i18n
  115. mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
  116. ssh_deletekeys: 0
  117. ssh_genkeytypes: ~
  118. ssh_svcname: sshd
  119. syslog_fix_perms: ~
  120.  
  121. cloud_init_modules:
  122. - set_hostname
  123. - rsyslog
  124. - ssh
  125.  
  126. cloud_config_modules:
  127. - mounts
  128. - ssh-import-id
  129. - locale
  130. - set-passwords
  131. - timezone
  132. - disable-ec2-metadata
  133.  
  134. cloud_final_modules:
  135. - keys-to-console
  136. - phone-home
  137. - final-message
  138.  
  139. # vim:syntax=yaml
  140. EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement