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

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

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

Linuxは、Unixをベースにして開発されたオペレーティングシステムです。日本では「リナックス」と呼ばれています。 主にWebサーバやDNSサーバ、イントラネットなどのサーバ用OSとして利用されています。 上位500のスーパーコンピュータの90%以上はLinuxを使用しています。 携帯端末用のプラットフォームAndroidは、Linuxカーネル上に構築されています。

Q&A

解決済

2回答

1242閲覧

Windows10にLinux仮想環境を構築したいがvagrant upがうまくできない。

taboopython

総合スコア40

Linux

Linuxは、Unixをベースにして開発されたオペレーティングシステムです。日本では「リナックス」と呼ばれています。 主にWebサーバやDNSサーバ、イントラネットなどのサーバ用OSとして利用されています。 上位500のスーパーコンピュータの90%以上はLinuxを使用しています。 携帯端末用のプラットフォームAndroidは、Linuxカーネル上に構築されています。

0グッド

1クリップ

投稿2019/06/13 06:28

編集2019/06/18 21:09

Linux環境を準備中です。
元もとは以下のようなエラーが出てたため、以下にある<対応したこと>を実行したもののなかなかうまくいきません。原因や対応方法がおわかりになる方がいらっしゃいましたらご教示いただければ幸いです。

python

1The box 'ubuntu/xenia164' could not be found or 2could not be accessed in the remote catalog. If this is a private 3box on HashiCorp's Vagrant Cloud, please verify you're logged in via 4`vagrant login`. Also, please double-check the name. The expanded 5URL and error message are shown below:

<対応したこと>
https://qiita.com/litencatt/items/5a14d41dc08b14a5f00eをみて、
vagrantfileの先頭に
Vagrant :: DEFAULT_SERVER_URL.replace( 'https://vagrantcloud.com')を記述し、再度vagrant upupしてみたものの次のようなエラーが出てきてNG先に進めません。

<さらなる該当のエラー>
syntax error, unexpected tIDENTIFIER, expecting end-of-input
...' https://vagrantcloud.com ')

なお、環境はwindows10、virtualBoxvirtualBoxインストール済みです。

vagrantfileの更新内容

python

1# -*- mode: ruby -*- 2# vi: set ft=ruby : 3 4# All Vagrant configuration is done below. The "2" in Vagrant.configure 5# configures the configuration version (we support older styles for 6# backwards compatibility). Please don't change it unless you know what 7# you're doing. 8Vagrant.configure("2") do |config| 9 # The most common configuration options are documented and commented below. 10 # For a complete reference, please see the online documentation at 11 # https://docs.vagrantup.com. 12 13 # Every Vagrant development environment requires a box. You can search for 14 # boxes at https://vagrantcloud.com/search. 15 config.vm.box = "ubuntu/xenial64" 16 17 # Disable automatic box update checking. If you disable this, then 18 # boxes will only be checked for updates when the user runs 19 # `vagrant box outdated`. This is not recommended. 20 # config.vm.box_check_update = false 21 22 # Create a forwarded port mapping which allows access to a specific port 23 # within the machine from a port on the host machine. In the example below, 24 # accessing "localhost:8080" will access port 80 on the guest machine. 25 # NOTE: This will enable public access to the opened port 26 # config.vm.network "forwarded_port", guest: 80, host: 8080 27 28 # Create a forwarded port mapping which allows access to a specific port 29 # within the machine from a port on the host machine and only allow access 30 # via 127.0.0.1 to disable public access 31 # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" 32 33 # Create a private network, which allows host-only access to the machine 34 # using a specific IP. 35 # config.vm.network "private_network", ip: "192.168.33.10" 36 37 # Create a public network, which generally matched to bridged network. 38 # Bridged networks make the machine appear as another physical device on 39 # your network. 40 # config.vm.network "public_network" 41 42 # Share an additional folder to the guest VM. The first argument is 43 # the path on the host to the actual folder. The second argument is 44 # the path on the guest to mount the folder. And the optional third 45 # argument is a set of non-required options. 46 # config.vm.synced_folder "../data", "/vagrant_data" 47 48 # Provider-specific configuration so you can fine-tune various 49 # backing providers for Vagrant. These expose provider-specific options. 50 # Example for VirtualBox: 51 # 52 # config.vm.provider "virtualbox" do |vb| 53 # # Display the VirtualBox GUI when booting the machine 54 # vb.gui = true 55 # 56 # # Customize the amount of memory on the VM: 57 # vb.memory = "1024" 58 # end 59 # 60 # View the documentation for the provider you are using for more 61 # information on available options. 62 63 # Enable provisioning with a shell script. Additional provisioners such as 64 # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the 65 # documentation for more information about their specific syntax and use. 66 # config.vm.provision "shell", inline: <<-SHELL 67 # apt-get update 68 # apt-get install -y apache2 69 # SHELL 70end 71

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

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

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

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

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

