0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Build Laravel on Windows

Last updated at Posted at 2022-12-05

vagrant 環境構築

@pon2021さんの記事参照致しました。

 こちら

Download Oracle VM VirtualBox

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

~/.ssh/id_rsa.pub

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)...

  • 解決方法:

    1. "ネットワークと共有センター" を開く
    2. "アダプターの設定の変更" を開く
    3. "VirtualBox Host-Only Network #N" のプロパティを開く
    4. "VirtualBox NDIS6 Bridged Networking Driver" にチェックを入れる
    5. "インターネットプロトコル バージョン6(TCP/IPv6)" のチェックを外す
    6. [OK] を押し、プロパティウィンドウを閉じる
    7. "VirtualBox Host-Only Network #N" の右クリックメニューで「無効」にする
    8. 再度、「有効」にし直す
    9. vagrant up --provision and/or PC再起動

ref:

Laravelの登録機能設定

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?