發布日期:Oct 4, 2020
文章於 Oct 18, 2020 更新
發布日期:2020-10-?? 最後更新日期:2020-10-10
由於 Homestead 要在 vitural box 上運作,書上特別強調必須依照 Homestead 的版本要求選擇對應的 vitural box 。但是我要在哪裡知道目前的 Homestead 需要哪個版本的 Virtual Box ?
google 「Laravel Homestead」找到了 Laravel Homestead 的說明文件,文件上說要用 5.x 版本的 vitural box ,所以雖然 vitural box 目前已經推到 6.x 的版本,也不要選最新版避免節外生枝。
note: vargant 提供的安裝選項有新增為四項,一樣選用 virtualbox
這邊等了快半小時,看來我的網速不夠飛速 XD
Homestead 設定檔進展很多,現在到 v11.1.2 了!@@
features:
- mariadb: false
- ohmyzsh: false
- webdriver: false
#services:
# - enabled:
# - "postgresql@12-main"
# - disabled:
# - "postgresql@11-main"
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
vagrant ssh
進入 Homestead 虛擬主機之後 ls
看一下, Homestead.yaml 檔共享目錄裡紀錄的虛擬主機目錄真的有存在。所以應該是執行 bash init.sh
的時候,按照當時下載的 Homestead 檔案建立 Homestead 虛擬環境(這邊是初始化, Homestead.yaml 異動後要更新環境的話,需使用 vagrant provision
)。
卡關惹Q___Q 先休息冷靜一下(2020-10-07 過午夜了Q_____Q)
composer create-project --prefer-dist laravel/laravel shop_laravel
時,遇到 [InvalidArgumentException]
vagrant@homestead:~/code$ composer create-project --prefer-dist laravel/laravel shop_laravel
[InvalidArgumentException]
Composer could not find a composer.json file in /home/vagrant/code/shop_laravel
To initialize a project, please create a composer.json file as described in
the https://getcomposer.org/ "Getting Started" section
composer create-project xxxxxxx
192.168.10.10 shop-laravel.local
Bringing machine 'homestead' up with 'virtualbox' provider...
==> homestead: Box 'laravel/homestead' could not be found. Attempting to find and install...
homestead: Box Provider: virtualbox
homestead: Box Version: ~> 10.0.0
==> homestead: Loading metadata for box 'laravel/homestead'
homestead: URL: https://vagrantcloud.com/laravel/homestead
==> homestead: Adding box 'laravel/homestead' (v10.0.0) for provider: virtualbox
homestead: Downloading: https://vagrantcloud.com/laravel/boxes/homestead/versions/10.0.0/providers/virtualbox.box
Download redirected to host: vagrantcloud-files-production.s3.amazonaws.com
homestead: Calculating and comparing box checksum...
==> homestead: Successfully added box 'laravel/homestead' (v10.0.0) for 'virtualbox'!
==> homestead: Importing base box 'laravel/homestead'...
==> homestead: Matching MAC address for NAT networking...
==> homestead: Checking if box 'laravel/homestead' version '10.0.0' is up to date...
==> homestead: Setting the name of the VM: homestead
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
==> 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: Warning: Connection reset. Retrying...
homestead: Warning: Remote connection disconnect. Retrying...
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: The guest additions on this VM do not match the installed version of
homestead: VirtualBox! In most cases this is fine, but in rare cases it can
homestead: prevent things such as shared folders from working properly. If you see
homestead: shared folder errors, please make sure the guest additions within the
homestead: virtual machine match the version of VirtualBox you have installed on
homestead: your host and reload your VM.
homestead:
homestead: Guest Additions Version: 6.1.8
homestead: VirtualBox Version: 5.2
==> homestead: Setting hostname...
==> homestead: Configuring and enabling network interfaces...
==> homestead: Mounting shared folders...
homestead: /vagrant => /Users/bijen/Code/Homestead
homestead: /home/vagrant/code => /Users/bijen/Code
homestead: /home/vagrant/laravel_project => /Users/bijen/laravel_project
==> homestead: Detected mount owner ID within mount options. (uid: 1000 guestpath: /home/vagrant/code)
==> homestead: Detected mount group ID within mount options. (gid: 1000 guestpath: /home/vagrant/code)
==> homestead: Detected mount owner ID within mount options. (uid: 1000 guestpath: /home/vagrant/laravel_project)
==> homestead: Detected mount group ID within mount options. (gid: 1000 guestpath: /home/vagrant/laravel_project)
==> homestead: Running provisioner: file...
homestead: /Users/bijen/Code/Homestead/aliases => /tmp/bash_aliases
==> homestead: Running provisioner: shell...
homestead: Running: inline script
==> homestead: Running provisioner: shell...
homestead: Running: inline script
homestead:
homestead: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJt0x32prG1C6p/hrKDhLLm+UVl77aoZEuSfALANQWCsptM3kt51no+JIu8J8C9WoTeurwATZLP1tXeAPH4YIUn/xPEOi+iXqzIrJNNK6qk1vN1Ih0WxA2rDO2aPwjL0s8gIRp9VDKhIaL+nzCwWQTqAzvnNGU04qnlKXPiAT8Wpn5b0XnA07cMsswUFNMsT6dbAew/lj7kA+BWyC3eQhI+WeTgWsPWnXsVQu97O/al8DJL+TGhS3ZWRFGsUfoiKY2SM48GULWGLzdlrhvJCDs3aIEIhGC1EcDMxy2KFUCxjhh3/WqtOtlFbwv3deLcgw7R3TqPZO4ImRfaNmllKqZ i-am-bijen
==> homestead: Running provisioner: shell...
homestead: Running: inline script
==> homestead: Running provisioner: shell...
homestead: Running: inline script
==> homestead: Running provisioner: shell...
homestead: Running: inline script
==> homestead: Running provisioner: shell...
homestead: Running: inline script
homestead: Ignoring feature: mariadb because it is set to false
==> homestead: Running provisioner: shell...
homestead: Running: inline script
homestead: Ignoring feature: ohmyzsh because it is set to false
==> homestead: Running provisioner: shell...
homestead: Running: inline script
homestead: Ignoring feature: webdriver because it is set to false
==> homestead: Running provisioner: shell...
homestead: Running: /var/folders/zg/z6qg4xpx70d_0091ntyg0plm0000gp/T/vagrant-shell20201004-43309-17ev9xw.sh
==> homestead: Running provisioner: shell...
homestead: Running: /var/folders/zg/z6qg4xpx70d_0091ntyg0plm0000gp/T/vagrant-shell20201004-43309-abia02.sh
==> homestead: Running provisioner: Creating Certificate: homestead.test (shell)...
homestead: Running: script: Creating Certificate: homestead.test
homestead: Updating certificates in /etc/ssl/certs...
homestead: rehash: warning: skipping duplicate certificate in ca.homestead.homestead.pem
homestead: 1 added, 0 removed; done.
homestead: Running hooks in /etc/ca-certificates/update.d...
homestead: done.
==> homestead: Running provisioner: Creating Site: homestead.test (shell)...
homestead: Running: script: Creating Site: homestead.test
==> homestead: Running provisioner: shell...
homestead: Running: inline script
==> homestead: Running provisioner: shell...
homestead: Running: /var/folders/zg/z6qg4xpx70d_0091ntyg0plm0000gp/T/vagrant-shell20201004-43309-si82a2.sh
==> homestead: Running provisioner: Checking for old Schedule (shell)...
homestead: Running: script: Checking for old Schedule
==> homestead: Running provisioner: Creating Certificate: bijen.laravel-site (shell)...
homestead: Running: script: Creating Certificate: bijen.laravel-site
==> homestead: Running provisioner: Creating Site: bijen.laravel-site (shell)...
homestead: Running: script: Creating Site: bijen.laravel-site
==> homestead: Running provisioner: shell...
homestead: Running: inline script
==> homestead: Running provisioner: shell...
homestead: Running: /var/folders/zg/z6qg4xpx70d_0091ntyg0plm0000gp/T/vagrant-shell20201004-43309-1e955wi.sh
==> homestead: Running provisioner: Checking for old Schedule (shell)...
homestead: Running: script: Checking for old Schedule
==> homestead: Running provisioner: Clear Variables (shell)...
homestead: Running: script: Clear Variables
==> homestead: Running provisioner: Restarting Cron (shell)...
homestead: Running: script: Restarting Cron
==> homestead: Running provisioner: Restart Webserver (shell)...
homestead: Running: script: Restart Webserver
==> homestead: Running provisioner: Creating MySQL Database: homestead (shell)...
homestead: Running: script: Creating MySQL Database: homestead
homestead: We didn't find a PID for mariadb, skipping $DB creation
==> homestead: Running provisioner: Creating Postgres Database: homestead (shell)...
homestead: Running: script: Creating Postgres Database: homestead
==> homestead: Running provisioner: Update Composer (shell)...
homestead: Running: script: Update Composer
homestead: Updating to version 1.10.13 (stable channel).
homestead:
homestead: Use composer self-update --rollback to return to version 1.10.9
==> homestead: Running provisioner: shell...
homestead: Running: /var/folders/zg/z6qg4xpx70d_0091ntyg0plm0000gp/T/vagrant-shell20201004-43309-px4t6p.sh
==> homestead: Running provisioner: Update motd (shell)...
homestead: Running: script: Update motd
==> homestead: Running provisioner: shell...
homestead: Running: /var/folders/zg/z6qg4xpx70d_0091ntyg0plm0000gp/T/vagrant-shell20201004-43309-vbzsh2.sh
vagrant@homestead:~/Code$ laravel new shop_laravel
bijen.laravel-site
vagrant up
後就可以看到 http://kejyun.app 的內容?我在執行完之後先看設定好的 domain ,只看到 No input file specified.
vagrant up
之前就裝好 laravel 」?所以原來 laravel 不是裝在 homestead 裡面?!!但是看書裡的描述應該是裝在 homestead 才對?我誤會了哪一邊?@@