Skip to content

Instantly share code, notes, and snippets.

@ericem
Forked from aeldaly/anaconda-ks.cfg
Created March 1, 2021 13:19
Show Gist options
  • Select an option

  • Save ericem/dfaa8d1d0bf1bd6731fdc20c065b959a to your computer and use it in GitHub Desktop.

Select an option

Save ericem/dfaa8d1d0bf1bd6731fdc20c065b959a to your computer and use it in GitHub Desktop.

Revisions

  1. @aeldaly aeldaly created this gist Sep 6, 2013.
    175 changes: 175 additions & 0 deletions anaconda-ks.cfg
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,175 @@
    # Kickstart file automatically generated by anaconda.

    #version=DEVEL
    install
    cdrom
    text
    lang en_US.UTF-8
    keyboard us
    network --onboot yes --device eth0 --bootproto dhcp --noipv6
    rootpw --plaintext vagrant
    firewall --service=ssh
    authconfig --enableshadow --passalgo=sha512
    selinux --disabled
    timezone --utc America/Chicago
    bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"

    # The following is the partition information you requested
    # Note that any partitions you deleted are not expressed
    # here so unless you clear all partitions first, this is
    # not guaranteed to work

    # Clean out the old disk config
    zerombr

    # Clean out old partitions
    clearpart --all --drives=sda

    # Make a new partition for the volgroup
    part pv.008002 --size=39000 --ondisk=sda

    # Make the volgroup
    volgroup VolGroup --pesize=4096 pv.008002

    # Make / on the volgroup
    logvol / --fstype=ext4 --name=lv_root --vgname=VolGroup --grow --size=1024 --maxsize=37000

    # Setup swap on the volgroup
    logvol swap --name=lv_swap --vgname=VolGroup --grow --size=2016 --maxsize=2016

    # Setup the boot partition on the volgroup
    part /boot --fstype=ext4 --size=500

    # Location of the package data
    url --url http://mirrors.usinternet.com/centos/6.4/os/x86_64/
    repo --name=epel --baseurl=http://download.fedoraproject.org/pub/epel/6/x86_64/
    repo --name=updates --baseurl=http://mirrors.usinternet.com/centos/6.4/updates/x86_64/

    %packages --nobase
    @core

    # For the virtualbox additions
    kernel-devel
    kernel-headers
    make
    dkms
    bzip2
    openssh-clients
    nano
    htop

    # required to build ruby
    # should be kept for gems that build native extensions.
    wget
    automake
    gcc
    cpp
    glibc-devel
    glibc-headers
    glibc-kernheaders
    glibc
    glibc-common
    libgcc

    # required to build ruby bindings, can be removed after
    zlib-devel
    openssl-devel
    readline-devel
    %end

    %post

    # Change to a vt to see progress

    exec < /dev/tty3 > /dev/tty3
    chvt 3

    # redirect output to ks-post.log including stdout and stderr
    (
    #######################################################
    # Build Ruby
    #######################################################

    # Keep it clean
    mkdir /tmp/ruby
    cd /tmp/ruby

    # autoconf 2.60 is required to build ruby
    wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz
    tar -xzf autoconf-2.60.tar.gz
    cd autoconf-2.60
    ./configure --prefix=/usr && make && make install
    cd /tmp/ruby

    # build ruby-1.8.7-p358
    wget http://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p358.tar.bz2
    tar -xjf ruby-1.8.7-p358.tar.bz2
    cd ruby-1.8.7-p358
    autoconf
    ./configure --prefix=/usr && make && make install
    cd /tmp/ruby

    # install ruby-gems 1.8.10
    wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.10.tgz
    tar -xzf rubygems-1.8.10.tgz
    cd rubygems-1.8.10
    /usr/bin/ruby setup.rb

    # clean up
    cd /
    rm -rf /tmp/ruby

    #######################################################
    # Install Puppet
    #######################################################
    gem install puppet --no-rdoc --no-ri

    # add the puppet group
    groupadd puppet

    #######################################################
    # Turn off un-needed services
    #######################################################
    chkconfig sendmail off
    chkconfig vbox-add-x11 off
    chkconfig smartd off
    chkconfig ntpd off
    chkconfig cupsd off

    #######################################################
    # Setup for Vagrant
    #######################################################
    groupadd admin
    useradd -g admin vagrant
    echo 'Defaults env_keep="SSH_AUTH_SOCK"' >> /etc/sudoers
    echo '%admin ALL=NOPASSWD: ALL' >> /etc/sudoers

    # Add vagrant insecure private key for key auth
    # Make your own if this is private.
    # See http://vagrantup.com/docs/base_boxes.html
    mkdir /home/vagrant/.ssh
    echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" > /home/vagrant/.ssh/authorized_keys

    ########################################################
    # Cleanup for compression
    #######################################################
    # Remove ruby build libs
    yum -y remove zlib-devel openssl-devel readline-devel

    # Cleanup other files we do not need
    yum -y groupremove "Dialup Networking Support" Editors "Printing Support" "Additional Development" "E-mail server"

    #######################################################
    # The system can now be packaged with
    # `vagrant package VMNAME`
    #######################################################
    echo 'You can now package this box with `vagrant package VMNAME`'

    ) 2>&1 | /usr/bin/tee /root/ks-post.log

    # switch back to gui
    chvt 7

    %end

    reboot