【发布时间】:2015-03-17 22:49:13
【问题描述】:
我最近不得不销毁并重新创建我的 Vagrant 实例。现在我不能运行任何 rails 命令,因为它说 Rails 没有安装。当我这样做时
Vagrant Up
我收到以下错误
default: /tmp/vagrant-shell: line 1: /home/vagrant/.rvm/scripts/rvm: No such file or directory
以下 SSH 命令以非零退出状态响应。 Vagrant 假设这意味着命令失败!
我的 Provision.sh 文件包含以下内容:
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main " | sudo tee -a /etc/apt/sources.list.d/pgdg.list
sudo wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get remove postgresql-client-9.1 postgresql-client-common postgresql-client postgresql-common -y
sudo apt-get install postgresql-9.3 postgresql-client-9.3 libpq-dev curl git build-essential libxslt-dev libxml2-dev -y
wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
curl -sSL https://get.rvm.io | bash -s stable --ruby
cat << EOF | sudo tee -a /home/vagrant/.bashrc
cd /vagrant
EOF
echo '# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust' | sudo tee /etc/postgresql/9.3/main/pg_hba.conf
echo 'machine api.heroku.com
login *****
password ****
machine code.heroku.com
login *****
password *****
' | tee /home/vagrant/.netrc
echo 'ssh-rsa ***** vagrant@precise32
' | tee /home/vagrant/.ssh/id_*****.pub
chmod 0600 /home/vagrant/.netrc
sudo -u postgres psql -c "create user ***** createdb createuser password '*****';"
sudo /etc/init.d/postgresql restart
我已经看到一些答案(不是特定于 Vagrant),表明我必须使用 sudo 或作为 root 安装了 rvm,需要将其删除,然后再次获取 rvm。我曾尝试这样做,但我不确定它如何应用于流浪盒子,无论如何我一定是做错了,因为它没有奏效。
我需要更正/添加到我的 provision.sh 文件或我的 Vagrantfile 中吗?
【问题讨论】:
标签: ruby-on-rails rvm vagrant