Skip to content
This repository

Added initial base box definition. #18

Merged
merged 2 commits into from almost 2 years ago

2 participants

Steffen Opel David Laing
Steffen Opel
sopel commented April 27, 2012

As discussed this is simply the default definition as generated by VeeWee 0.3.0.alpha8 from template 'ubuntu-12.04-server-amd64-packages'.

added some commits April 27, 2012
Steffen Opel Added initial base box definition.
NOTE: generated by VeeWee 0.3.0.alpha8 from template 'ubuntu-12.04-server-amd64-packages'.
f203880
Steffen Opel Added initial Readme.md. 114ad1e
David Laing mrdavidlaing merged commit 2d9b534 into from April 29, 2012
David Laing mrdavidlaing closed this April 29, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Apr 27, 2012
Steffen Opel Added initial base box definition.
NOTE: generated by VeeWee 0.3.0.alpha8 from template 'ubuntu-12.04-server-amd64-packages'.
f203880
Steffen Opel Added initial Readme.md. 114ad1e
This page is out of date. Refresh to see the latest.
25  definitions/Readme.md
Source Rendered
... ...
@@ -0,0 +1,25 @@
  1
+# Veewee base box definitions for Vagrant
  2
+
  3
+This directory contains [Veewee](https://github.com/jedi4ever/veewee) definitions to generate [base boxes](http://vagrantup.com/docs/base_boxes.html) for [Vagrant](http://vagrantup.com/).
  4
+
  5
+## Scope
  6
+
  7
+This is currently only used by the base box and VM maintainers. Using Veewee base box generation, while utterly convenient in principle, can still be quite involved due to the project moving fast and using bleeding edge components/dependencies as well, which specifically affects MacOS/Windows users.
  8
+
  9
+## Usage
  10
+
  11
+Aforementioned scope aside, usage of Veewee is actually supposed to be quite simple and boils down to the following (be sure to read the more detailed [instructions](https://github.com/jedi4ever/veewee/blob/master/doc/vagrant.md) as well though):
  12
+
  13
+* list available templates    
  14
+$ `vagrant basebox templates`
  15
+* define the base box by means of a template, e.g.    
  16
+$ `vagrant basebox define 'ubuntu-12.04-server-amd64' 'ubuntu-12.04-server-amd64-packages'`
  17
+* optionally modify the generated `definition.rb/postinstall.sh/preseed.cfg`
  18
+* build the defined base box   
  19
+$ `vagrant basebox build 'ubuntu-12.04-server-amd64'`
  20
+* validate the built box    
  21
+$ `vagrant basebox validate 'ubuntu-12.04-server-amd64'`
  22
+* export the validated box    
  23
+$ `vagrant basebox export 'ubuntu-12.04-server-amd64'`
  24
+
  25
+The resulting 'ubuntu-12.04-server-amd64.box' can now be used to actually built the custom VM for the use case at hand.
37  definitions/ubuntu-12.04-server-amd64/definition.rb
... ...
@@ -0,0 +1,37 @@
  1
+# obviously this is using the "alternate" ISO, not the "server" ISO, but that
  2
+# is only because it hasn't been released yet.
  3
+Veewee::Session.declare({
  4
+  :cpu_count => '2',
  5
+  :memory_size=> '2048',
  6
+  :disk_size => '10140',
  7
+  :disk_format => 'VDI',
  8
+  :hostiocache => 'off',
  9
+  :os_type_id => 'Ubuntu_64',
  10
+  :iso_file => "ubuntu-12.04-server-amd64.iso",
  11
+  :iso_src => "http://releases.ubuntu.com/12.04/ubuntu-12.04-server-amd64.iso",
  12
+  :iso_md5 => 'f2e921788d35bbdf0336d05d228136eb',
  13
+  :iso_download_timeout => "1000",
  14
+  :boot_wait => "4",
  15
+  :boot_cmd_sequence => [
  16
+    '<Esc><Esc><Enter>',
  17
+    '/install/vmlinuz noapic preseed/url=http://%IP%:%PORT%/preseed.cfg ',
  18
+    'debian-installer=en_US auto locale=en_US kbd-chooser/method=us ',
  19
+    'hostname=%NAME% ',
  20
+    'fb=false debconf/frontend=noninteractive ',
  21
+    'keyboard-configuration/layout=USA keyboard-configuration/variant=USA console-setup/ask_detect=false ',
  22
+    'initrd=/install/initrd.gz -- <Enter>'
  23
+],
  24
+  :kickstart_port => "7122",
  25
+  :kickstart_timeout => "10000",
  26
+  :kickstart_file => "preseed.cfg",
  27
+  :ssh_login_timeout => "10000",
  28
+  :ssh_user => "vagrant",
  29
+  :ssh_password => "vagrant",
  30
+  :ssh_key => "",
  31
+  :ssh_host_port => "7222",
  32
+  :ssh_guest_port => "22",
  33
+  :sudo_cmd => "echo '%p'|sudo -S sh '%f'",
  34
+  :shutdown_cmd => "shutdown -P now",
  35
+  :postinstall_files => [ "postinstall.sh"],
  36
+  :postinstall_timeout => "10000"
  37
+})
72  definitions/ubuntu-12.04-server-amd64/postinstall.sh
... ...
@@ -0,0 +1,72 @@
  1
+# postinstall.sh created from Mitchell's official lucid32/64 baseboxes
  2
+
  3
+date > /etc/vagrant_box_build_time
  4
+
  5
+# Apt-install various things necessary for Ruby, guest additions,
  6
+# etc., and remove optional things to trim down the machine.
  7
+apt-get -y update
  8
+apt-get -y upgrade
  9
+apt-get -y install linux-headers-$(uname -r) build-essential
  10
+apt-get -y install zlib1g-dev libssl-dev libreadline-gplv2-dev
  11
+apt-get -y install vim
  12
+apt-get clean
  13
+
  14
+# Installing the virtualbox guest additions
  15
+apt-get -y install dkms
  16
+VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
  17
+cd /tmp
  18
+wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso
  19
+mount -o loop VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
  20
+sh /mnt/VBoxLinuxAdditions.run
  21
+umount /mnt
  22
+
  23
+rm VBoxGuestAdditions_$VBOX_VERSION.iso
  24
+
  25
+# Setup sudo to allow no-password sudo for "admin"
  26
+groupadd -r admin
  27
+usermod -a -G admin vagrant
  28
+cp /etc/sudoers /etc/sudoers.orig
  29
+sed -i -e '/Defaults\s\+env_reset/a Defaults\texempt_group=admin' /etc/sudoers
  30
+sed -i -e 's/%admin ALL=(ALL) ALL/%admin ALL=NOPASSWD:ALL/g' /etc/sudoers
  31
+
  32
+# Install NFS client
  33
+apt-get -y install nfs-common
  34
+
  35
+# Install Ruby from packages
  36
+apt-get -y install ruby rubygems
  37
+
  38
+# Installing chef & Puppet
  39
+gem install chef --no-ri --no-rdoc
  40
+gem install puppet --no-ri --no-rdoc
  41
+
  42
+# Installing vagrant keys
  43
+mkdir /home/vagrant/.ssh
  44
+chmod 700 /home/vagrant/.ssh
  45
+cd /home/vagrant/.ssh
  46
+wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O authorized_keys
  47
+chmod 600 /home/vagrant/.ssh/authorized_keys
  48
+chown -R vagrant /home/vagrant/.ssh
  49
+
  50
+# Remove items used for building, since they aren't needed anymore
  51
+apt-get -y remove linux-headers-$(uname -r) build-essential
  52
+apt-get -y autoremove
  53
+
  54
+# Zero out the free space to save space in the final image:
  55
+dd if=/dev/zero of=/EMPTY bs=1M
  56
+rm -f /EMPTY
  57
+
  58
+# Removing leftover leases and persistent rules
  59
+echo "cleaning up dhcp leases"
  60
+rm /var/lib/dhcp3/*
  61
+
  62
+# Make sure Udev doesn't block our network
  63
+# http://6.ptmc.org/?p=164
  64
+echo "cleaning up udev rules"
  65
+rm /etc/udev/rules.d/70-persistent-net.rules
  66
+mkdir /etc/udev/rules.d/70-persistent-net.rules
  67
+rm -rf /dev/.udev/
  68
+rm /lib/udev/rules.d/75-persistent-net-generator.rules
  69
+
  70
+echo "Adding a 2 sec delay to the interface up, to make the dhclient happy"
  71
+echo "pre-up sleep 2" >> /etc/network/interfaces
  72
+exit
87  definitions/ubuntu-12.04-server-amd64/preseed.cfg
... ...
@@ -0,0 +1,87 @@
  1
+## Options to set on the command line
  2
+d-i debian-installer/locale string en_US.utf8
  3
+d-i console-setup/ask_detect boolean false
  4
+d-i console-setup/layout string USA
  5
+
  6
+#d-i netcfg/get_hostname string dummy
  7
+d-i netcfg/get_hostname string unassigned-hostname
  8
+d-i netcfg/get_domain string unassigned-domain
  9
+
  10
+# Continue without a default route
  11
+# Not working , specify a dummy in the DHCP
  12
+#d-i netcfg/no_default_route boolean
  13
+
  14
+d-i time/zone string UTC
  15
+d-i clock-setup/utc-auto boolean true
  16
+d-i clock-setup/utc boolean true
  17
+
  18
+d-i kbd-chooser/method select American English
  19
+
  20
+d-i netcfg/wireless_wep string
  21
+
  22
+d-i base-installer/kernel/override-image string linux-server
  23
+#d-i base-installer/kernel/override-image string linux-image-2.6.32-21-generic
  24
+
  25
+# Choices: Dialog, Readline, Gnome, Kde, Editor, Noninteractive
  26
+d-i debconf debconf/frontend select Noninteractive
  27
+
  28
+d-i pkgsel/install-language-support boolean false
  29
+tasksel tasksel/first multiselect standard, ubuntu-server
  30
+
  31
+#d-i partman-auto/method string regular
  32
+d-i partman-auto/method string lvm
  33
+#d-i partman-auto/purge_lvm_from_device boolean true
  34
+
  35
+d-i partman-lvm/confirm boolean true
  36
+d-i partman-lvm/device_remove_lvm boolean true
  37
+d-i partman-auto/choose_recipe select atomic
  38
+
  39
+d-i partman/confirm_write_new_label boolean true
  40
+d-i partman/confirm_nooverwrite boolean true
  41
+d-i partman/choose_partition select finish
  42
+d-i partman/confirm boolean true
  43
+
  44
+#http://ubuntu-virginia.ubuntuforums.org/showthread.php?p=9626883
  45
+#Message: "write the changes to disk and configure lvm preseed"
  46
+#http://serverfault.com/questions/189328/ubuntu-kickstart-installation-using-lvm-waits-for-input
  47
+#preseed partman-lvm/confirm_nooverwrite boolean true
  48
+
  49
+# Write the changes to disks and configure LVM?
  50
+d-i partman-lvm/confirm boolean true
  51
+d-i partman-lvm/confirm_nooverwrite boolean true
  52
+d-i partman-auto-lvm/guided_size string max
  53
+
  54
+## Default user, we can get away with a recipe to change this
  55
+d-i passwd/user-fullname string vagrant
  56
+d-i passwd/username string vagrant
  57
+d-i passwd/user-password password vagrant
  58
+d-i passwd/user-password-again password vagrant
  59
+d-i user-setup/encrypt-home boolean false
  60
+d-i user-setup/allow-password-weak boolean true
  61
+
  62
+## minimum is puppet and ssh and ntp
  63
+# Individual additional packages to install
  64
+d-i pkgsel/include string openssh-server ntp
  65
+
  66
+# Whether to upgrade packages after debootstrap.
  67
+# Allowed values: none, safe-upgrade, full-upgrade
  68
+d-i pkgsel/upgrade select full-upgrade
  69
+
  70
+d-i grub-installer/only_debian boolean true
  71
+d-i grub-installer/with_other_os boolean true
  72
+d-i finish-install/reboot_in_progress note
  73
+
  74
+#For the update
  75
+d-i pkgsel/update-policy select none
  76
+
  77
+# debconf-get-selections --install
  78
+#Use mirror
  79
+#d-i apt-setup/use_mirror boolean true
  80
+#d-i mirror/country string manual
  81
+#choose-mirror-bin mirror/protocol string http
  82
+#choose-mirror-bin mirror/http/hostname string 192.168.4.150
  83
+#choose-mirror-bin mirror/http/directory string /ubuntu
  84
+#choose-mirror-bin mirror/suite select maverick
  85
+#d-i debian-installer/allow_unauthenticated string true
  86
+
  87
+choose-mirror-bin mirror/http/proxy string
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.