Skip to content

Instantly share code, notes, and snippets.

@hangxingliu
Last active March 28, 2017 06:04
Show Gist options
  • Save hangxingliu/b6754411d1c184ded603277064c53671 to your computer and use it in GitHub Desktop.
Save hangxingliu/b6754411d1c184ded603277064c53671 to your computer and use it in GitHub Desktop.
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/xenial64"
# 不自动升级
config.vm.box_check_update = false
# 虚拟机内的8080 => 8080
config.vm.network "forwarded_port", guest: 8080, host: 8080
# 虚拟机内的80 => 8081
config.vm.network "forwarded_port", guest: 80, host: 8081
# 虚拟机内的22 => 2223
config.vm.network "forwarded_port", guest: 22, host: 2223
# 虚拟机内的/host_share <==> /home/police/VM/Share
config.vm.synced_folder "../Share", "/host_share"
config.vm.provider "virtualbox" do |vb|
# 不显示virtualbox的UI界面 在启动的时候
vb.gui = false
# 自定义内存: 4GB
vb.memory = "4096"
end
# 更多阅读: 使用自己的SSH公私钥
# https://ermaker.github.io/blog/2015/11/18/change-insecure-key-to-my-own-key-on-vagrant.html
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
# sudo apt-get update
# sudo apt-get install -y apache2
# SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment