現在vagrantの開発環境の設定を行なっております。
https://qiita.com/tosite0345/items/baabf9a325d8100a621a
上記サイトを参照に行なっており、rbenv install 2.5.1
が完了しても,バージョンを確認すると
-bash コマンドが見つかりません
となってしまいます。
その後、インストールできていないと思い、再度上記サイトの上からやり直しても同じようにコマンドが見つからず、無限ループ状態から抜け出せません。
このようなを経験されている方、解決方法をお伺いできないでしょうか?
よろしくお願い致します。
気になる質問をクリップする
クリップした質問は、後からいつでもMYページで確認できます。
またクリップした質問に回答があった際、通知やメールを受け取ることができます。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
回答2件
0
centos/7という事で、拙作のVagrantfile置いておきます
Vagrantfile
1use_ruby_version = "2.5.3" 2use_node_version = "v10.13.0" 3 4Vagrant.configure("2") do |config| 5 config.vm.box = "centos/7" 6 config.vm.network "forwarded_port", guest: 3000, host: 3000, host_ip: "127.0.0.1" 7 config.vm.provider "virtualbox" do |vb| 8 # # Display the VirtualBox GUI when booting the machine 9 # vb.gui = true 10 # 11 # # Customize the amount of memory on the VM: 12 # vb.memory = "1024" 13 # vb.customize ["modifyvm", :id, "--memory", "2048", "--cpus", "4", "--ioapic", "on"] 14 end 15 16 # システムのアップデート&必要パッケージのインストール 17 config.vm.provision "shell", inline: <<-SHELL 18 yum -y update &>/dev/null 19 yum -y install gcc gcc-c++ make git openssl-devel readline-devel zlib-devel 20 yum -y install automake libtool bzip2-devel sqlite-devel 21 SHELL 22 config.vm.provision "shell", privileged: false, inline: <<-SHELL 23 if ! type anyenv &>/dev/null;then 24 git clone https://github.com/riywo/anyenv ~/.anyenv 25 echo 'export PATH="$HOME/.anyenv/bin:$PATH"' >> ~/.bash_profile 26 echo 'eval "$(anyenv init -)"' >> ~/.bash_profile 27 source ~/.bash_profile 28 mkdir -p $(anyenv root)/plugins 29 git clone https://github.com/znz/anyenv-update.git $(anyenv root)/plugins/anyenv-update 30 fi 31 if ! type rbenv ndenv &> /dev/null;then 32 anyenv install rbenv --skip-existing 33 anyenv install ndenv --skip-existing 34 source ~/.bash_profile 35 fi 36 if ! type ruby &> /dev/null || ruby -e "exit RUBY_VERSION != '#{use_ruby_version}'";then 37 anyenv update rbenv 38 rbenv install #{use_ruby_version} --skip-existing 39 rbenv global #{use_ruby_version} 40 fi 41 if ! type node &> /dev/null || [ $(node -v) != "#{use_node_version}" ];then 42 anyenv update ndenv 43 ndenv install #{use_node_version} --skip-existing 44 ndenv global #{use_node_version} 45 fi 46 gem update --system --no-document 47 gem install --no-document --force bundler 48 gem install --no-document rails pry 49 rbenv rehash 50 SHELL 51 52 config.vm.network :public_network 53end
vagrant up
vagrant up --provision
するだけで、rails
コマンドが使用可能になります
投稿2018/11/13 11:46
編集2018/11/13 11:57総合スコア15147
あなたの回答
tips
太字
斜体
打ち消し線
見出し
引用テキストの挿入
コードの挿入
リンクの挿入
リストの挿入
番号リストの挿入
表の挿入
水平線の挿入
プレビュー
質問の解決につながる回答をしましょう。 サンプルコードなど、より具体的な説明があると質問者の理解の助けになります。 また、読む側のことを考えた、分かりやすい文章を心がけましょう。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。