1、報錯詳情
安裝vagrant,在運行vagrant up時,報錯
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
這個錯誤是因爲網絡太慢,下載virtualbox.box失敗,可以換個網絡再試一下。
如果網絡實在太慢的話,可以試試下面的方法,我們可以手動下載virtualbox.box
2、手動下載並安裝virtualbox.box
(1)下載並移動安裝包
點擊下載:
https://vagrantcloud.com/laravel/boxes/homestead/versions/7.1.0/providers/virtualbox.box
下載完成後將下載後的安裝包重新命名爲virtualbox.box
並將文件移動到安裝vagrant的文件夾下面
#語句實例:移動到vagrant的文件夾下面,需要將~/rails-va路徑換成自己的安裝vagrant的文件夾的路徑
rm virtualbox.box ~/rails-va
(2)手動導入virtualbox.box
在安裝vagrant的文件夾下面(我電腦上面的路徑是~/rails-va)繼續執行下面語句
vagrant box add ubuntu virtualbox.box
執行成功後,會返回下面的結果
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'ubuntu' (v0) for provider:
box: Unpacking necessary files from: file:///Users/maoningyi/rails-va/virtualbox.box
==> box: Successfully added box 'ubuntu' (v0) for 'virtualbox'!
(3)檢查是否導入成功
vagrant box list
出現下面語句就說明導入成功了
ubuntu (virtualbox, 0)
(4)繼續執行vagrant up
~/rails-va$ vagrant up
#系統返回的結果
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'virtualbox.box' 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 'virtualbox.box' (v0) for provider: virtualbox
default: Unpacking necessary files from: file:///Users/maoningyi/rails-va/virtualbox.box
==> default: Successfully added box 'virtualbox.box' (v0) for 'virtualbox'!
==> default: Importing base box 'virtualbox.box'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: rails-va_default_1577761656747_39956
Vagrant is currently configured to create VirtualBox synced folders with
the `SharedFoldersEnableSymlinksCreate` option enabled. If the Vagrant
guest is not trusted, you may want to disable this option. For more
information on this option, please refer to the VirtualBox manual:
https://www.virtualbox.org/manual/ch04.html#sharedfolders
This option can be disabled globally with an environment variable:
VAGRANT_DISABLE_VBOXSYMLINKCREATE=1
or on a per folder basis within the Vagrantfile:
config.vm.synced_folder '/host/path', '/guest/path', SharedFoldersEnableSymlinksCreate: false
==> default: Vagrant has detected a configuration issue which exposes a
==> default: vulnerability with the installed version of VirtualBox. The
==> default: current guest is configured to use an E1000 NIC type for a
==> default: network adapter which is vulnerable in this version of VirtualBox.
==> default: Ensure the guest is trusted to use this configuration or update
==> default: the NIC type using one of the methods below:
==> default:
==> default: https://www.vagrantup.com/docs/virtualbox/configuration.html#default-nic-type
==> default: https://www.vagrantup.com/docs/virtualbox/networking.html#virtualbox-nic-type
==> 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: 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: Warning: Connection reset. Retrying...
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: Mounting shared folders…
default: /vagrant => /Users/maoningyi/rails-va
再執行vagrant ssh就可以成功登陸到Ubuntu系統
~/rails-va$ vagrant ssh
#系統返回的結果
Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-45-generic x86_64)
_ _ _
| | | | | |
| |__ ___ _ __ ___ ___ ___| |_ ___ __ _ __| |
| '_ \ / _ \| '_ ` _ \ / _ \/ __| __/ _ \/ _` |/ _` |
| | | | (_) | | | | | | __/\__ \ || __/ (_| | (_| |
|_| |_|\___/|_| |_| |_|\___||___/\__\___|\__,_|\__,_|
* Homestead 8.0.0 released! PHP 7.3 is now the default!
* Settler v7.0.0 released! Make sure you update
* Need PHP 5.6 or 7.0? Homestead 7.x Settler 6.4.0
0 packages can be updated.
0 updates are security updates.
vagrant@vagrant:~$