guest

回答2

0

taboopythonさん、

ubuntu/xenia164 => ubuntu/xenial64

ではないでしょうか。
(数字の1ではなくて、アルファベットLの小文字)


(追記)

新しくフォルダを作って、

vagrant init -m ubuntu/xenial64 vagrant up --provider=virtualbox

で、どうでしょうか?

  • 実行例- 実行例(PowerShellで実行)

環境: Windows 10 Pro 64bit, Virtualbox v6.0.8, Vagrant v2.2.4

PS C:\> mkdir C:\Vagrant\xenial64 Directory: C:\Vagrant Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 6/13/2019 12:31 AM xenial64 PS C:\> cd C:\Vagrant\xenial64\ PS C:\Vagrant\xenial64> vagrant init -m ubuntu/xenial64 A `Vagrantfile` has been placed in this directory. You are now ready to `vagrant up` your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on `vagrantup.com` for more information on using Vagrant. PS C:\Vagrant\xenial64> vagrant up --provider=virtualbox Bringing machine 'default' up with 'virtualbox' provider... ==> default: Box 'ubuntu/xenial64' could not be found. Attempting to find and install... default: Box Provider: virtualbox default: Box Version: >= 0 ==> default: Loading metadata for box 'ubuntu/xenial64' default: URL: https://vagrantcloud.com/ubuntu/xenial64 ==> default: Adding box 'ubuntu/xenial64' (v20190605.0.0) for provider: virtualbox default: Downloading: https://vagrantcloud.com/ubuntu/boxes/xenial64/versions/20190605.0.0/providers/virtualbox.box default: Download redirected to host: cloud-images.ubuntu.com default: ==> default: Successfully added box 'ubuntu/xenial64' (v20190605.0.0) for 'virtualbox'! ==> default: Importing base box 'ubuntu/xenial64'... ==> default: Matching MAC address for NAT networking... ==> default: Checking if box 'ubuntu/xenial64' version '20190605.0.0' is up to date... ==> default: Setting the name of the VM: xenial64_default_1560411223466_79392 ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat ==> default: Forwarding ports... default: 22 (guest) => 2222 (host) (adapter 1) ==> default: Running 'pre-boot' VM customizations... ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key default: default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. default: default: Inserting generated public key within guest... default: Removing insecure key from the guest if it's present... default: Key inserted! Disconnecting and reconnecting using new SSH key... ==> default: Machine booted and ready! ==> default: Checking for guest additions in VM... default: The guest additions on this VM do not match the installed version of default: VirtualBox! In most cases this is fine, but in rare cases it can default: prevent things such as shared folders from working properly. If you see default: shared folder errors, please make sure the guest additions within the default: virtual machine match the version of VirtualBox you have installed on default: your host and reload your VM. default: default: Guest Additions Version: 5.1.38 default: VirtualBox Version: 6.0 ==> default: Mounting shared folders... default: /vagrant => C:/Vagrant/xenial64 PS C:\Vagrant\xenial64> vagrant ssh Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-150-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage 0 packages can be updated. 0 updates are security updates. New release '18.04.2 LTS' available. Run 'do-release-upgrade' to upgrade to it. vagrant@ubuntu-xenial:~$ uname -a Linux ubuntu-xenial 4.4.0-150-generic #176-Ubuntu SMP Wed May 29 18:56:26 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux vagrant@ubuntu-xenial:~$ exit logout Connection to 127.0.0.1 closed. PS C:\Vagrant\xenial64> vagrant halt ==> default: Attempting graceful shutdown of VM... PS C:\Vagrant\xenial64>

投稿2019/06/13 06:49

編集2019/06/13 07:43
mt08

総合スコア1825

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

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

taboopython

2019/06/13 07:24

トライしてみたところ、次のような結果になりましたが、これで進めるという理解で良いでしょうか? default: URL: https://vagrantcloud.com/ubuntu/xenial64 The box you're attempting to add doesn't support the provider you requested. Please find an alternate box or use an alternate provider. Double-check your requested provider to verify you didn't simply misspell it. If you're adding a box from HashiCorp's Vagrant Cloud, make sure the box is released. Name: ubuntu/xenial64 Address: https://vagrantcloud.com/ubuntu/xenial64 Requested provider: [:hyperv]
mt08

2019/06/13 07:46

エラーメッセージを見ると、Hyper-Vを使おうとして、失敗してますね。 追記にかきましたが、vagrant up --provider=virtualbox でVirtualboxを使うようにしてます。 あと、Hyper-Vがインストールされてると、Virtualboxは使えなかったと思います。
taboopython

