通过命令 vagrant ssh 来 SSH 登录 Homestead 虚拟机中,登录失败且无反应
1、通过命令 vagrant ssh 来 SSH 登录 Homestead 虚拟机中,登录失败且无反应。如图1
Lenovo@DESKTOP-QLPK8QM MINGW64 ~/Homestead (v12.1.0) $ vagrant ssh Lenovo@DESKTOP-QLPK8QM MINGW64 ~/Homestead (v12.1.0)
2、通过 folders 来指明本机要映射到 Homestead 虚拟机上的文件夹。原因在于 map 所指定的本机文件夹 E:/wwwroot 过大。
folders: - map: E:/wwwroot to: /home/vagrant/Code
3、最终决定换一个本机的文件夹 E:/wwwroot/vagrant
folders: - map: E:/wwwroot/vagrant to: /home/vagrant/Code
4、在主机里执行命令 vagrant provision && vagrant reload 意为「应用 Homestead.yaml 配置」和「重启虚拟机」。重新登录,登录成功。如图2
Lenovo@DESKTOP-QLPK8QM MINGW64 ~/Homestead (v12.1.0) $ vagrant provision && vagrant reload ==> homestead: VM is not currently running. Please, first bring it up with `vagr ==> homestead: Checking if box 'lc/homestead' version '11.0.0' is up to date... ==> homestead: Clearing any previously set forwarded ports... ==> homestead: Clearing any previously set network interfaces... ==> homestead: Preparing network interfaces based on configuration... homestead: Adapter 1: nat homestead: Adapter 2: hostonly ==> homestead: Forwarding ports... homestead: 80 (guest) => 8000 (host) (adapter 1) homestead: 443 (guest) => 44300 (host) (adapter 1) homestead: 3306 (guest) => 33060 (host) (adapter 1) homestead: 4040 (guest) => 4040 (host) (adapter 1) homestead: 5432 (guest) => 54320 (host) (adapter 1) homestead: 8025 (guest) => 8025 (host) (adapter 1) homestead: 9600 (guest) => 9600 (host) (adapter 1) homestead: 27017 (guest) => 27017 (host) (adapter 1) homestead: 22 (guest) => 2222 (host) (adapter 1) ==> homestead: Running 'pre-boot' VM customizations... ==> homestead: Booting VM... ==> homestead: Waiting for machine to boot. This may take a few minutes... homestead: SSH address: 127.0.0.1:2222 homestead: SSH username: vagrant homestead: SSH auth method: private key homestead: homestead: Vagrant insecure key detected. Vagrant will automatically replace homestead: this with a newly generated keypair for better security. homestead: homestead: Inserting generated public key within guest... homestead: Removing insecure key from the guest if it's present... homestead: Key inserted! Disconnecting and reconnecting using new SSH key... ==> homestead: Machine booted and ready! ==> homestead: Checking for guest additions in VM... ==> homestead: Setting hostname... ==> homestead: Configuring and enabling network interfaces... ==> homestead: Mounting shared folders... homestead: /vagrant => C:/Users/Lenovo/Homestead homestead: /home/vagrant/Code => E:/wwwroot/vagrant ==> homestead: Detected mount owner ID within mount options. (uid: 1000 guestpat ==> homestead: Detected mount group ID within mount options. (gid: 1000 guestpat ==> homestead: Machine already provisioned. Run `vagrant provision` or use the ` ==> homestead: flag to force provisioning. Provisioners marked to run always wil Lenovo@DESKTOP-QLPK8QM MINGW64 ~/Homestead (v12.1.0) $ vagrant ssh Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-65-generic x86_64) Last login: Sun Feb 28 03:12:16 2021 from 10.0.2.2 vagrant@homestead:~$
近期评论