vagrant 環境構築
@pon2021さんの記事参照致しました。
Download Oracle VM VirtualBox
- 上記を公式サイトからダウンロード&インストールする
https://www.virtualbox.org/wiki/Downloads
Download Vagrant
-
上記を公式サイトからダウンロード&インストールする
https://www.vagrantup.com/downloads.html -
コマンドプロンプトを起動し、
vagrant -v
でインストールされているか確認
Add Box
mkdir workspace
& cd workspace
vagrant box add laravel/homestead
*2) virtualboxを選択する
Homesteadをclone
git clone https://github.com/laravel/homestead.git Homestead
Homestead.yamlを作成
cd Homestead
init bat
make code (at local)
cd ..
mkdir code
SSH Key(if not created)
-
in root:
ssh-keygen -t rsa
-
in homestead.yaml
keys:
- ~/.ssh/id_rs
Homestead.yamlを設定
---
ip: "192.168.56.56"
memory: 2048
cpus: 2
provider: virtualbox
authorize: C:/Users/{your name}/.ssh/id_rsa.pub
keys:
- C:/Users/{your name}/.ssh/id_rsa
folders:
- map: C:/Users/{your name}/workspace/code
to: /home/vagrant/code
sites:
- map: homestead.test
to: /home/vagrant/code/laravel/public
databases:
- homestead
features:
- mysql: true
- mariadb: false
- postgresql: false
- ohmyzsh: false
- webdriver: false
services:
- enabled:
- "mysql"
# - disabled:
# - "postgresql@11-main"
#ports:
# - send: 33060 # MySQL/MariaDB
# to: 3306
# - send: 4040
# to: 4040
# - send: 54320 # PostgreSQL
# to: 5432
# - send: 8025 # Mailhog
# to: 8025
# - send: 9600
# to: 9600
# - send: 27017
# to: 27017
Vagrant起動
cd ~/Homestead
git checkout release
vagrant provision
vagrant up
vagrant ssh
cd code
composer create-project laravel/laravel --prefer-dist Laravel
- Homestead.yamlの
folders: - map: {}
にも、新しいプロジェクトが反映される
環境構築でハマったところ:
-
encode error: gitbashは、utf-8であるため、powershell(がshift-jisので)を使うことで解決
-
vagrant up`でエラー:
...network 'HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter #2' (VERR_INTNET_FLT_IF_NOT_FOUND)...
-
解決方法:
- "ネットワークと共有センター" を開く
- "アダプターの設定の変更" を開く
- "VirtualBox Host-Only Network #N" のプロパティを開く
- "VirtualBox NDIS6 Bridged Networking Driver" にチェックを入れる
- "インターネットプロトコル バージョン6(TCP/IPv6)" のチェックを外す
- [OK] を押し、プロパティウィンドウを閉じる
- "VirtualBox Host-Only Network #N" の右クリックメニューで「無効」にする
- 再度、「有効」にし直す
-
vagrant up --provision
and/or PC再起動
ref:
- Chinese: https://www.jianshu.com/p/a516cb26f632?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation
- Japanese: https://qiita.com/ucan-lab/items/9b97fbf0b43c0849fd51
-
vagrant up
でエラー:https://qiita.com/0xC0FFEE/items/ae80a7d767144c2e1992
Laravelの登録機能設定
-
Laravel 認証
- ref: https://laravel.com/docs/9.x/starter-kits#laravel-breeze-installation
- requirements: laravel 9 php 8.1.13, nodejs, npm
- memo:
- mysql -u root -p
-
Enter password:
secret
-
- account:
- name&email&pw:
- mysql -u root -p
- trouble shootings - フォーマット - ({入力したcmd}){error内容}:{解決方法or解決するの参照}:
-
(php artisan make:auth) Command "make:auth" is not defined. Did you mean one of these?
ref: https://stackoverflow.com/questions/34545641/php-artisan-makeauth-command-is-not-defined -
(composer require laravel/ui) 用語 'composer' は、コマンドレット、関数、スクリプト ファイル、....
ref:
https://www.narenohate.com/installation-composer#toc3 -
(composer require laravel/ui) Your requirements could not be resolved to an installable set of packages...
:
エラーの具体的な内容をもって、php.iniなどを修正 -
could not find driver (SQL: select * from information_schema.tables where table_schema = gnbulletinboard and table_name = migrations and table_type = 'BASE TABLE')
:https://stackoverflow.com/questions/46745365/artisan-migrate-could-not-find-driver -
SQLSTATE[HY000] [2002] 対象のコンピューターによって拒否されたため、接続できませんでした。 (SQL: select * from information_schema.tables where table_schema = gnbulletinboard and table_name = migrations and table_type = 'BASE TABLE')
:https://localhost8888.net/laravel/475/ -
Vite manifest not found at: /home/vagrant/Code/GNBulletinBoard/public/build/manifest.json
:- download: nodejs
- download: npm
npm install
npm run dev
-
-
DB設定:TODO