我一直在尝试使用Vagrant连接到CentOS 6.4虚拟机,但一直无果。 我使用salt作为配置代理,并成功安装了apache、php和mysql等软件包。 当我通过ssh登录到虚拟机后,apache可以正常运行。我在/var/www中添加了一个index.html文件,在curl localhost:80时可以得到其内容。
Vagrant.configure("2") do |config|
## Chose your base box
config.vm.box = "centos63"
config.vm.box_url = ""
## For masterless, mount your salt file root
config.vm.synced_folder "salt/roots/", "/srv/"
## Use all the defaults:
config.vm.provision :salt do |salt|
salt.verbose = true
salt.run_highstate = true
salt.minion_config = "salt/minion"
end
end
Vagrant::Config.run do |config|
config.vm.forward_port 80, 8080
config.vm.share_folder "mypath", "/var/www/leo", "."
end
我在本地机器上运行了sudo lsof -i :8080,但没有返回结果。我还使用iptables -F清除了来宾机器中的iptable配置。当我curl访问来宾机器时
curl -v 'localhost:8080'
* About to connect() to localhost port 8080 (#0)
* Trying ::1...
* Connection refused
* Trying 127.0.0.1...
* Connection refused
* Trying fe80::1...
* Connection refused
* couldn't connect to host
* Closing connection #0
curl: (7) couldn't connect to host
我需要安装客户附加组件吗?我查了一下如何安装,但我不确定这是必须安装在主机还是客户机上。不知道还有什么其他的尝试方法。