标签:www 入门 started config vagrant https com
introduce:
https://www.vagrantup.com/intro/index.html
get started
https://www.vagrantup.com/intro/getting-started/index.html
$ vagrant init hashicorp/precise64
$ vagrant up
Project Setup
https://www.vagrantup.com/intro/getting-started/project_setup.html
$ mkdir vagrant_getting_started
$ cd vagrant_getting_started
$ vagrant init hashicorp/precise64
Boxes
https://www.vagrantup.com/intro/getting-started/boxes.html
$ vagrant box add hashicorp/precise64
Open the Vagrantfile and change the contents to the following
Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/precise64"
config.vm.box_version = "1.1.0"
end
Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/precise64"
config.vm.box_url = "https://vagrantcloud.com/hashicorp/precise64"
end
Discover Vagrant Boxes
https://vagrantcloud.com/boxes/search
Up And SSH
https://www.vagrantup.com/intro/getting-started/up.html
$ vagrant up
$ vagrant ssh
Synced Folders
https://www.vagrantup.com/intro/getting-started/synced_folders.html
By default, Vagrant shares your project directory (remember, that is the one with the Vagrantfile) to the /vagrant directory in your guest machine.
Provisioning
https://www.vagrantup.com/intro/getting-started/provisioning.html
Installing Apache
bootstrap.sh
#!/usr/bin/env bash
apt-get update
apt-get install -y apache2
if ! [ -L /var/www ]; then
rm -rf /var/www
ln -fs /vagrant /var/www
fi
Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/precise64"
config.vm.provision :shell, path: "bootstrap.sh"
end
vagrant up to create your machine and Vagrant will automatically provision it.
If the guest machine is already running from a previous step, run vagrant reload --provision
so that you can use your own browser to access the guest machine.
Networking
https://www.vagrantup.com/intro/getting-started/networking.html
use Vagrant's networking features to give us additional options for accessing the machine from our host machine.
Port Forwarding
Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/precise64"
config.vm.provision :shell, path: "bootstrap.sh"
config.vm.network :forwarded_port, guest: 80, host: 4567
end
Run a vagrant reload or vagrant up (depending on if the machine is already running) so that these changes can take effect.
Other Networking
https://www.vagrantup.com/docs/networking/
Share
https://www.vagrantup.com/intro/getting-started/share.html
Teardown
https://www.vagrantup.com/intro/getting-started/teardown.html
vagrant suspend
vagrant halt
vagrant destroy
标签:www,入门,started,config,vagrant,https,com 来源: https://www.cnblogs.com/pascal1000/p/10851280.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。