Skip to content

Instantly share code, notes, and snippets.

@codfish
Created October 29, 2014 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codfish/822d558130dafa902bbf to your computer and use it in GitHub Desktop.
Save codfish/822d558130dafa902bbf to your computer and use it in GitHub Desktop.
Create and customize a Vagrant box. reference: http://goo.gl/NfQrL4
# choose a box as a starting point
vagrant init hashicorp/precise64
vagrant up
vagrant ssh
# customize the box to your liking, for example:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install vim
sudo apt-get install apache2
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
sudo mysql_install_db
sudo /usr/bin/mysql_secure_installation
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
sudo apt-get install php5-cgi php5-cli php5-curl php5-common php5-gd php5-mysql
sudo service apache2 restart
# clean up
sudo apt-get clean
sudo dd if=/dev/zero of=/EMPTY bs=1M
sudo rm -f /EMPTY
cat /dev/null > ~/.bash_history && history -c && exit
# now back on your machine, not the vm
# create a new box from yours
vagrant package --output mynew.box
# add it to your intallation of Vagrant (Vagrant will "download" a copy
# to it's installation folder for safe keeping)
vagrant box add mynewbox mynew.box
# now whenever starting a project, you can use that custom box
vagrant init mynewbox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment