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:~$