Skip to main content

02. [BackEnd] WSL2 + Go + VSCode + Docker + Make + Sqlc

WSL 설치


  1. 관리자모드로 powershell 실행

  2. wsl 설치

wsl --install
  1. microsoft store에서 windows terminal 설치

  2. reboot

  3. 유저 이름과 비밀번호 생성

make 설치


  1. apt 업데이트
sudo apt update
  1. make 설치
sudo apt install make
  1. 버전 확인
make -version
  1. 실행방법

시작에서 ubuntu 검색해서 실행하면 된다.

Golang 설치


이거로 생략..

but ! linux에서도 golang 설치해야 한다.

  1. golang 설치
sudo snap install go --classic
  1. golang 버전 확인
go version

Sqlc 설치


쿼리문을 Golang CRUD code로 작성해준다.

  1. Sqlc 설치
sudo snap install sqlc

VS Code 설치


  1. VS Code 설치

  2. Extension 설치하기

Extensions에서 wsl,go 검색하고 설치

  1. settings.json에 한 줄 추가
"terminal.integrated.defaultProfile.windows": "Ubuntu (WSL)"

Docker 설치


  1. Docker 다운로드

이곳에서 다운로드

  1. 다운로드 파일 실행하지 말고 powershell 관리자 모드로 실행

  2. 다운로드 폴더로 이동

cd C:\Users\유저\Downloads
  1. 명령어로 설치
Start-Process "Docker Desktop Installer.exe" -Verb RunAs -Wait -ArgumentList "install --installation-dir=C:\Docker\"
  1. 설치 후 reboot

  2. Docker app 실행

  3. 설정에서 Use the WSL 2 based engine 켜져있는지 확인

  4. Add the *.docker.internal names to the host's etc/hosts file (Requires password) 체크하기

  5. 우분투 터미널 켜서 확인하기

docker ps
go version