-
Download and install VirtualBox 4.3.6 for Ubuntu 12.10 (which is the base of Linux Mint 14) i386, file name: virtualbox-4.3_4.3.6-91406~Ubuntu~quantal_i386.deb;
-
Download and install vagrant installer for linux: vagrant_1.4.3_i686.deb;
-
Follow the "Getting Started" guide of vagrant:
$ vagrant init precise32 http://files.vagrantup.com/precise32.box $ vagrant up
The first step simply created a config file in the current folder,
so it's very fast. The second step will download a box file from vagrantup.com
and could be fairly slow. When it's done, use vagrant ssh
to login to the VM,
use vagrant suspend
to save your work and shutdown the VM,
use vagrant up
agian to startup the VM again.
Add box locally
-
Downlaod box file from internet;
-
vagrant box add <box-name> <box-file-path>
, whereis a logical name you specify, is local filesystem path.
"package" is a "green" command. It will not affect your current box list, just produce a box file.
Login as root
sudo su -
Package Refined VMs
Under the project folder (which contains "Vagrantfile"):
-
Write some comments in README file, for example the installed components: "This box is based on ... , has installed ... , has run 'apt-get update (or apt-fast update)".
-
Run
vagrant package --output mybox.box --include README
(no need to shutdown VM beforehand, vagrant will shutdown it); -
After
vagrant box add mybox mybox.box
, go to ~/.vagrant/boxes/mybox/virtualbox/include/ to see the README file, where "virtualbox" is the provider name of your VM, it can be vmware or something else. -
Run
vagrant box remove mybox
to remove the box from your vagrant box lists.
Add command alias for type efficiency
Add the following into ~/.zshrc or ~/.bashrc:
alias va='vagrant'
alias vas='vagrant status'
alias vau='vagrant up'
alias vah='vagrant halt'
alias vad='vagrant destroy'
Example Vagrantfile
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/xenial64"
config.ssh.username = "ubuntu"
config.ssh.password = "..."
# get the password from ~/.vagrant.d/boxes/<box-id>/0/<provider-id>/Vagrantfile
# e.g.: ~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-xenial64/0/virtualbox/Vagrantfile
config.vm.define "kivybox"
config.vm.hostname = "kivybox"
config.vm.network "public_network", ip: "172.18.0.242"
config.vm.provider "virtualbox" do |vb|
vb.memory = "10240"
end
end