Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ################################# Install mode #################################
- # Install Linux instead of upgrade
- install
- # Graphical install mode with VNC
- vnc
- ################################# Network setup ################################
- # By default, use DHCP
- network --bootproto=dhcp --device=eth0
- ################################# Repositories #################################
- # Base URL of CentOS 6 repository, should be adapted regarding geographical location
- url --url=http://ftp.heanet.ie/pub/centos/6/os/x86_64/
- # CentOS updates repository
- repo --name=updates --mirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=updates
- # Epel repository containing some ComodIT dependencies
- repo --name=epel --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=x86_64
- ########################## System configuration ################################
- # Do not configure the X Window System
- skipx
- # Set system language
- lang en_US
- # Set keyboard layout
- keyboard us
- # Set time zone
- timezone --utc Etc/UTC
- # Set root password
- rootpw --iscrypted $1$nRsAkzCe$R75MFWSa7Uqe/1GFRRDre1
- # Request reboot after installation
- reboot
- # Do not run the Setup Agent on first boot
- firstboot --disabled
- # Firewall configuration
- firewall --disabled
- # SELinux configuration
- selinux --permissive
- # Configure the logging level
- logging --level=info
- # System authorization information
- authconfig --enableshadow --passalgo=sha512
- # Enable necessary services.
- services --enabled="acpid"
- ############################# Disk partitioning ################################
- # System bootloader configuration
- bootloader --location=mbr
- # Disk partitioning information
- part / --onpart=/dev/xvde1
- part swap --onpart=/dev/xvde2
- ############################### Packages #######################################
- %packages
- @Base
- epel-release
- cloud-init
- ######################### Pre-install script ##################################
- %pre
- REAL_DISK=/dev/xvde
- # Clear the MBR and reset partition table
- dd if=/dev/zero of=$REAL_DISK bs=512 count=1
- parted -s $REAL_DISK mklabel msdos
- TOTAL=`parted -s $REAL_DISK unit mb print free | grep $REAL_DISK | awk '{print $3}' | cut -d "M" -f1`
- # Calculate swap partition start point
- let SWAP_START=$TOTAL-512
- # Create partitions
- parted -s $REAL_DISK mkpart primary 0 $SWAP_START
- parted -s $REAL_DISK mkpart primary $SWAP_START $TOTAL
- ######################### Post-install script ##################################
- %post
- # Create ec2-user user
- /usr/sbin/useradd ec2-user
- /bin/echo -e 'ec2-user\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers
- # Configure cloud-init
- cat <<EOF > /etc/cloud/cloud.cfg
- user: ec2-user
- disable_root: 0
- ssh_pwauth: 1
- cc_ready_cmd: ['/bin/true']
- locale_configfile: /etc/sysconfig/i18n
- mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
- ssh_deletekeys: 0
- ssh_genkeytypes: ~
- ssh_svcname: sshd
- syslog_fix_perms: ~
- cloud_init_modules:
- - set_hostname
- - rsyslog
- - ssh
- cloud_config_modules:
- - mounts
- - ssh-import-id
- - locale
- - set-passwords
- - timezone
- - disable-ec2-metadata
- cloud_final_modules:
- - keys-to-console
- - phone-home
- - final-message
- # vim:syntax=yaml
- EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement