Skip to content
This repository was archived by the owner on Aug 31, 2019. It is now read-only.

Commit 2341a59

Browse files
committed
Add new definitions and update documentation
Signed-off-by: Ken Barber <ken@bob.sh>
1 parent bea17cb commit 2341a59

File tree

18 files changed

+506
-23
lines changed

18 files changed

+506
-23
lines changed

README.md

+27-22
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,6 @@ The primary goal is to create boxes that have very little specialisation at this
1313
$ cd <path to repo>
1414
$ bundle install
1515

16-
## Rebuilding a box
17-
18-
Pick a box to build:
19-
20-
$ veewee vbox list
21-
22-
The build it:
23-
24-
$ veewee vbox build centos-58-x86_64
25-
26-
At this point it will download necessary ISO's and start building a box.
27-
28-
Now validate the box:
29-
30-
$ veewee vbox validate 'centos-58-x86_64'
31-
32-
And export the vm to a .box file:
33-
34-
$ vagrant basebox export 'centos-58-x86_64'
35-
36-
Now upload the box located in the current directory 'centos-58-x86_64.box' to the correct S3 bucket.
37-
3816
## Adding a new definition
3917

4018
Get a list of available definitions:
@@ -65,3 +43,30 @@ Naming caveats:
6543
* The name becomes the hostname of the box ... so you have to be careful.
6644
* Debian/Ubuntu doesn't like underscores in the name.
6745
* A dot in the box name would create a subdomain, which is probably not desirable.
46+
47+
Once you've produced a new box you should modify html/index.html to add it so it can be accessed from the index on S3.
48+
49+
Finally, follow the next steps for building a box.
50+
51+
## Building a box
52+
53+
Pick a box to build:
54+
55+
$ veewee vbox list
56+
57+
The build it:
58+
59+
$ veewee vbox build centos-58-x64
60+
61+
At this point it will download necessary ISO's and start building a box.
62+
63+
Now validate the box:
64+
65+
$ veewee vbox validate 'centos-58-x64'
66+
67+
And export the vm to a .box file:
68+
69+
$ vagrant basebox export 'centos-58-x64'
70+
71+
Now upload the box located in the current directory 'centos-58-x86_64.box' to the correct S3 bucket, and if you modified the index.html, upload that as well.
72+
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Veewee::Session.declare({
2+
:cpu_count => '1', :memory_size=> '384',
3+
:disk_size => '10140', :disk_format => 'VDI', :hostiocache => 'off', :ioapic => 'on', :pae => 'on',
4+
:os_type_id => 'RedHat_64',
5+
:iso_file => "CentOS-5.8-x86_64-netinstall.iso",
6+
:iso_src => "http://mirrors.arsc.edu/centos/5.8/isos/x86_64/CentOS-5.8-x86_64-netinstall.iso",
7+
:iso_md5 => "6425035e9adee4b8653a85f59877ac5b",
8+
:iso_download_timeout => 1000,
9+
:boot_wait => "10", :boot_cmd_sequence => [ 'linux text ks=http://%IP%:%PORT%/ks.cfg<Enter>' ],
10+
:kickstart_port => "7122", :kickstart_timeout => 10000, :kickstart_file => "ks.cfg",
11+
:ssh_login_timeout => "10000", :ssh_user => "vagrant", :ssh_password => "vagrant", :ssh_key => "",
12+
:ssh_host_port => "7222", :ssh_guest_port => "22",
13+
:sudo_cmd => "echo '%p'|sudo -S sh '%f'",
14+
:shutdown_cmd => "/sbin/halt -h -p",
15+
:postinstall_files => [ "postinstall.sh"], :postinstall_timeout => 10000
16+
})

definitions/centos-58-x64/ks.cfg

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Kickstart file automatically generated by anaconda.
2+
3+
install
4+
url --url=http://mirrors.arsc.edu/centos/5.8/os/x86_64/
5+
lang en_US.UTF-8
6+
langsupport --default=en_US.UTF-8 en_US.UTF-8
7+
keyboard us
8+
xconfig --card "VMWare" --videoram 16384 --hsync 31.5-37.9 --vsync 50-70 --resolution 800x600 --depth 16
9+
network --device eth0 --bootproto dhcp
10+
rootpw --iscrypted $1$vSG8FjAu$ekQ0grf16hS4G93HTPcco/
11+
firewall --enabled --trust eth0 --ssh
12+
selinux --enforcing
13+
authconfig --enableshadow --enablemd5
14+
timezone America/New_York
15+
bootloader --location=mbr
16+
# The following is the partition information you requested
17+
# Note that any partitions you deleted are not expressed
18+
# here so unless you clear all partitions first, this is
19+
# not guaranteed to work
20+
clearpart --all --drives=sda --initlabel
21+
part /boot --fstype ext3 --size=100 --ondisk=sda
22+
part pv.2 --size=0 --grow --ondisk=sda
23+
volgroup VolGroup00 --pesize=32768 pv.2
24+
logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=528 --grow --maxsize=1056
25+
logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
26+
reboot
27+
28+
%packages
29+
#@ admin-tools
30+
#@ text-internet
31+
#@ dialup
32+
#@ smb-server
33+
#@ web-server
34+
#@ printing
35+
#@ server-cfg
36+
@ core
37+
grub
38+
e2fsprogs
39+
lvm2
40+
kernel-devel
41+
kernel-headers
42+
43+
%post
44+
/usr/sbin/groupadd vagrant
45+
/usr/sbin/useradd vagrant -g vagrant -G wheel
46+
echo "vagrant"|passwd --stdin vagrant
47+
echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#http://chrisadams.me.uk/2010/05/10/setting-up-a-centos-base-box-for-development-and-testing-with-vagrant/
2+
#kernel source is needed for vbox additions
3+
4+
date > /etc/vagrant_box_build_time
5+
6+
yum -y install gcc bzip2 make kernel-devel-`uname -r`
7+
#yum -y update
8+
#yum -y upgrade
9+
10+
yum -y install gcc-c++ zlib-devel openssl-devel readline-devel sqlite3-devel
11+
yum -y erase wireless-tools gtk2 libX11 hicolor-icon-theme avahi freetype bitstream-vera-fonts
12+
yum -y clean all
13+
14+
#Installing ruby
15+
cd /tmp
16+
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p180.tar.gz || fail "Could not download Ruby source"
17+
tar xzvf ruby-1.9.2-p180.tar.gz
18+
cd ruby-1.9.2-p180
19+
./configure
20+
make && make install
21+
cd /tmp
22+
rm -rf /tmp/ruby-1.9.2-p180
23+
rm /tmp/ruby-1.9.2-p180.tar.gz
24+
ln -s /usr/local/bin/ruby /usr/bin/ruby # Create a sym link for the same path
25+
ln -s /usr/local/bin/gem /usr/bin/gem # Create a sym link for the same path
26+
27+
#Installing chef & Puppet
28+
/usr/bin/gem install chef --no-ri --no-rdoc
29+
/usr/bin/gem install puppet --no-ri --no-rdoc
30+
31+
#Installing vagrant keys
32+
mkdir /home/vagrant/.ssh
33+
chmod 700 /home/vagrant/.ssh
34+
cd /home/vagrant/.ssh
35+
wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O authorized_keys
36+
chown -R vagrant /home/vagrant/.ssh
37+
38+
#Installing the virtualbox guest additions
39+
VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
40+
cd /tmp
41+
wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso
42+
mount -o loop VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
43+
sh /mnt/VBoxLinuxAdditions.run
44+
umount /mnt
45+
46+
rm VBoxGuestAdditions_$VBOX_VERSION.iso
47+
48+
sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
49+
sed -i "s/^\(.*env_keep = \"\)/\1PATH /" /etc/sudoers
50+
51+
#poweroff -h
52+
53+
exit

definitions/centos-63-x64/base.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Base install
2+
3+
sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
4+
5+
cat > /etc/yum.repos.d/epel.repo << EOM
6+
[epel]
7+
name=epel
8+
baseurl=http://download.fedoraproject.org/pub/epel/6/\$basearch
9+
enabled=1
10+
gpgcheck=0
11+
EOM
12+
13+
yum -y install gcc make gcc-c++ kernel-devel-`uname -r` zlib-devel openssl-devel readline-devel sqlite-devel perl wget dkms
14+

definitions/centos-63-x64/chef.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Install Chef
2+
gem install --no-ri --no-rdoc chef
3+

definitions/centos-63-x64/cleanup.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
yum -y erase gtk2 libX11 hicolor-icon-theme avahi freetype bitstream-vera-fonts
2+
yum -y clean all
3+
rm -rf /etc/yum.repos.d/{puppetlabs,epel}.repo
4+
rm -rf VBoxGuestAdditions_*.iso
5+
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Veewee::Session.declare({
2+
:cpu_count => '1',
3+
:memory_size=> '480',
4+
:disk_size => '10140',
5+
:disk_format => 'VDI',
6+
:hostiocache => 'off',
7+
:os_type_id => 'RedHat_64',
8+
:iso_file => "CentOS-6.3-x86_64-netinstall.iso",
9+
:iso_src => "http://www.mirrorservice.org/sites/mirror.centos.org/6.3/isos/x86_64/CentOS-6.3-x86_64-netinstall.iso",
10+
:iso_md5 => "690138908de516b6e5d7d180d085c3f3",
11+
:iso_download_timeout => 1000,
12+
:boot_wait => "15",
13+
:boot_cmd_sequence => [
14+
'<Tab> text ks=http://%IP%:%PORT%/ks.cfg<Enter>'
15+
],
16+
:kickstart_port => "7122",
17+
:kickstart_timeout => 10000,
18+
:kickstart_file => "ks.cfg",
19+
:ssh_login_timeout => "10000",
20+
:ssh_user => "veewee",
21+
:ssh_password => "veewee",
22+
:ssh_key => "",
23+
:ssh_host_port => "7222",
24+
:ssh_guest_port => "22",
25+
:sudo_cmd => "echo '%p'|sudo -S sh '%f'",
26+
:shutdown_cmd => "/sbin/halt -h -p",
27+
:postinstall_files => [
28+
"base.sh",
29+
"ruby.sh",
30+
"chef.sh",
31+
"puppet.sh",
32+
"vagrant.sh",
33+
"virtualbox.sh",
34+
#"kvm.sh",
35+
#"vmfusion.sh",
36+
"cleanup.sh",
37+
"zerodisk.sh"
38+
],
39+
:postinstall_timeout => 10000
40+
})

definitions/centos-63-x64/ks.cfg

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
install
2+
url --url=http://www.mirrorservice.org/sites/mirror.centos.org/6.3/os/x86_64/
3+
lang en_US.UTF-8
4+
keyboard us
5+
network --bootproto=dhcp
6+
rootpw --iscrypted $1$damlkd,f$UC/u5pUts5QiU3ow.CSso/
7+
firewall --enabled --service=ssh
8+
authconfig --enableshadow --passalgo=sha512
9+
selinux --disabled
10+
timezone UTC
11+
bootloader --location=mbr
12+
13+
text
14+
skipx
15+
zerombr
16+
17+
clearpart --all --initlabel
18+
autopart
19+
20+
auth --useshadow --enablemd5
21+
firstboot --disabled
22+
reboot
23+
24+
%packages --ignoremissing
25+
@core
26+
bzip2
27+
kernel-devel
28+
kernel-headers
29+
-ipw2100-firmware
30+
-ipw2200-firmware
31+
-ivtv-firmware
32+
%end
33+
34+
%post
35+
/usr/bin/yum -y install sudo
36+
/usr/sbin/groupadd veewee
37+
/usr/sbin/useradd veewee -g veewee -G wheel
38+
echo "veewee"|passwd --stdin veewee
39+
echo "veewee ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/veewee
40+
chmod 0440 /etc/sudoers.d/veewee
41+
%end

definitions/centos-63-x64/puppet.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Install Puppet
2+
3+
cat > /etc/yum.repos.d/puppetlabs.repo << EOM
4+
[puppetlabs]
5+
name=puppetlabs
6+
baseurl=http://yum.puppetlabs.com/el/6/products/\$basearch
7+
enabled=1
8+
gpgcheck=0
9+
EOM
10+
11+
yum -y install puppet facter
12+

definitions/centos-63-x64/ruby.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Install Ruby
2+
yum -y install ruby ruby-devel rubygems
3+

definitions/centos-63-x64/vagrant.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Vagrant specific
2+
date > /etc/vagrant_box_build_time
3+
4+
# Add vagrant user
5+
/usr/sbin/groupadd vagrant
6+
/usr/sbin/useradd vagrant -g vagrant -G wheel
7+
echo "vagrant"|passwd --stdin vagrant
8+
echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant
9+
chmod 0440 /etc/sudoers.d/vagrant
10+
11+
# Installing vagrant keys
12+
mkdir -pm 700 /home/vagrant/.ssh
13+
wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O /home/vagrant/.ssh/authorized_keys
14+
chmod 0600 /home/vagrant/.ssh/authorized_keys
15+
chown -R vagrant /home/vagrant/.ssh
16+
17+
# Customize the message of the day
18+
echo 'Welcome to your Vagrant-built virtual machine.' > /etc/motd
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Installing the virtualbox guest additions
2+
VBOX_VERSION=$(cat /home/veewee/.vbox_version)
3+
cd /tmp
4+
mount -o loop /home/veewee/VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
5+
sh /mnt/VBoxLinuxAdditions.run
6+
umount /mnt
7+
rm -rf /home/veewee/VBoxGuestAdditions_*.iso
8+

definitions/centos-63-x64/zerodisk.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Zero out the free space to save space in the final image:
2+
dd if=/dev/zero of=/EMPTY bs=1M
3+
rm -f /EMPTY
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Veewee::Session.declare({
2+
:cpu_count => '1', :memory_size=> '384',
3+
:disk_size => '10140', :disk_format => 'VDI', :hostiocache => 'off',
4+
:os_type_id => 'Ubuntu',
5+
:iso_file => "ubuntu-10.04.4-server-amd64.iso",
6+
:iso_src => "http://releases.ubuntu.com/10.04.4/ubuntu-10.04.4-server-amd64.iso",
7+
:iso_md5 => "9b218654cdcdf9722171648c52f8a088",
8+
:iso_download_timeout => "1000",
9+
:boot_wait => "10", :boot_cmd_sequence => [
10+
'<Esc><Esc><Enter>',
11+
'/install/vmlinuz noapic preseed/url=http://%IP%:%PORT%/preseed.cfg ',
12+
'debian-installer=en_US auto locale=en_US kbd-chooser/method=us ',
13+
'hostname=%NAME% ',
14+
'fb=false debconf/frontend=noninteractive ',
15+
'console-setup/ask_detect=false console-setup/modelcode=pc105 console-setup/layoutcode=us ',
16+
'initrd=/install/initrd.gz -- <Enter>'
17+
],
18+
:kickstart_port => "7122", :kickstart_timeout => "10000", :kickstart_file => "preseed.cfg",
19+
:ssh_login_timeout => "10000", :ssh_user => "vagrant", :ssh_password => "vagrant", :ssh_key => "",
20+
:ssh_host_port => "7222", :ssh_guest_port => "22",
21+
:sudo_cmd => "echo '%p'|sudo -S sh '%f'",
22+
:shutdown_cmd => "shutdown -P now",
23+
:postinstall_files => [ "postinstall.sh"], :postinstall_timeout => "10000"
24+
})

0 commit comments

Comments
 (0)