【发布时间】:2014-07-16 03:12:01
【问题描述】:
我有一个简单的 vagrant box,我在学习教程时正在构建它。我在这个盒子上建立了我的流浪文件。
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.provision :shell, :path => "bootstrap.sh"
#config.vm.network "forwarded_port", guest: 80, host: 8080
end
这似乎工作正常,正在等待其他一些配置,但我在配置时遇到了问题。
它发现 Shell 脚本没有错误。它甚至构建了流浪者盒子。但是,当它完成时,我会收到此错误
==> default: stdin: is not a tty
==> default: bash: /tmp/vagrant-shell: /user/bin/env: bad interpreter: No such file or directory
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:
Stderr from the command:
stdin: is not a tty
bash: /tmp/vagrant-shell: /user/bin/env: bad interpreter: No such file or directory
当我什么都不做 ssh 时,我安装的设置已安装。当我通过命令在终端命令中运行 bash 脚本时,它可以工作。这是我的 bash 脚本。
#!/user/bin/env bash
#install
sudo apt-get update
sudo apt-get install -y python-software-properties
sudo add-apt-repository -y ppa:ondrej/php5
sudo apt-get update
sudo apt-get install -y wget php5 apache2 php5-mcrypt php5-curl git
sudo apt-get update
#apache onfig
sudo a2enmod rewrite
#Symlink for local development
#remove the WWW for Apache
sudo rm -rf /var/www
#symlink for local directory ln -fs {PATH TO LOCAL PROJECT} /var/www
sudo ln -fs /pathtolocaldirectory /var/www
#Restart Apache
sudo service apache2 restart
【问题讨论】: