Vagrantfile
Vagrant.configure("2) do |config| # Indicates the configuration version, there are different configuration file version.
# config.xxx.yyy is the actual config params, xxx is the namespace and yyy is the params
# The base image of the vagrant
config.vm.box = "ubuntu/xenial64"
# Set Ture for checking if box update is available in `vagrant up`, passive download, only show hint
config.vm.box_check_update = False
# Configure the hostname
config.vm.hostname = "ubuntu-test"
# For network configuration
# Port forwarding, 0.0.0.0:8080 -> guest:80
config.vm.network "forwarded_port", guest: 80, host: 8080
# Port forwarding, 127.0.0.1:8080 -> guest:80
config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
# assign private network IP, range: 192.168.0.0 ~ 192.168.255.255
config.vm.network "private_network", ip: "192.168.33.10"
# config.vm.network "private_network", type: "dhcp"
config.vm.network "public_network" # Network bridge
# Shared folder between (host,guest)
config.vm.synced_folder "../data", "/vagrant_data"
# provider configuration
# config.vm.provision :shell, path: "bootstrap.sh"
config.vm.provider "virtualbox" do |vb|
#vb.gui = true # enable GUI or not
vb.cpus = "2" # Number of CPU
vb.memory = "1024" # Memory allocated, MB
end
# Used for build the environment before ready to use ^(1)
# The following session will not be executed unless
# --provision is added
# Use `vagrant provision`
config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig"
config.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get install -y apache2
SHELLLast updated
Was this helpful?