0

这是我第一次尝试在 Windows 机器上使用 Vagrant。

我只是在关注 Vagrant 入门指南。

这是我的流浪文件:

Vagrant.configure(2) do |config|
    config.vm.box = "hashicorp/precise32"
    config.vm.provision :shell, path: "bootstrap.sh"
    config.ssh.insert_key = false
end

这是我的 boostrap.sh(我已经尝试使用 .ps1)

#!/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

当我运行(我使用cmder而不是默认提示)vagrant upvagrant reload --provision时,系统无法安装apache。这是完整的错误:

? vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'hashicorp/precise32' is up to date...
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 => 2200 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2200
    default: SSH username: vagrant
    default: SSH auth method: private 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: 4.2.0
    default: VirtualBox Version: 5.0
==> default: Mounting shared folders...
    default: /vagrant => M:/sites/site1
==> default: Running provisioner: shell...
    default: Running: C:/Users/Marcelo/AppData/Local/Temp/vagrant-shell20151010-5260-lpnmoq.sh
==> default: stdin: is not a tty
==> default: Err http://us.archive.ubuntu.com precise InRelease
==> default:
==> default: Err http://security.ubuntu.com precise-security InRelease
==> default:
==> default: Err http://us.archive.ubuntu.com precise-updates InRelease
==> default:
==> default: Err http://security.ubuntu.com precise-security Release.gpg
==> default:   Temporary failure resolving 'security.ubuntu.com'
==> default: Err http://us.archive.ubuntu.com precise-backports InRelease
==> default:
==> default: Err http://us.archive.ubuntu.com precise Release.gpg
==> default:   Temporary failure resolving 'us.archive.ubuntu.com'
==> default: Err http://us.archive.ubuntu.com precise-updates Release.gpg
==> default:   Temporary failure resolving 'us.archive.ubuntu.com'
==> default: Err http://us.archive.ubuntu.com precise-backports Release.gpg
==> default:   Temporary failure resolving 'us.archive.ubuntu.com'
==> default: Reading package lists...
==> default: W
==> default: :
==> default: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/InRelease
==> default: W
==> default: :
==> default: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-updates/InRelease
==> default: W
==> default: :
==> default: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-backports/InRelease
==> default: W
==> default: :
==> default: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/InRelease
==> default: W
==> default: :
==> default: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise/Release.gpg  Temporary failure resolving 'us.archive.ubuntu.com'
==> default: W
==> default: :
==> default: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/Release.gpg  Temporary failure resolving 'security.ubuntu.com'
==> default: W
==> default: :
==> default: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-updates/Release.gpg  Temporary failure resolving 'us.archive.ubuntu.com'
==> default: W
==> default: :
==> default: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/precise-backports/Release.gpg  Temporary failure resolving 'us.archive.ubuntu.com'
==> default: W
==> default: :
==> default: Some index files failed to download. They have been ignored, or old ones used instead.
==> default: Reading package lists...
==> default: Building dependency tree...
==> default: Reading state information...
==> default: The following extra packages will be installed:
==> default:   apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapr1
==> default:   libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap ssl-cert
==> default: Suggested packages:
==> default:   www-browser apache2-doc apache2-suexec apache2-suexec-custom
==> default:   openssl-blacklist
==> default: The following NEW packages will be installed:
==> default:   apache2 apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common
==> default:   libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap ssl-cert
==> default: 0 upgraded, 10 newly installed, 0 to remove and 66 not upgraded.
==> default: Need to get 1,829 kB of archives.
==> default: After this operation, 5,311 kB of additional disk space will be used.
==> default: Err http://us.archive.ubuntu.com/ubuntu/ precise/main libapr1 i386 1.4.6-1
==> default:   Temporary failure resolving 'us.archive.ubuntu.com'
==> default: Err http://us.archive.ubuntu.com/ubuntu/ precise/main libaprutil1 i386 1.3.12+dfsg-3
==> default:   Temporary failure resolving 'us.archive.ubuntu.com'
==> default: Err http://us.archive.ubuntu.com/ubuntu/ precise/main libaprutil1-dbd-sqlite3 i386 1.3.12+dfsg-3
==> default:   Temporary failure resolving 'us.archive.ubuntu.com'
==> default: Err http://us.archive.ubuntu.com/ubuntu/ precise/main libaprutil1-ldap i386 1.3.12+dfsg-3
==> default:   Temporary failure resolving 'us.archive.ubuntu.com'
==> default: Err http://us.archive.ubuntu.com/ubuntu/ precise/main apache2.2-bin i386 2.2.22-1ubuntu1
==> default:   Temporary failure resolving 'us.archive.ubuntu.com'
==> default: Err http://us.archive.ubuntu.com/ubuntu/ precise/main apache2-utils i386 2.2.22-1ubuntu1
==> default:   Temporary failure resolving 'us.archive.ubuntu.com'
==> default: Err http://us.archive.ubuntu.com/ubuntu/ precise/main apache2.2-common i386 2.2.22-1ubuntu1
==> default:   Temporary failure resolving 'us.archive.ubuntu.com'
==> default: Err http://us.archive.ubuntu.com/ubuntu/ precise/main apache2-mpm-worker i386 2.2.22-1ubuntu1
==> default:   Temporary failure resolving 'us.archive.ubuntu.com'
==> default: Err http://us.archive.ubuntu.com/ubuntu/ precise/main apache2 i386 2.2.22-1ubuntu1
==> default:   Temporary failure resolving 'us.archive.ubuntu.com'
==> default: Err http://us.archive.ubuntu.com/ubuntu/ precise-updates/main ssl-cert all 1.0.28ubuntu0.1
==> default:   Temporary failure resolving 'us.archive.ubuntu.com'
==> default: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/a/apr/libapr1_1.4.6-1_i386.deb  Temporary failure resolving 'us.archive.ubuntu.com'
==> default: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/a/apr-util/libaprutil1_1.3.12+dfsg-3_i386.deb  Temporary failure resolving 'us.archive.ubuntu.com'
==> default: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/a/apr-util/libaprutil1-dbd-sqlite3_1.3.12+dfsg-3_i386.deb  Temporary failure resolving 'us.archive.ubuntu.com'
==> default: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/a/apr-util/libaprutil1-ldap_1.3.12+dfsg-3_i386.deb  Temporary failure resolving 'us.archive.ubuntu.com'
==> default: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/a/apache2/apache2.2-bin_2.2.22-1ubuntu1_i386.deb  Temporary failure resolving 'us.archive.ubuntu.com'
==> default: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/a/apache2/apache2-utils_2.2.22-1ubuntu1_i386.deb  Temporary failure resolving 'us.archive.ubuntu.com'
==> default: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/a/apache2/apache2.2-common_2.2.22-1ubuntu1_i386.deb  Temporary failure resolving 'us.archive.ubuntu.com'
==> default: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/a/apache2/apache2-mpm-worker_2.2.22-1ubuntu1_i386.deb  Temporary failure resolving 'us.archive.ubuntu.com'
==> default: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/a/apache2/apache2_2.2.22-1ubuntu1_i386.deb  Temporary failure resolving 'us.archive.ubuntu.com'
==> default: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/s/ssl-cert/ssl-cert_1.0.28ubuntu0.1_all.deb  Temporary failure resolving 'us.archive.ubuntu.com'
==> default: E
==> default: :
==> default: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

更新

找到了一个可能的解决方案:将我的网络 DNS 更改为 Google Public DNS

4

0 回答 0