2019/06/13 21:09

ありがとうございます。Hyper-Vを無効にして実行するとThe Hyper-V cmdlets for PowerShell are not available! Vagrant requires these to control Hyper-V. Please enable them in the "Windows Features" control panel and try again. となり、進まない感じです。。
taboopython

2019/06/13 21:30

新しくフォルダを作る方法も試してみました。 すると次のようなメッセージが出てきて進めません。 なお、現在最新のVirtualbox v6.0.8をインストールしてあるのですが、 5.1などをインストールし直す必要があるということでしょうか? Vagrant has detected that you have a version of VirtualBox installed that is not supported by this version of Vagrant. Please install one of the supported versions listed below to use Vagrant: 4.0, 4.1, 4.2, 4.3, 5.0, 5.1 A Vagrant update may also be available that adds support for the version you specified. Please check www.vagrantup.com/downloads.html to download the latest version.
mt08

2019/06/14 02:13

vagrantのバージョンはいくつでしょうか? 古くないですか?
taboopython

2019/06/14 04:08

確かに古かったです。元々は2.0でした。再インストールしバージョンを上げて現在はVagrant 2.2.4です。 しかし、再実行したところ、次のようなメッセージになり進めません。 なお作り直したフォルダC:\Vagrant\xenial64で実行してます。 Bringing machine 'default' up with 'virtualbox' provider... ==> default: Box 'base' could not be found. Attempting to find and install... default: Box Provider: virtualbox default: Box Version: >= 0 ==> default: Box file was not detected as metadata. Adding it directly... ==> default: Adding box 'base' (v0) for provider: virtualbox default: Downloading: base default: An error occurred while downloading the remote file. The error message, if any, is reproduced below. Please fix this error and try again. Couldn't open file /C:/Vagrant/xenial64/base
mt08

2019/06/17 15:40

taboopythonさん、 > Box 'base' could not be found. 'base;というboxが見つからない、というエラーがでてるので、Vagrantfileがおかしそうです。 ('ubuntu/xenial64' というboxを探しに行くはず.) Vagrantfileで、config.vm.box = "ubuntu/xenial64" と正しくboxが指定されているか、確認してみてください
taboopython

2019/06/18 06:26

mt08さん、ありがとうございます。 linux環境を諦めかけていたところでした。 帰宅してwindows環境に戻り、改めてトライしご報告させていただきます。
taboopython

2019/06/18 10:45

mt0808さん、 確認してました。 config.vm.box = "base" とあったので、 config.vm.box = "ubuntu/xenial64" と修正し実行してみました。 すると、何度か見慣れたメッセージが またしても。。。 A Vagrant environment or target machine is required to run this command. Run `vagrant init` to create a new Vagrant environment. Or, get an ID of a target machine from `vagrant global-status` to run this command on. A final option is to change to a directory with a Vagrantfile and to try again. まだ対策ありそうでしょうか?
mt08

2019/06/18 14:27 編集

最終的にできた、Vagrantfile を質問の欄に追記してもらえますか?確認してみます。 あと、VirtualBoxを起動して、仮想マシンが作成されていたら、全て削除してから、vagrant upもためしてみてください。
taboopython

2019/06/18 21:10

ありがとうございます。質問欄一番下に追記いたしました。ご確認をお願いいたします。 virtualBox削除は別途おこなってみます。
mt08

2019/06/18 23:37

Vagrantfileは、大丈夫そうです。VM削除もだめだったら、Vagrant / VirtualBoxもインストールし直し。それでもだめなら、Windowsから入れ直し、、でしょうか..
taboopython

2019/06/19 06:19

VM削除/Vagrant / VirtualBoxもインストールし直しても変わらずなので、windows 10proを入れているのですが、入れ直しは正直ハードルが高いですね。今回のアドバイスは今後の参考にさせていただき、現windows環境にLinuxを入れるのは諦め、raspiなどを導入することを考えようと思います。親身に細かいご説明をいただき誠にありがとうございました。
mt08

2019/06/19 16:07

taboopythonさん、 Windows10に、Virtualbox+Vagrant環境を入れる記事です。 https://qiita.com/mt08/items/0ffa4059c112379c0c07 だいぶ前に書いたものですが、いまでもこんな感じで設定しています。 機会があれば、参考にしてみてください。 あと、Windows10でLinuxなら、WSLという環境もありますね。
taboopython

2019/06/19 21:48

mt08さん 大変ありがたいです。windows10でLinuxという場面が今後増えてきた際にぜひ参照させていただきます。くじけずトライしてみようと思います。ありがとうございます!
guest

0

自己解決

現windows環境にLinuxを入れるのは諦め、rasberry piでlinux環境を導入する。

投稿2019/06/19 06:21

taboopython

総合スコア40

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問