windows - 在 Windows 上使用“vagrant up”启动 vagrant box 时出错
问题描述
我正在尝试使用 vagrant 设置虚拟机环境。我已经通过 vagrantcloud.com 对不同的盒子进行了几次尝试,但是当我尝试启动这个盒子时我总是卡住:我在 vagrant 文件上添加了一个 URL 以供下载https://app.vagrantup.com/ ubuntu/boxes/trusty64,但我似乎没有工作
λ vagrant init x9 ubuntu/boxes/bionic64
λ vagrant up 使用 'virtualbox' 提供程序将机器 'default' 启动... 默认值:找不到 Box 'x9'。正在尝试查找并安装... 默认值:Box 提供者:virtualbox 默认值:Box 版本:>= 0 默认值:未将 Box 文件检测为元数据。直接添加...默认:为提供者添加框'x9'(v0):virtualbox 默认:下载:https ://app.vagrantup.com/ubuntu/boxes/bionic64 默认:下载 远程文件时出错。错误消息(如果有)在下面重现。请修复此错误并重试。
无法连接到 app.vagrantup.com 端口 443:超时
任何人都知道我该如何进行?
解决方案
如果您还没有下载它,它找不到这个盒子是正常的。我试过了,效果很好,它下载并启动盒子,我和你分享我的基本配置(这是我测试的)
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
end
这是我的输出:
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/bionic64' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'ubuntu/bionic64'
default: URL: https://vagrantcloud.com/ubuntu/bionic64
==> default: Adding box 'ubuntu/bionic64' (v20200304.0.0) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/ubuntu/boxes/bionic64/versions/20200304.0.0/providers/virtualbox.box
==> default: Box download is resuming from prior download progress
default: Download redirected to host: cloud-images.ubuntu.com
==> default: Successfully added box 'ubuntu/bionic64' (v20200304.0.0) for 'virtualbox'!
==> default: Importing base box 'ubuntu/bionic64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/bionic64' version '20200304.0.0' is up to date...
==> default: Setting the name of the VM: amos_default_1583767787636_71616
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 5.2.34
default: VirtualBox Version: 6.1
==> default: Mounting shared folders...
default: /vagrant => /home/amos
唯一可能的解释是您的互联网连接不良......尝试在这里进行速度测试:
如果您的连接不良,请尝试重新启动调制解调器或联系您的互联网提供商
推荐阅读
- php - 无法获取远程数据以在 Select2 中呈现
- python - 如何在 Python 中自动生成多个文件
- typescript - 在 src 目录中创建 React App (TypeScript) 自动生成 react-app-env.d.ts
- javascript - 使用 Get 和 Javascript 检索多选值
- sql - SQL:返回日期跨度有间隙
- powershell - 在字符串中使用系统变量在 Powershell 中获取文件版本
- python - PyGithub - 如何在 repo 中获取子文件夹的内容
- yaml - 如何在 Arcanist 中设置 YAML linting?
- monitoring - 为 Nagios 插件编写优雅的超时
- python - 熊猫数据框查询