윈도우 개발 환경 설정

junyojeo·2024년 3월 26일

따로 설명 없는 건, 그냥 치면 설치 됩니다.

윈도우 터미널

[우분투 22.04 버전 설치, wsl 2 버전 사용]

wsl --install

(VSCode 설치 후, 터미널의 default profile을 'ubuntu-22.04 (WSL)'로 변경)

+++

sudo apt install tk-dev

스크립트 한 묶음

sudo apt update -y && sudo apt upgrade -y
sudo apt install build-essential

sudo apt install -y zsh

sudo apt-get -y install git
sudo apt install gcc

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

brew 설치

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

echo 'export PATH=$HOME/.brew/bin:$PATH' >> $HOME/.zshrc && source $HOME/.zshrc && brew update

echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> $HOME/.zshrc && source $HOME/.zshrc

brew 설치 안되면 아래것으로.

rm -rf $HOME/.brew && git clone --depth=1 https://github.com/Homebrew/brew $HOME/.brew && echo 'export PATH=$HOME/.brew/bin:$PATH' >> $HOME/.zshrc && source $HOME/.zshrc && brew update

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

brew로는 하나씩 설치하셔야 합니다.

brew install python-build
brew install pyenv
pyenv install 3.12.5
pyenv global 3.12.5
brew install node
brew install nvm
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
mkdir -p ~/.vim/colors
cd ~/.vim/colors
curl -O https://raw.githubusercontent.com/nanotech/jellybeans.vim/master/colors/jellybeans.vim

echo -e "set hlsearch \"검색어 하이라이팅\nset nu \"줄번호\nset autoindent \"자동 들여쓰기\nset scrolloff=2\nset wildmode=longest,list\nset ts=4 \"tab 크기\nset sts=4 \"st select\nset sw=1 \"스크롤바 너비\nset autowrite \"다른 파일로 넘어갈 때 자동 저장\nset autoread \"작업 중인 파일 외부에서 변경됬을 경우 자동으로 불러옴\nset cindent \"C언어 자동 들여쓰기\nset bs=eol,start,indent\nset history=256\nset laststatus=2 \"상태바 표시 항상\nset paste \"붙여넣기 계단현상 없애기\nset shiftwidth=4 \"자동 들여쓰기 너비 설정\nset showmatch \"일치하는 괄호 하이라이팅\nset smartcase \"검색시 대소문자 구별\nset smarttab\nset smartindent\nset softtabstop=4\nset tabstop=4\nset ruler \"현재 커서 위치 표시\nset incsearch\nset statusline=\\ %<%l:%v\\ [%P]%=%a\\ %h%m%r\\ %F\\\n\"마지막으로 수정된 곳에 커서를 위치함\nau BufReadPost *\n\\ if line(\"'\\\"\") > 0 && line(\"'\\\"\") <= line(\"\$\") |\n\\ exe \"norm g\`\\\"\" |\n\\ endif\n\"파일 인코딩을 한국어로\nif \$LANG[0]=='k' && \$LANG[1]=='o'\nset fileencoding=korea\nendif\n\"구문 강조 사용\nif has(\"syntax\")\n syntax on\nendif\n\"컬러 스킴 사용\ncolorscheme jellybeans" >> ~/.vimrc
git config --global alias.cmp '!f() { git add -A && git commit -m "$@" && git push; }; f'

git config --global core.editor vim
git config --global user.name "이름"
git config --global user.email "이메일"

깃 코드 컨벤션


또는 MSYS2에서 사용할 스크립트 한 묶음

# 기본 패키지 설치
pacman -Syu --noconfirm
pacman -S --noconfirm base-devel mingw-w64-ucrt-x86_64-toolchain
pacman -S --noconfirm zsh
pacman -S --noconfirm git
pacman -S --noconfirm vim
pacman -S --noconfirm gcc

# Oh My Zsh 설치
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended

# zsh 플러그인 설치
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

