====== Windows Subsystem For Linux ====== * [[https://docs.microsoft.com/ko-kr/windows/wsl/about|Learn about the Windows Subsystem for Linux | Microsoft Docs]] * Windows 10 이상에서 Ubuntu 등의 리눅스를 Native 처럼 깔아서 사용 가능하다. * [[https://docs.microsoft.com/ko-kr/windows/wsl/wsl2-install|WSL 2 install]] * https://github.com/microsoft/WSL * [[https://www.howtogeek.com/261383/how-to-access-your-ubuntu-bash-files-in-windows-and-your-windows-system-drive-in-bash/|How to Access Your Ubuntu Bash Files in Windows (and Your Windows System Drive in Bash)]] * [[https://gist.github.com/wsargent/072319c2100ac0aea4305d6f6eeacc08|Windows Development Environment for Scala]] * [[https://github.com/goreliu/wsl-terminal|goreliu/wsl-terminal: Terminal emulator for Windows Subsystem for Linux (WSL)]] * [[https://blog.ropnop.com/configuring-a-pretty-and-usable-terminal-emulator-for-wsl/|Configuring a pretty and usable terminal emulator for WSL]] * [[https://docs.microsoft.com/ko-kr/windows/wsl/install-win10|Windows 10에 WSL(Linux용 Windows 하위 시스템) 2 설치 | Microsoft Docs]] * [[https://wslhub.com/|W$L/hub>_]] * [[https://devblogs.microsoft.com/commandline/a-preview-of-wsl-in-the-microsoft-store-is-now-available/|A preview of WSL in the Microsoft Store is now available! - Windows Command Line]] ===== 원하는 배포판 설치 ===== * [[windows:wsl:wsldl|windows:wsl:wsldl]] * [[https://docs.microsoft.com/en-us/windows/wsl/use-custom-distro#use-a-custom-linux-distribution|Import any Linux distribution to use with WSL | Microsoft Docs]] * Windows Store 에 없더라도 원하는 배포판을 설치할 수 있다. * [[https://docs.rockylinux.org/guides/interoperability/import_rocky_to_wsl_howto/|Import to WSL2 with Docker - Documentation]] * [[https://docs.rockylinux.org/guides/interoperability/rocky_to_wsl_howto/|Import To WSL with WSL and rinse - Documentation]] ===== 설치 ===== * https://docs.microsoft.com/ko-kr/windows/wsl/install-win10 참조 \ * Unicode Locale 지정 sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 ===== Upgrade ===== * 16.04 -> 18.04 업그레이드가 가능하다. [[https://superuser.com/questions/1317619/can-i-upgrade-my-existing-ubuntu-installation-in-wsl-from-16-04-to-18-04|windows subsystem for linux - Can I upgrade my existing Ubuntu installation in WSL from 16.04 to 18.04? - Super User]] * [[https://blogs.msdn.microsoft.com/commandline/2018/07/09/upgrading-ubuntu/|A Guide to Upgrading your Ubuntu App’s Release – Windows Command Line Tools For Developers]] # 기본적으로는 아래 명령만으로 가능. sudo do-release-upgrade -d lsb_release -a # 버전 검사 ===== 성능 ===== * 성능이 매우 떨어진다. * [[https://medium.com/@leandrw/speeding-up-wsl-i-o-up-than-5x-fast-saving-a-lot-of-battery-life-cpu-usage-c3537dd03c74|Speeding up WSL I/O up than 5x fast + saving a lot of battery life & CPU usage]] * 바이러스 백신 혹은 Windows Defender 의 실시간 감시를 끄고, ''%USERPROFILE%\AppData\Local\Packages'' 폴더에서 '' CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc'' 처럼 생긴 폴더를 제외 처리해주면 약간 빨라진다. * 위 외에도 ''Ahnlab Safe Transaction'', ''nProtect'' 등의 강제로 설치되는 보안툴 때문일 수도 있다. * 그래도 느린 느낌이라 결국 ''oh-my-bash'' 같은 것은 사용하지 않고 기본 [[:git|git]] Git + Color prompt 를 사용하고 있음. ===== .bashrc, .bash_profile ===== * ''.bash_profile''을 만들것이라면, 무조건 아래 항목이 있어야 ''.bashrc''를 로딩한다. if [[ -f ~/.bashrc ]] ; then . ~/.bashrc fi ===== Console ===== * [[https://github.com/rprichard/wslbridge|wslbridge]] linux bash 콘솔을 Windows 콘솔과 통합해주는 중계자. * [[https://conemu.github.io/en/BashOnWindows.html|ConEmu | Bash on Ubuntu on Windows in ConEmu (WSL)]] [[windows:console:conemu|ConEmu Windows Terminal Emulator]] 사용하기 * [[https://conemu.github.io/en/BashOnWindows.html|ConEmu | Bash on Ubuntu on Windows in ConEmu (WSL)]] WSL Linux bash의 콘솔 접근방법이 Windows 표준과 달라서 ''wslbridge'' 등의 중계 방식이 필요하다. * conemu, wslterminal 등에서는 WSL Bash CPU 점유율이 폭증하는 현상이 있으나 cmder 에서는 정상 작동했음. -> WSL 최신버전 업그레이드하면 conemu 등에서도 문제 없다고 함. ===== ssh-agent 대체 ===== * [[windows:wsl:weasel_pageant|Weasel Pageant - WSL Linux ssh-ageant to putty pageant]] ===== Maven/Gradle 등 ===== * 아래 하지 말 것. File Lock 문제로 실제로 사용하기 힘듬. * wsl 설치 후 [[java:maven:settings|Maven 설정]] ''settings.xml'' * [[:gradle|Gradle]]의 사용자 디렉토리(''GRADLE_USER_HOME'') Windows와 맞춰준다. ===== 상호 실행 ===== * Windows 에서 linux 명령실행, Linux에서 Windows 명령 실행이 가능하다. * [[https://docs.microsoft.com/en-us/windows/wsl/interop|Windows interoperability with Linux | Microsoft Docs]] C:\> wsl ls -lah ===== 주의 ===== * **Windows 를 최신 버전으로 업데이트 할 것!** * [[:gradle|Gradle]] 실행 안되는 문제 * bash.exe CPU 점유율 100% 문제 등이 초기 버전에서 발생함. 최신 업데이트하면 괜찮아짐. * [[https://blogs.msdn.microsoft.com/commandline/2016/11/17/do-not-change-linux-files-using-windows-apps-and-tools/|Do not change Linux files using Windows apps and tools – Windows Command Line Tools For Developers]] * Windows 애플리케이션에서 WSL의 파일을 생성/수정/삭제하지 말 것. * 양쪽에서 함께 사용할 파일은 Windows 쪽에 생성해야 한다. * [[https://blogs.msdn.microsoft.com/commandline/2017/04/11/windows-10-creators-update-whats-new-in-bashwsl-windows-console/|Windows 10 Creators Update: What’s new in Bash/WSL & Windows Console – Windows Command Line Tools For Developers]] ===== 참조 ===== * [[https://www.howtogeek.com/fyi/windows-10-will-finally-offer-easy-access-to-linux-files/|Windows 10 Will Finally Offer Easy Access to Linux Files]] * [[https://cepa.io/2018/02/10/linuxizing-your-windows-pc-part1/|WSL1 기준 Linux'izing your Windows PC into a dev machine – Part 1 | cepa.io]] * [[https://cepa.io/2018/02/20/linuxizing-your-windows-pc-part2/|WSL1 기준 Linux'izing your Windows PC into a dev machine – Part 2 | cepa.io]] * [[https://www.omgubuntu.co.uk/how-to-install-wsl2-on-windows-10|How to Install WSL 2 on Windows 10 (Updated) - OMG! Ubuntu!]]