質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

Q&A

解決済

3回答

3898閲覧

vagrant init bento/centos-6.8 エラー 仮想マシン設定用のVagrantfileを作る

YuukaHasegawa

総合スコア13

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

0グッド

0クリップ

投稿2018/09/28 02:20

前提・実現したいこと

ドットインストール#仮想マシンを立ち上げようの
Windows編の質問です
いくつか同じ質問を探しましたが
解決方法がみつからず質問させていただきます。

仮想マシン設定用のVagrantfileを作る

vagrant init bento/centos-6.8
現在こちらのコマンド実行ができず
PS C:\windows\system32\MyVagrant\MyCentOS>ここまではできております。

一度、vagrant init bento/centos-6.8コマンドの実行ができたのですが、
vagrant upができず、
Windows7のpowershellのバージョンを変更後に
再度、vagrant init bento/centos-6.8を入力したところ現在のエラー状態です。

vagrantを3度ほど削除しいれなおしております。

発生している問題・エラーメッセージ

vagrant : The term 'vagrant' is not recognized as the name of a cmdlet, function, script file, or operable program. Che ck the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + vagrant init bento/centos-6.8 + ~~~~~~~ + CategoryInfo : ObjectNotFound: (vagrant:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答3

0

ベストアンサー

YuukaHasegawaさん、

追記:
Chocolatey(https://chocolatey.org )というパッケージ管理ツールをつかって、VagrantとVirtualBoxのインストールをします。

# 1. 管理者で、PowerShellを開く # 2. Chocolatey のインストール  Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) #3. Vagrant, VirtualBox と chocolateygui をインストール cinst -y vagrant virtualbox chocolateygui

エラーなくインストールできたら、vagrantコマンドを試してみてください。


(投稿 2018/09/28 14:37)

  • (インストールの確認) デフォルトだと、C:\HashiCorp\Vagrant\bin\vagrant.exeのあたりにインストールされると思いますが、ファイルがありますか?

  • 存在している場合、C:\HashiCorp\Vagrant\bin\vagrant.exe init bento/centos-6.8 とタイプすると、どうでしょうか?

  • (Pathの確認) powershell を開いて、$Env:Path.split(";") | Select-String "vagrant" とやって、以下のようにvagrant.exeが存在するPATHが表示されますか?

(実行例)

PS C:\> $Env:Path.split(";") | Select-String "vagrant" C:\HashiCorp\Vagrant\bin PS C:\>
  • ない場合、$Env:Path +=";C:\HashiCorp\Vagrant\bin"とタイプして、vagrant を実行するとどうでしょうか?`

(実行例)

PS C:\> vagrant vagrant : The term 'vagrant' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + vagrant + ~~~~~~~ + CategoryInfo : ObjectNotFound: (vagrant:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\> $Env:Path +=";C:\HashiCorp\Vagrant\bin" PS C:\> vagrant --version Vagrant 2.1.5 PS C:\>

投稿2018/09/28 05:37

編集2018/09/28 06:33
mt08

総合スコア1825

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

YuukaHasegawa

2018/09/28 06:07

ご回答ありがとうございます。 (インストールの確認) デフォルトだと、C:\HashiCorp\Vagrant\bin\vagrant.exeのあたりにインストールされると思いますが、ファイルがありますか? ↓ C:\HashiCorp\Vagrant\bin\vagrant.exe : The term 'C:\HashiCorp\Vagrant\bin\vagrant.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verif y that the path is correct and try again. At line:1 char:1 + C:\HashiCorp\Vagrant\bin\vagrant.exe + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (C:\HashiCorp\Vagrant\bin\vagrant.exe:String) [], CommandNotFoundExcepti on + FullyQualifiedErrorId : CommandNotFoundException エラーになりました ない場合、$Env:Path +=";C:\HashiCorp\Vagrant\bin"とタイプして、vagrant を実行するとどうでしょうか?` ↓ vagrant : The term 'vagrant' is not recognized as the name of a cmdlet, function, script file, or operable program. Che ck the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + vagrant + ~~~~~~~ + CategoryInfo : ObjectNotFound: (vagrant:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException 初心者でまったくわからず、申し訳ありませんが もし改改善方法をご存知でしたら是非おしえてください。
mt08

2018/09/28 06:34 編集

YuukaHasegawaさん、 エラーメッセージから、`C:\HashiCorp\Vagrant\bin\vagrant.exe` に実行ファイルがないので、ほかの場所にインストールされているか、または、きちんとインストールできていないようです。 ところで、管理者で、PowerShellを開くことはできますか? 追記にChocolateyを使っての、vagrant virtualboxのインストール方法を書いたので、それで、インストールを試してみてください。
YuukaHasegawa

2018/09/28 07:00

お返事いただきありがとうございます! vagrant init bento/centos-6.8 は無事完了できました!が、、 次の問題が、、、 Vagrantfileを編集して仮想マシンのIPアドレスを192.168.33.10にする 次のこちらの工程で、、アトムにてCドライブのユーザーの中にMyVagrant>MyCentOSのなかにvagrantfileが見当たらず、 前回すべての工程をやり直そうと 消してしまったのが原因かとは思いますが、、 再度、はじめから ★今後複数の仮想マシンを作ることを想定して、それらをまとめるフォルダ(MyVagrant)を作る エラーが発生し ↓ ↓ mkdir : An item with the specified name C:\windows\system32\MyVagrant already exists. At line:1 char:1 + mkdir MyVagrant + ~~~~~~~~~~~~~~~ + CategoryInfo : ResourceExists: (C:\windows\system32\MyVagrant:String) [New-Item], IOException + FullyQualifiedErrorId : DirectoryExist,Microsoft.PowerShell.Commands.NewItemCommand 表示が出てしまいました
mt08

2018/09/28 07:20

YuukaHasegawaさん、 > mkdir : An item with the specified name C:\windows\system32\MyVagrant already exists. 英語で書いてありますが、mkdirで、指定した C:\windows\system32\MyVagrant はすでに存在している (から作れないよ) というエラーですね。 C:\Windows\system32\ はシステムまわりのファイルが入ってるので、使わないほうがよいと思います。というか、ふつう、ユーザのファイルは C:\Windows 以下には置かないですね。 以下のようにして、C:\Vagrant\ 以下で作業をされては、いかがでしょうか。 C: cd C:\ mkdir C:\Vagrant cd C:\Vagrant Windowsの基本的な操作やお作法がよくわかってなさそうな感じがしますが。。。使って慣れるしかないですね (笑 エラーメッセージも、がんばって、読んだり、ググったりしてみてください。そのうち慣れると思います。
YuukaHasegawa

2018/10/09 06:18

解決いたしました!まだまだ初心者で、すごく助かりました(;_;) ご丁寧にありがとうございました!
guest

0

経緯は不明ですが、環境変数がうまく設定されていないのかもしれないですね。
vagrant をインストールした場所と、環境変数の情報をチェックしてみてください。

Windows7 は既に記憶のかなたですが、[システムのプロパティ] - [詳細] あたりに [環境変数]というボタンがあり、それをクリックで環境変数が見れます。
その中の Path の設定に vagrant をインストールした場所が記載されているか確認してみてください。

投稿2018/09/28 03:51

ssasaki

総合スコア1167

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

vagrant.exe init bento/centos-6.8

やってみてもらえます?

投稿2018/09/28 02:23

kunai

総合スコア5405

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

YuukaHasegawa

2018/09/28 02:44

ご回答ありがとうございます!! 試してみましたがエラーがでました、、、 ↓  ↓  ↓ vagrant.exe : The term 'vagrant.exe' is not recognized as the name of a cmdlet, function, script file, or operable prog ram. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + vagrant.exe init bento/centos-6.8 + ~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (vagrant.exe:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問