WSL/Ubuntu에 작업 환경 설정하기

  • C++ 개발환경 설정하기
apt update
apt upgrade
apt install build-essential gdb
// 설치 및 버전 확인
g++ --version
  • Windows Directory mount 하기
# windows folder를 mount 할 로컬 경로 생성
mkdir /<localdir>
# 그룹을 만들고 사용자 id 추가
sudo groupadd <localGroup>
sudo usermod -aG <localGroup> <userid>
sudo chown -R :<localGroup> /<localDir>
# fstab 에 mount 설정 추가
cat /etc/fstab
LABEL=cloudimg-rootfs / ext4 defaults 0 0
/mnt/c/_Work/<WindowWorkingFolder> /<localDir> auto nosuid,nodev,nofail,bind 0 0
# 자동으로 마운트 되도록 설정 'mount -a' 를 추가 함. root user에 설정. 일반 사용자의 .bashrc 에 설정하는 경우 'sudo mount -a' 사용
vi .bashrc
mount -a
  • 디렉토리 이동을 위한 alias 설정하기
alias cds  ='cd /DirectoryPath1'
alias cdn  ='cd /DirectoryPath2'
alias cdsn ='cd /DirectoryPath3'
alias cdm  ='cd /DirectoryPath4'
alias cdl  ='cd /DirectoryPath5'
alias cdio ='cd /DirectoryPath6'
alias cdb  ='cd /DirectoryPath7'
alias cdns ='cd /DirectoryPath8'
alias cdsvc='cd /DirectoryPath9'
alias cdtr ='cd /DirectoryPath10'
alias cdc  ='cd /DirectoryPath11'
alias psg  ='ps -ef | grep '
  • Python 설치하기
apt install python3.8 python3-dev
  • WSL에 설치된 ubuntu Restart 하기
    • 윈도우에서 관리자 모드로 PowerShell을 실행한다.
    • Restart-Service LxssManager 을 실행한다.
  • 윈도우에 VScode 설치하기
    https://code.visualstudio.com/ 에서 다운로드
  • ubuntu에서 vscode 설정하기
    ubuntu의 임의 폴더에서 code . 실행하여 vscode 를 실행한다.
    “Remote WSL” extention 을 설치한다.
  • WSL uninstall
    wslconfig /u Ubuntu-20.04
  • .profile 설정
PATH=".:$PATH"
LD_LIBRARY_PATH=/ois/Lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

Posted in 리눅스 | Leave a comment

윈도우즈 10 에서 간단하게 WSL 을 설치하는 방법이다.

  • 관리자 모드로 PowerShell 을 실행한다.
    다음과 같이 명령어를 입력한다.
    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
  • WSL 2 로 업데이트
    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
    설치한 내용이 적용되도록 윈도우를 재기동 합니다.
    재기동 후 다시 관리자 모드로 PowerShell 을 실행합니다.
  • WSL 2 를 기본으로 설정
    PowerShell 에서 wsl --set-default-version 2 을 입력합니다.
  • Ubuntu 설치하기
    아래 링크를 클릭하여 Linux 제품을 구매하는 윈도우 스토어를 엽니다.
    https://aka.ms/wslstore
    1. Ubuntu 를 선택하고 구매 및 설치합니다.
  • 설치가 완료되면 아래와 같이 최초 사용자를 등록하는 화면이 나옵니다.

최초 사용자를 입력하고 사용할 비밀번호를 설정하면 우분투의 설치가 완료됩니다.

Posted on by kimyc | Leave a comment