Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to CentOS 6.5 and Ruby 1.9 w/Packer 0.5 #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions http_directory/anaconda-ks.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ logvol swap --name=lv_swap --vgname=VolGroup --grow --size=2016 --maxsize=2016
part /boot --fstype=ext4 --size=500

# Location of the package data
url --url http://mirrors.usinternet.com/centos/6.4/os/x86_64/
url --url http://mirrors.usinternet.com/centos/6.5/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/
repo --name=updates --baseurl=http://mirrors.usinternet.com/centos/6.5/updates/x86_64/

%packages --nobase
@core

# For the virtualbox additions
kernel-devel
kernel-headers
make
kernel-headers
make
dkms
bzip2
openssh-clients
Expand Down Expand Up @@ -155,12 +155,12 @@ repo --name=updates --baseurl=http://mirrors.usinternet.com/centos/6.4/updates/x
#######################################################
# 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
# The system can now be packaged with
# `vagrant package VMNAME`
#######################################################
echo 'You can now package this box with `vagrant package VMNAME`'
Expand All @@ -172,4 +172,4 @@ repo --name=updates --baseurl=http://mirrors.usinternet.com/centos/6.4/updates/x

%end

reboot
reboot
43 changes: 0 additions & 43 deletions packer-virtualbox-centos-6_4-64.json

This file was deleted.

59 changes: 59 additions & 0 deletions packer-virtualbox-centos-6_5-64.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"builders": [
{
"boot_command": [
"<esc>",
"<wait>linux ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/anaconda-ks.cfg<enter>"
],
"boot_wait": "5s",
"disk_size": 40000,
"guest_os_type": "RedHat_64",
"headless": true,
"http_directory": "./http_directory",
"iso_checksum": "0d9dc37b5dd4befa1c440d2174e88a87",
"iso_checksum_type": "md5",
"iso_url": "http://mirror.its.sfu.ca/mirror/CentOS/6.5/isos/x86_64/CentOS-6.5-x86_64-minimal.iso",
"ssh_password": "vagrant",
"ssh_username": "root",
"ssh_wait_timeout": "40m",
"shutdown_command": "echo 'packer' | sudo -S shutdown -P now",
"type": "virtualbox-iso",
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--memory",
"1024"
],
[
"modifyvm",
"{{.Name}}",
"--cpus",
"2"
]
],
"vm_name": "packer-centos-6_5-64"
}
],
"post-processors": [
{
"output": "centos-6_5-64_virtualbox.box",
"type": "vagrant"
}
],
"provisioners": [
{
"override": {
"virtualbox-iso": {
"scripts": [
"provisioners/base-provision.sh",
"provisioners/install-virtualbox-guest-additions.sh",
"provisioners/clean-empty-space.sh"
]
}
},
"type": "shell"
}
]
}

49 changes: 29 additions & 20 deletions provisioners/base-provision.sh
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
#!/bin/bash

yum install -y make bzip2 openssh-clients nano htop wget automake gcc cpp glibc-devel glibc-headers \
glibc-kernheaders glibc glibc-common libgcc zlib-devel openssl-devel readline-devel
yum install -y make bzip2 openssh-clients htop wget automake gcc cpp \
glibc-devel glibc-headers glibc-kernheaders glibc glibc-common libgcc \
zlib-devel openssl-devel readline-devel gcc-c++ patch readline \
readline-devel zlib libyaml-devel libffi-devel \
autoconf libtool bison

#######################################################
# Fix sudo requiring tty under Vagrant
#######################################################
sed --in-place=".BAK" 's/Defaults\(.*\)requiretty/Defaults\1!requiretty/' /etc/sudoers

#######################################################
# Build Ruby
#######################################################

echo "?? Building Ruby 1.9"
# 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
# install yaml
wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
tar xzvf yaml-0.1.4.tar.gz
cd yaml-0.1.4 && ./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
# build ruby-1.9.3-p484
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p484.tar.bz2
tar -xjf ruby-1.9.3-p484.tar.bz2
cd ruby-1.9.3-p484
./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 /
Expand All @@ -39,11 +39,20 @@ rm -rf /tmp/ruby
#######################################################
# Install Puppet
#######################################################
echo "?? Installing Puppet"
gem install puppet --no-rdoc --no-ri

# add the puppet group
groupadd puppet


#######################################################
# Install Chef
#######################################################
echo "?? Installing chef"
curl -L https://www.opscode.com/chef/install.sh | bash


#######################################################
# Turn off un-needed services
#######################################################
Expand All @@ -66,4 +75,4 @@ yum -y groupremove "Dialup Networking Support" Editors "Printing Support" "Addit
yum clean all

# Clean out all of the caching dirs
rm -rf /var/cache/* /usr/share/doc/*
rm -rf /var/cache/* /usr/share/doc/*