使用Vagrant获取shell脚本问题和失败

时间:2013-10-18 16:50:08

标签: macos shell virtual-machine virtualbox vagrant

我有以下详情:

Vagrant文​​件:

Vagrant.configure("2") do |config|
 config.vm.box = "Precise32"
 config.vm.box_url = "http://files.vagrantup.com/precise32.box"
 config.vm.synced_folder "./Public","/var/www/",create:true
 config.vm.network :private_network, ip: "192.168.55.55"
 config.vm.provision :shell, :path => "setup.sh"
end

Shell文件:

   sudo apt-get -y update
   sudo apt-get install apache2 php5 libapache2-mod-php5 
   sudo sudo apachectl restart

  The shell is s little limited but i want to get it to work first before i attempt all the other php stuff etc


  The error i get starts here:

  Do you want to continue [Y/n]? Abort.
  The following SSH command responded with a non-zero exit status.
  Vagrant assumes that this means the command failed!

  chmod +x /tmp/vagrant-shell && /tmp/vagrant-shell

  Stdout from the command:

然后继续尝试获取或点击文件

  Fetched 3,018 kB in 4s (681 kB/s)
  Reading package lists...
  Reading package lists...
  Building dependency tree...
  Reading state information...
  The following extra packages will be installed:
    apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapr1
    libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap ssl-cert
  Suggested packages:
    www-browser apache2-doc apache2-suexec apache2-suexec-custom
    openssl-blacklist
  The following NEW packages will be installed:
    apache2 apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common
    libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap ssl-cert
  0 upgraded, 10 newly installed, 0 to remove and 155 not upgraded.
  Need to get 1,845 kB of archives.
  After this operation, 5,314 kB of additional disk space will be used.
  Do you want to continue [Y/n]? Abort.


  Stderr from the command:

  stdin: is not a tty
我甚至尝试过:

   config.vm.network :forwarded_port, host: 3003, guest: 3000

这就是失败,但是当我去localhost:3000或者我得到的时候:

   SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1
   Protocol mismatch.

我正在使用MAC OSX 10.8.5

也是它所说的部分      你想继续[Y / n]吗?

我无法自动选择它为我做这件事。

1 个答案:

答案 0 :(得分:1)

您可以尝试在apt-get install中添加'-y'吗?喜欢:sudo apt-get -y install apache2 php5 libapache2-mod-php5克服'你想继续[Y / n]'吗? - nikhil