Skip to content

Instantly share code, notes, and snippets.

@adamculp
Last active December 18, 2015 08:08
Show Gist options
  • Save adamculp/5751842 to your computer and use it in GitHub Desktop.
Save adamculp/5751842 to your computer and use it in GitHub Desktop.
How I built an Ubuntu 14.04 base box for Vagrant
1. Install VirtualBox (4.3.10 for this writing)
2. Install Vagrant (1.6 for this writing)
3. Download Ubuntu 14.04 64bit Server ISO
4. Crate a new VM with following criteria:
a. 40 GB hard drive, set to dynamically resize
b. 360 MB RAM
c. Network set up as NAT
d. Disable Floppy, Audio, USB
e. Set CDRom to point to Ubuntu 14.04 64bit Server ISO
5. Boot up VM and install Ubuntu.
a. Username = vagrant
b. Password = vagrant
c. Hostname = vagrantup.com
6. On first boot set CDRom to point to host CDRom.
6.5. 'sudo apt-get update'
7. Run 'sudo apt-get install' other helpful and required apps:
a. ssh
b. git
c. linux-headers-$(uname -r)
d. build-essential
7. Create group and add user
a. groupadd vagrant
b. usermod -a -G vagrant vagrant
8. Sudo permissions tweak
a. use command 'sudo visudo'
b. Add line Defaults env_keep="SSH_AUTH_SOCK"
c. Add line "vagrant ALL=(ALL) NOPASSWD: ALL"
9. Edit /etc/ssh/sshd_config file and set UseDNS to 'no'
10. Install vagrant's public keys
a. mkdir ~/.ssh/
b. cd ~/.ssh
c. wget http://github.com/mitchellh/vagrant/raw/master/keys/vagrant
d. wget http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub
e. mv vagrant.pub authorized_keys
11. Run 'sudo which sudo'
a. Should return "/usr/bin/sudo"
12. Install Virtualbox Guest Additions (4.3.6/10/14/16 all are broken in some way. Use 4.3.12)
a. From VirtualBox Devices menu select "Install Guest Additions..."
b. sudo sh /media/cdrom/VBoxLinuxAdditions.run (if Ubuntu doesn't run it automatically)
c. Ignore warning about not finding headers for current running kernel, OpenGL, and Window System Drivers installation.
13. Run 'sudo apt-get install' other required apps:
a. ruby
b. ruby-dev
c. rubygems-integration (note: this used to be simply rubygems)
d. puppet
14. Run 'sudo gem install chef ruby-shadow --no-ri --no-rdoc'.
15. Run 'sudo apt-get clean'.
15.1. Run 'sudo dd if=/dev/zero of=/EMPTY bs=1M; sudo rm -f /EMPTY'. (this may take awhile)
16. Run 'sudo shutdown -h now'.
16.1. On host run 'VBoxManage modifyhd /path/to/ubuntu-1404/ubuntu-1404.vdi --compact' (only supported for VDI file type)
For VMDK: clone disk after zeroing out, then attach cloned disk. https://www.virtualbox.org/manual/ch08.html#vboxmanage-clonevdi
VBoxManage clonehd ec9c2a4a-cdae-4e86-b671-6a7e914e0359 box-disk2.vmdk
VBoxManage storageattach <VMNAME> \
--storagectl "SATA" \
--device 0 \
--port 0 \
--type hdd \
--medium box-disk2.vmdk
17. Run 'vagrant package --base {name-of-vm-in-vb} --output {name-of-new-base-box.box} --vagrantfile /name/of/Vagrantfile/to/include'.
#
# The following steps were used to install Zend Server 6.0 and configure it for a Vagrant base box.
#
# Used steps outlined at http://files.zend.com/help/Zend-Server-6/zend-server.htm#deb_installing_zend_server.htm
#
1. Add the Zend Server repositories to Aptitude by editing /etc/apt/sources.list
a. sudo vi /etc/apt/sources.list
b. Added "deb http://repos.zend.com/zend-server/6.0/deb_ssl1.0 server non-free
2. Required me to run "sudo su" to continue operating as root versus using sudo.
3. Added Zend public key.
a. Run "wget http://repos.zend.com/zend.key -O- |apt-key add -"
4. Ran "sudo apt-get update"
5. Ran "sudo apt-get install zend-server-php-5.4" (could have used 5.3 instead)
6. Move the /var/www directory to /var/www.bak and then create a symbolic link pointing to where vagrant shared folder will be.
a. sudo mv /var/www /var/www.bak
b. sudo ln -fs /vagrant /var/www
7. Add PHP CLI support.
a. Edit /home/vagrant/.bashrc and add the following lines:
PATH=$PATH:/usr/local/zend/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/zend/lib
b. Now run 'source ~/.bashrc' to update your settings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment