algolia search

Tìm thấy x bài viết trong xms.

Cài đặt homestead trên windows 10

Cài đặt homestead trên windows 10


Tải Vagrant về và setup sau vài bước next

https://www.vagrantup.com/downloads.html

Cài virtual box

https://www.virtualbox.org/wiki/Downloads

Nhớ restart máy tính sau khi cài xong 2 thằng này.

Thêm laravel homestead vào Vagrant

vagrant box add laravel/homestead

Có menu chọn thì chọn virtual box (số 3)

Đợi tí, mạng kém thì cũng hơi lâu ấy.

Mở command line lên kéo Homestead repository về

git clone https://github.com/laravel/homestead.git ~/Homestead
Cloning into 'C:/Users/kingo/Homestead'...
remote: Enumerating objects: 4336, done.
remote: Total 4336 (delta 0), reused 0 (delta 0), pack-reused 4336
Receiving objects: 100% (4336/4336), 984.10 KiB | 676.00 KiB/s, done.
Resolving deltas: 100% (2643/2643), done.

Checkout branch release của Homestead

cd ~/Homestead

git checkout release

Chạy init

// Đối với Mac / Linux...
bash init.sh

// Đối với Windows...
init.bat

Cấu hình Homestead.yaml

Mở file C:\Users\kingo\Homestead\Homestead.yaml (kingo là user ở máy mình ở máy bạn sẽ khác) và sửa như sau

---
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

#Nhớ thay đường dẫn cho phù hợp với máy tính của bạn
folders:
    - map: D:\Code\nguyentranchung\chungnguyen.xyz
      to: /home/chungnguyen.xyz

#Nhớ thay tên miền mà bạn thích
sites:
    - map: chungnguyen.test
      to: /home/chungnguyen.xyz/public

databases:
    - chungnguyen.xyz

features:
    - mariadb: false
    - ohmyzsh: false
    - webdriver: false

# ports:
#     - send: 50000
#       to: 5000
#     - send: 7777
#       to: 777
#       protocol: udp

Nhớ thay đường dẫn và tên miền cho phù hợp với project của bạn

Chỉnh file hosts windows

Mở file C:\Windows\System32\drivers\etc\hosts lên thêm dòng sau vào

192.168.10.10  chungnguyen.test

Cần quyền admin mới lưu file này lại được, nếu k lưu được thì copy file hosts ra desktop sửa rồi paste ngược trở lại.

Vagrant up

Tại terminal khi nãy chạy lệnh vagrant up

Xong rồi đó, mở web lên nhập url http://chungnguyen.test là xong

Làm sao connect MySQL vào homestead

host: 127.0.0.1
user: homestead
password: secret
port: 33060

Truy cập ssh vào homestead

Gõ lệnh vagrant ssh

Tắt homestead

Gõ lệnh vagrant halt

Đánh giá bài viết

Thích thì like
Cài đặt homestead trên windows 10
5/5 1 votes

Bình luận

Hiển thị bình luận Facebook