一個命令 就可以登陸 Homestead

王鯨弋發表於2018-08-25

我們登陸 Homestead 時通常需要:

Administrator@WIN-RNAKVK2PF6K MINGW64 ~
$ cd ~/Homestead
$ vagrant up
$ vagrant ssh

!!! 而現在只需要一個命令:!!!

首先建立資料夾:

D:\shell

在該目錄下建立檔案:(沒有檔名字尾)

D:\shell\home

檔案內容:

echo "welcome into Homestead"
cd ~/Homestead
vagrant up
vagrant ssh

設定環境變數

D:\shell

重啟電腦後在 cmd 中輸入 home 命令 :

 Administrator@WIN-RNAKVK2PF6K MINGW64 ~
$ home
welcome into Homestead
Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Checking if box 'laravel/homestead' is up to date...
==> homestead-7: Clearing any previously set forwarded ports...
==> homestead-7: Clearing any previously set network interfaces...
==> homestead-7: Preparing network interfaces based on configuration...
    homestead-7: Adapter 1: nat
    homestead-7: Adapter 2: hostonly
==> homestead-7: Forwarding ports...
    homestead-7: 80 (guest) => 8000 (host) (adapter 1)
    homestead-7: 443 (guest) => 44300 (host) (adapter 1)
    homestead-7: 3306 (guest) => 33060 (host) (adapter 1)
    homestead-7: 4040 (guest) => 4040 (host) (adapter 1)
    homestead-7: 5432 (guest) => 54320 (host) (adapter 1)
    homestead-7: 8025 (guest) => 8025 (host) (adapter 1)
    homestead-7: 27017 (guest) => 27017 (host) (adapter 1)
    homestead-7: 22 (guest) => 2222 (host) (adapter 1)
==> homestead-7: Running 'pre-boot' VM customizations...
==> homestead-7: Booting VM...
==> homestead-7: Waiting for machine to boot. This may take a few minutes...
    homestead-7: SSH address: 127.0.0.1:2222
    homestead-7: SSH username: vagrant
    homestead-7: SSH auth method: password
    homestead-7: Warning: Connection reset. Retrying...
    homestead-7: Warning: Connection aborted. Retrying...
    homestead-7: Warning: Connection reset. Retrying...
    homestead-7: Warning: Connection aborted. Retrying...
    homestead-7: Warning: Connection reset. Retrying...
    homestead-7: Warning: Connection aborted. Retrying...
    homestead-7: Warning: Remote connection disconnect. Retrying...
    homestead-7: Warning: Connection aborted. Retrying...
    homestead-7: Warning: Connection reset. Retrying...
    homestead-7: Warning: Connection aborted. Retrying...
    homestead-7: Warning: Connection reset. Retrying...
    homestead-7: Warning: Connection aborted. Retrying...
    homestead-7: Warning: Remote connection disconnect. Retrying...
    homestead-7: Warning: Connection aborted. Retrying...
    homestead-7: Warning: Connection reset. Retrying...
    homestead-7: Warning: Connection aborted. Retrying...
    homestead-7: Warning: Connection reset. Retrying...
    homestead-7: Warning: Connection aborted. Retrying...
==> homestead-7: Machine booted and ready!
==> homestead-7: Checking for guest additions in VM...
    homestead-7: The guest additions on this VM do not match the installed version of
    homestead-7: VirtualBox! In most cases this is fine, but in rare cases it can
    homestead-7: prevent things such as shared folders from working properly. If you see
    homestead-7: shared folder errors, please make sure the guest additions within the
    homestead-7: virtual machine match the version of VirtualBox you have installed on
    homestead-7: your host and reload your VM.
    homestead-7:
    homestead-7: Guest Additions Version: 5.0.18_Ubuntu r106667
    homestead-7: VirtualBox Version: 5.2
==> homestead-7: [vagrant-hostsupdater] Checking for host entries
==> homestead-7: [vagrant-hostsupdater]   found entry for: 192.168.10.10 homestead
==> homestead-7: [vagrant-hostsupdater]   found entry for: 192.168.10.10 laravel-2.watts.com
==> homestead-7: [vagrant-hostsupdater]   found entry for: 192.168.10.10 laravel-5.watts.com
==> homestead-7: [vagrant-hostsupdater]   found entry for: 192.168.10.10 laravel-6.watts.com
==> homestead-7: [vagrant-hostsupdater]   found entry for: 192.168.10.10 lumen-5.watts.com
==> homestead-7: [vagrant-hostsupdater]   found entry for: 192.168.10.10 phpmyadmin.watts.com
==> homestead-7: [vagrant-hostsupdater]   found entry for: 192.168.10.10 blog.watts.com
==> homestead-7: [vagrant-hostsupdater]   found entry for: 192.168.10.10 admin-new.watts.com
==> homestead-7: Setting hostname...
==> homestead-7: Configuring and enabling network interfaces...
==> homestead-7: Mounting shared folders...
    homestead-7: /vagrant => C:/Users/Administrator/Homestead
    homestead-7: /home/vagrant/code => C:/Users/Administrator/code
==> homestead-7: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> homestead-7: flag to force provisioning. Provisioners marked to run always will still run.
Welcome to Ubuntu 16.04.4 LTS (GNU/Linux 4.4.0-116-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

306 packages can be updated.
131 updates are security updates.

Last login: Sat Aug 25 02:00:56 2018 from 10.0.2.2
vagrant@homestead:~$
本作品採用《CC 協議》,轉載必須註明作者和本文連結
相信時間和變化

相關文章