Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Checklist for preparing FreeBSD-8.4 vagrant boxes.

Preparing FreeBSD-8.4-i386.box

  • Download FreeBSD-8.4-RELEASE-i386-disc1.iso
  • Open FreeBSD-8.4-i386.ova in VirtualBox
    1. Select File/Import Appliance
  • Boot into sysinstall using FreeBSD-8.4-RELEASE-i386-disc1.iso
    1. Country selection
      • [235] United States
    2. Express install
    3. FDISK Partition Editor
      • [A] = Use Entire Disk
      • [Q] = Finish
    4. Install boot manager
      • [S] Standard
    5. FreeBSD Disklabel Editor
      • [A] = Auto Defaults
      • [Q] = Finish
    6. Choose Distribution
      • [7] Minimal
    7. Choose Installation Media
      • [1] CD/DVD Install from a FreeBSD CD/DVD
    8. User confirmation
      • [yes]
    9. Wait for install to complete
    10. Visit general configuration menu
      • [no]
    11. Exit install & reboot
      • removing CD is done automatically
  • Login as root (no password)
    1. get an IP addr
      • dhclient em0
    2. run setup.sh
    3. from the VirtualBox Menu Machine/ACPI shutdown
  • Package box
    • vagrant package --base FreeBSD-8.4-i386 --output FreeBSD-8.4-i386.box

Preparing FreeBSD-8.4-amd64.box

#!/bin/sh
set -e -v
# set root password to vagrant
echo vagrant | pw mod user root -h 0
# create vagrant user (password vagrant)
echo vagrant | pw useradd -n vagrant -s /bin/csh -m -h 0
# Install sudo and bash
pkg_add -r sudo bash
# enable passwordless sudo for vagrant
echo 'vagrant ALL=(ALL) NOPASSWD: ALL' >> /usr/local/etc/sudoers
# install authorized ssh keys
mkdir /usr/home/vagrant/.ssh
fetch -o /usr/home/vagrant/.ssh/authorized_keys https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub
chown vagrant:vagrant /usr/home/vagrant/.ssh/authorized_keys
# set network configuration
echo hostname='"'`uname -s`-`uname -r`-`uname -m`'"' >> /etc/rc.conf
echo 'ifconfig_em0="DHCP"' >> /etc/rc.conf
# enable sshd
echo 'sshd_enable="YES"' >> /etc/rc.conf
# disable boot screen
echo 'beastie_disable="YES"' >> /boot/loader.conf
echo 'autoboot_delay="-1"' >> /boot/loader.conf
# Change PACKAGEROOT (ftp doesn't work with default vagrant NAT rules)
echo 'setenv PACKAGEROOT http://ftp.FreeBSD.org' >> .cshrc
echo 'setenv PACKAGEROOT http://ftp.FreeBSD.org' >> /usr/home/vagrant/.cshrc
echo 'export PACKAGEROOT=http://ftp.FreeBSD.org;' >> .bashrc
echo 'export PACKAGEROOT=http://ftp.FreeBSD.org;' >> /usr/home/vagrant/.bashrc
echo 'Defaults env_keep += "PACKAGEROOT"' >> /usr/local/etc/sudoers
@AndrewEdwards

This comment has been minimized.

Copy link

AndrewEdwards commented Sep 8, 2014

All uses of gist.github.com in FreeBSD-8.4-vagrant.md and raw.github.com on L19 of setup.sh should be changed to gist.githubusercontent.com and raw.githubusercontent.com respectively. These urls are redirected to the correct location when used in a browser but are not redirected when used in a script or from the shell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.