![如何在 Vagrant CentOS 7 VirtualBox 中运行 ZeroNet?](https://linux22.com/image/1525065/%E5%A6%82%E4%BD%95%E5%9C%A8%20Vagrant%20CentOS%207%20VirtualBox%20%E4%B8%AD%E8%BF%90%E8%A1%8C%20ZeroNet%EF%BC%9F.png)
我已开始零网在 CentOS 7 Vagrant VirtualBox 中,但我无法从主机访问它。从客户机上它可以工作:
[vagrant@localhost ~]$ curl http://127.0.0.1:43110/
Location changed: /1HeLLo4uzjaLetFx6NH3PMwFP3qbRbTf3D[vagrant@localhost ~]$
来自主持人:
$ curl http://127.0.0.1:43110/
curl: (56) Recv failure: Connection reset by peer
$ curl --connect-timeout 5 http://192.168.16.100:43110/
curl: (28) Connection timed out after 5001 milliseconds
这是启动日志
[vagrant@localhost ZeroBundle]$ unset DISPLAY
[vagrant@localhost ZeroBundle]$ ./ZeroNet.sh
- Starting ZeroNet...
[06:21:28] - OpenSSL loaded, version: 01000207F
[06:21:28] - Version: 0.5.3 r2003, Python 2.7.11 |Continuum Analytics, Inc.| (default, Dec 6 2015, 18:08:32)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)], Gevent: 1.0.2
[06:21:28] - Creating FileServer....
[06:21:28] TorManager Tor controller connect error: error: [Errno 111] Connection refused in TorManager.py line 159 > socket.py line 344
[06:21:28] - Creating UiServer....
[06:21:28] - Removing old SSL certs...
[06:21:28] - Starting servers....
[06:21:28] Ui.UiServer --------------------------------------
[06:21:28] Ui.UiServer Web interface: http://127.0.0.1:43110/
[06:21:28] Ui.UiServer --------------------------------------
[06:21:29] FileServer Checking port 15441 using portchecker.co...
[06:21:30] FileServer [BAD :(] Port closed: Port 15441 is closed.
[06:21:30] FileServer Trying to open port using UpnpPunch...
[06:21:45] FileServer UpnpPunch run error: UpnpError: Failed to communicate with igd using port 15441 on local machine after 3 tries. in FileServer.py line 74 > UpnpPunch.py line 324 > UpnpPunch.py line 315
这是我的 Vagrant 文件
$ grep -ve '^\s*#' Vagrantfile | cat -s
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
config.vm.network "forwarded_port", guest: 43110, host: 43110
config.vm.network "forwarded_port", guest: 15441, host: 15441
config.vm.network "public_network"
config.vm.provider "virtualbox" do |vb|
vb.gui = true
end
config.vm.provision "shell", run: "always", inline: <<-SHELL
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` dash /dash
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` zeronet /home/vagrant/ZeroBundle/ZeroNet
SHELL
end
以下是网络接口
[vagrant@localhost ~]$ ip address | grep inet
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic eth0
inet6 fe80::5054:ff:fe1f:dbb7/64 scope link
inet 192.168.16.100/24 brd 192.168.16.255 scope global dynamic eth1
inet6 fe80::a00:27ff:fea2:2944/64 scope link
VirtualBox 5.1.16
Vagrant 1.9.2
CentOS Linux 版本 7.3.1611(核心)
答案1
我通过运行让它工作
$ ./ZeroNet.sh --ui_ip "*"
http://zeronet.readthedocs.io/en/latest/faq/#是否可以在远程计算机上安装zeronet