# powerlevel10k 테마 설치
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

# vim 설정
mkdir -p ~/.vim/colors
cd ~/.vim/colors
curl -O https://raw.githubusercontent.com/nanotech/jellybeans.vim/master/colors/jellybeans.vim

# vim 설정 파일 생성
echo -e "set hlsearch \"검색어 하이라이팅\nset nu \"줄번호\nset autoindent \"자동 들여쓰기\nset scrolloff=2\nset wildmode=longest,list\nset ts=4 \"tab 크기\nset sts=4 \"st select\nset sw=1 \"스크롤바 너비\nset autowrite \"다른 파일로 넘어갈 때 자동 저장\nset autoread \"작업 중인 파일 외부에서 변경됬을 경우 자동으로 불러옴\nset cindent \"C언어 자동 들여쓰기\nset bs=eol,start,indent\nset history=256\nset laststatus=2 \"상태바 표시 항상\nset paste \"붙여넣기 계단현상 없애기\nset shiftwidth=4 \"자동 들여쓰기 너비 설정\nset showmatch \"일치하는 괄호 하이라이팅\nset smartcase \"검색시 대소문자 구별\nset smarttab\nset smartindent\nset softtabstop=4\nset tabstop=4\nset ruler \"현재 커서 위치 표시\nset incsearch\nset statusline=\\ %<%l:%v\\ [%P]%=%a\\ %h%m%r\\ %F\\\n\"마지막으로 수정된 곳에 커서를 위치함\nau BufReadPost *\n\\ if line(\"'\\\"\") > 0 && line(\"'\\\"\") <= line(\"\$\") |\n\\ exe \"norm g\`\\\"\" |\n\\ endif\n\"파일 인코딩을 한국어로\nif \$LANG[0]=='k' && \$LANG[1]=='o'\nset fileencoding=korea\nendif\n\"구문 강조 사용\nif has(\"syntax\")\n syntax on\nendif\n\"컬러 스킴 사용\ncolorscheme jellybeans" >> ~/.vimrc

# git 설정
git config --global alias.cmp '!f() { git add -A && git commit -m "$@" && git push; }; f'
git config --global core.editor vim

zsh

sudo apt install zsh

oh-my-zsh

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

(~/.zshrc 복붙으로 대부분 스킵)

Github Settings 레포

터미널 플러그인

//하이라이팅
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

//자동완성
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

~/.zshrc에서 plugin 찾아서

plugins=(git zsh-autosuggestions zsh-syntax-highlighting)

이걸로 교체 해주기.

brew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

echo 'export PATH=$HOME/.brew/bin:$PATH' >> $HOME/.zshrc && source $HOME/.zshrc && brew update

echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> $HOME/.zshrc && source $HOME/.zshrc

powerlevel10k

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

이거 후
~./zshrc에서 ZSH_THEME= 찾아서 교체 해주기.

ZSH_THEME="powerlevel10k/powerlevel10k"

또는 brew로 설치

brew install powerlevel10k
echo "source $(brew --prefix)/share/powerlevel10k/powerlevel10k.zsh-theme" >>~/.zshrc
source ~/.zshrc
vim ~/.p10k.zsh 
# 중복되는 디렉토리명 줄임
typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique
# 마지막 디렉토리명 줄임
typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_last
# 디렉토리명을 얼마나 줄일지 설정
typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=1    # 각 디렉토리를 1글자로
# 또는
typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=2    # 각 디렉토리를 2글자로

MesloLGS LF 폰트

https://github.com/romkatv/dotfiles-public/tree/master/.local/share/fonts/NerdFonts

https://github.com/romkatv/powerlevel10k?tab=readme-ov-file#fonts


우측에 다운로드 아이콘 클릭 후 더블클릭 실행

터미널 색상

echo LS_COLORS="ow=01;36;40" && export LS_COLORS >> ~/.zshrc

python (pyenv[파이썬 버전 관리자])

brew install pyenv
sudo apt-get update && sudo apt-get upgrade
pyenv install 3.12.1

이거 친 후

pyenv global 3.12.1

이거

[사용법]

//가상환경(임시 폴더 안에 환경 다 때려넣는거. [./env -> 폴더 이름]) 만들기
python -m venv ./env

//지우기
ignore [경로]

//가상환경 사용
source env/bin/activated
echo alias python=python3 >> ~/.zshrc

nodejs

brew install node

git

sudo apt-get install git
git config --global user.name "이름"
git config --global user.email "이메일"

github CLI

brew install gh
gh auth login

nvm

brew install nvm
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

VSCode 플러그인

-ESLint(JS)
-prettier(코드 스타일)
-Dracula Official(즐겨 쓰는 테마. 맘에 드는거 쓰면 됨)

아래는 기록용
-Docker
-GitHub Copilot
-Korean Language Pack for Visual Studio Code
-Better C++ Syntax
-gitignore
-Material Icon Theme
-TabOut

-CodeLLDB
-Code Runner

-Output Colorizer
-Log File Highlighter

[선택]ppa 패키저장소

sudo add-apt-repository ppa:deadsnakes/ppa

잡다

-git add commit push 한번에 하는 alias.

git config --global alias.cmp '!f() { git add -A && git commit -m "$@" && git push; }; f'

-git 토큰 매번 입력 없애기(.git 있는 폴더마다) 따로 적용

git config --unset credential.helpe
git config credential.helper store

-code [경로] 명령어 설정

code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $ ;} >> ~/.zshrc

-vim 설정
https://hcnam.tistory.com/14 이거.

  1. 다운로드
mkdir -p ~/.vim/colors
cd ~/.vim/colors
curl -O https://raw.githubusercontent.com/nanotech/jellybeans.vim/master/colors/jellybeans.vim
  1. 한 커맨드 라인에 복붙
echo -e "set hlsearch \"검색어 하이라이팅\nset nu \"줄번호\nset autoindent \"자동 들여쓰기\nset scrolloff=2\nset wildmode=longest,list\nset ts=4 \"tab 크기\nset sts=4 \"st select\nset sw=1 \"스크롤바 너비\nset autowrite \"다른 파일로 넘어갈 때 자동 저장\nset autoread \"작업 중인 파일 외부에서 변경됬을 경우 자동으로 불러옴\nset cindent \"C언어 자동 들여쓰기\nset bs=eol,start,indent\nset history=256\nset laststatus=2 \"상태바 표시 항상\nset paste \"붙여넣기 계단현상 없애기\nset shiftwidth=4 \"자동 들여쓰기 너비 설정\nset showmatch \"일치하는 괄호 하이라이팅\nset smartcase \"검색시 대소문자 구별\nset smarttab\nset smartindent\nset softtabstop=4\nset tabstop=4\nset ruler \"현재 커서 위치 표시\nset incsearch\nset statusline=\\ %<%l:%v\\ [%P]%=%a\\ %h%m%r\\ %F\\\n\"마지막으로 수정된 곳에 커서를 위치함\nau BufReadPost *\n\\ if line(\"'\\\"\") > 0 && line(\"'\\\"\") <= line(\"\$\") |\n\\ exe \"norm g\`\\\"\" |\n\\ endif\n\"파일 인코딩을 한국어로\nif \$LANG[0]=='k' && \$LANG[1]=='o'\nset fileencoding=korea\nendif\n\"구문 강조 사용\nif has(\"syntax\")\n syntax on\nendif\n\"컬러 스킴 사용\ncolorscheme jellybeans" >> ~/.vimrc

PostgreSQL

brew install postgresql
brew services start postgresql
brew services list
ps aux | grep postgres

createdb [DB 이름]
psql [DB 이름]

uvicorn app.main:app --reload 

모두 테스트 완료

profile
치킨강정

0개의 댓글