본문 바로가기
PHP/Laravel

윈도우에 홈스테드 설치하기 + 6.X 라라벨 설치

by 집탱구리 2020. 2. 3.
반응형

1. vagrant 설치하기 / virtualbox 설치하기

vagrantup.com/downloads.html

 

Download - Vagrant by HashiCorp

This page lists all the available downloads for Vagrant.

www.vagrantup.com

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

 

Downloads – Oracle VM VirtualBox

Download VirtualBox Here you will find links to VirtualBox binaries and its source code. VirtualBox binaries By downloading, you agree to the terms and conditions of the respective license. If you're looking for the latest VirtualBox 6.0 packages, see Virt

www.virtualbox.org

 

각 사이트에서 윈도우 설치파일을 받아 실행하여 설치한다.

 

2. vagrant box 설치하기

cmd창을 열어 명령어 실행

vagrant box add laravel/homestead

가상머신은 virtualbox를 선택한다.

 

3. git bash 설치하기

https://gitforwindows.org/

 

Git for Windows

Git for Windows focuses on offering a lightweight, native set of tools that bring the full feature set of the Git SCM to Windows while providing appropriate user interfaces for experienced Git users and novices alike. Git BASH Git for Windows provides a BA

gitforwindows.org

 

4. 홈스테드 설치

 "home" 디렉토리안에 Homestead 폴더로 저장소를 복제

git clone https://github.com/laravel/homestead.git ~/Homestead

5. Homestead.yaml 파일 설정하기

folders :    
	- map : 로컬의 라라벨 프로젝트 디렉토리 경로      
	  to : 홈스테드의 경로
      
sites :      
	- map : 사용할 도메인명       
	  to : 홈스테드 경로/public
      

databases :     
	- 사용할 데이터베이스 이름 입력 

 

만약 홈스테드 실행중 해당 파일을 수정했다면 아래의 명령어로 vagrant의 변경 설정파일로 재부팅 해야된다.

varant reload --provision

위의 파일에서 들여쓰기를 지키지 않으면 명령어 실행시 에러난다.

 

 

6. ssh 키쌍 생성

git bash 로 명령어 실행. 이메일 계정 입력

ssh-keygen -t rsa -C "email@homestead.com"

원래는 비밀번호 다쳐야 되는데 그냥 연습용이니까. 엔터치며 넘어간다.

7. Host 설정하기

host파일의 위치는 C:\Windows\System32\drivers\etc\hosts에있다.

메모장이나 에디트플러스를 관리자권한으로 실행시켜 해당 경로에 있는 host를 연다.

알약같은 보안 프로그램이 실행중이라면 종료한후 실행해야된다.

192.168.10.10           homestead.test

 

8. Homestead 시작

vagrant up

 

9. git bash로 ssh 들어가기

vagrant ssh

 

 

10.  laravel 프로젝트 설치 

실제 로컬 폴더 C:/workspace/home/code 디렉토리까지 생성되어 있어야함.

다시 ssh로 돌아와서 yaml 설정파일에 입력된 경로로 이동.

위에서는 /home/vagrant/code 로 설정 했기 때문에 code 디렉토리로 이동하여 

laravel new

설치가 성공적으로 끝나면 아래와 같은 구조가 생성된다.

다른 이름의 프로젝트를 생성하고 싶다면 아래와 같이 이름을 붙여 라라벨을 설치 해주면 된다.

laravel new code

 

compoer 설치

composer install

npm 설치

npm install

npm 실행

npm run dev

 

11. 최종 확인.

Homestead.yaml 파일에서 지정했던 사이트 도메인을 주소창에 치면 아래와 같은 화면이 나와야 정상

간단하게 테스트를 해보자.

위의 페이지는 welcome.blade.php 이다.

해당 파일은 blade들이 모여있는 디렉토리인 resource/views에 있다.

이 페이지에서 저 Laravel이란 텍스트만 약간 수정해보자.

성공적 설치.

 

 

 

 * 윈도우에서 --no-bin-links 없이 npm설치하는 방법

1) Window키 + R

2) secpol.msc 입력 후 학인 클릭

 

3) 로컬 보안 정책 창에서

로컬 정책 -> 사용자 권한 할당 -> 심볼 링크 만들기 더블클릭

4) 심볼 링크 만들기 속성 팝업창이 뜨면 

'사용자 또는 그룹 추가' 버튼을 클릭한다.

5) 선택할 개체 이름을 입력하십시오. 영역에 자신의 컴퓨터 이름을 쓰고 이름 확인 버튼을 누른다.

 

6) 확인을 누르면 앞의 속성창으로 넘어가게 되는데

본인이 추가한 컴퓨터 이름이 추가되어있다. 

적용 버튼 누르면 끝.

이렇게 설정하면 npm설치 할 때나 실행할 때 --no-bin-links를 쓰지 않아도 된다.

반응형

댓글