ویندوز سابسیستم برای لینوکس (WSL): ابزارها و شیوههای قدرتمند برای توسعه و همکاری چندسکویی
Pro Windows Subsystem for Linux (WSL) : Powerful Tools and Practices for Cross-Platform Development and Collaboration
معرفی کتاب «ویندوز سابسیستم برای لینوکس (WSL): ابزارها و شیوههای قدرتمند برای توسعه و همکاری چندسکویی» (با عنوان لاتین Pro Windows Subsystem for Linux (WSL) : Powerful Tools and Practices for Cross-Platform Development and Collaboration) نوشتهٔ Hayden Barnes، منتشرشده توسط نشر Apress : Imprint: Apress در سال 2021. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است. «ویندوز سابسیستم برای لینوکس (WSL): ابزارها و شیوههای قدرتمند برای توسعه و همکاری چندسکویی» در دستهٔ برنامهنویسی قرار دارد.
This book covers everything a developer needs to know to hit the ground running and get the most out of Windows Subsystem for Linux (WSL).What You Will Learn:• Install and configure WSL, a unique and novel configuration process• Receive an unbiased overview of WSL, its architecture, installation, the command line, practical use cases, and advanced configuration• Create a development workstation using WSL• Compare and contrast the differences between WSL 1 and WSL 2• Explore, in depth, some of the more popular workflows in WSL, including Docker containers• Consider and plan key factors for a large scale enterprise deployment of WSL Table of Contents 5 About the Author 13 About the Technical Reviewer 14 Acknowledgments 15 Introduction 16 Chapter 1: WSL Architecture 21 WSL 1 vs. WSL 2 21 Kernel Drivers 21 Pico Processes 22 LxssManager 22 Syscall Translation in WSL 1 23 WSL 2 25 Hyper-V 26 Virtual Machine Platform 26 WSL 2 Kernel 27 WSL 1 vs. WSL 2 29 Availability 29 Why You Would Choose WSL 1 29 Why You Would Choose WSL 2 30 The Future of WSL 30 GPU Compute 30 /dev/dxgkrnl 31 Direct3D 12 32 DirectML 32 OpenGL and OpenCL 32 Nvidia CUDA 33 Libraries 34 GUI Support 34 Chapter 2: Enabling WSL 37 In Programs and Features 37 Using PowerShell 39 Using DISM 40 Using wsl.exe --install 41 Installing a Distribution with wsl.exe –install 42 Using DISM to Enable WSL in Images 43 In Hyper-V Guests 43 Installing a Linux Distribution on WSL 44 Choice of Distribution 44 Consideration: WSL Version When Installing 45 Install from the Microsoft Store 46 Sideload an .appx File in Developer Mode 47 Import a Tarball Using wsl.exe --import 49 WSL Installation Mechanics 55 Installation Location 55 WSL Tooling 57 WSL API in Windows 10 60 Chapter 3: Managing WSL Distros 63 Listing All Distros 63 Listing Running Distros 64 Running a Default Distro 64 Setting a Default Distro 65 Running a Specific Distro 66 Running as a Specific User 68 Executing Single Commands 69 Shutdown 71 Terminate 72 Converting Distros Between WSL Versions 73 Export/Backup Distro 73 Import/Restore Distro 74 Duplicate Distros 76 Resetting Distros 77 Open WSL Distro “App” Settings 77 Advanced Options in WSL Distro “App” Settings 79 Considerations: Resetting WSL Distro 80 Uninstall Distros from the Microsoft Store 81 From the Windows Start Menu 81 From Advanced Options in WSL Distro “App” Settings 82 Using PowerShell 83 Uninstall Distros Installed Using wsl.exe --import 84 WSL 2 Kernel Management 85 Checking for Available Updates 86 Checking Kernel Update Status 88 Rolling Back Kernel Updates 88 Mounting External Volumes 89 Unmounting from Windows 89 Chapter 4: Linux Distro Maintenance 93 Packages 93 Dependencies 94 Completing Administrative Tasks with sudo 95 Update Packages 95 Upgrade Packages 96 Installing Packages 98 Uninstalling Packages 99 Abandoned Dependencies 100 Finding Packages 101 From the Terminal 101 Using a Terminal User Interface (TUI) 103 Using a Graphical User Interface (GUI) 104 Build Your Own Ubuntu WSL Image 107 Install an Image Bootstrapping Tool 108 Build Our Base Image 108 Customize Base Installation 110 Create rootfs tar 115 Import into WSL 117 Chapter 5: Configuring WSL Distros 121 Setting Per-Distro Settings 121 Automount Settings 122 Enabling 122 Root 122 File System Tab 123 Mount Options 124 Metadata 124 Case Sensitivity 125 Changing the UID and GID of a Mount 128 Background on Linux File Permissions 130 Symbolic Form 130 Checking a File’s Permissions 131 Numeric Form 132 File Mask 133 Changing umask and fmask of a Mount 134 Cross-Distro Mounting 134 ldconfig 135 Network 137 Generate Hosts File 137 Generate DNS File 139 Hostname 140 Interoperability 141 Enabling 141 Appending Windows Path 142 WSLENV 143 WSLENV Flags 146 Default User 147 Boot 147 Chapter 6: Configuring WSL 2 148 .wslconfig 148 Kernel 148 Kernel Command Line 149 Processors 150 Memory 152 Swap 153 Swap File 154 Page Reporting 154 Localhost Forwarding 155 Nested Virtualization 156 Debug Console 157 Tips 158 WSL Registry Settings 160 Chapter 7: Customizing WSL 162 Using Graphical Applications with X 162 Install an X Server on Windows 162 Configure WSL to Forward X to Your Windows X Server 164 WSL 2, GUI Apps, and Windows Firewall 165 Install a GUI Application 172 Debugging GUI Applications 173 dbus 174 Rolling Your Own init System 174 .bashrc 175 Windows Services 178 Windows Task Scheduler 184 Boot Command 195 Chapter 8: Going Further with WSL 2 196 Running systemd 196 A Simple Approach to systemd 197 Building Your Own Kernel for WSL 2 198 Installing a Guest Operating System on KVM on WSL 215 WSL 2 Advanced Networking 219 Chapter 9: Maximizing Windows Interoperability 228 wslpath 228 wslutilities 229 Redirecting Between Windows and Linux Applications 233 Piping 234 Piping Between Windows and WSL 235 Piping from WSL to Windows 235 Piping from Windows to WSL 238 File Redirection 240 Heredocs 240 Environmental Variables 242 Mount File Systems in WSL 2 244 Windows File Shares 245 SSHFS and Other FUSE-Based File Systems 246 Native Linux File Systems in a Disk Image or “Partition” 247 In a Partition 248 In a Disk Image (VHDX File) 248 Mounting Options 249 Chapter 10: Using WSL for Enterprise Development 251 Creating a Microk8s Workstation 251 Prerequisites for Microk8s 251 Installing Microk8s 253 Enabling Microk8s Add-Ons 253 Deploy a Cluster with Helm 255 Using Docker Desktop 256 Installing Docker Desktop on WSL 256 Building Docker Container 258 Connecting to Editors/IDEs 260 Visual Studio 260 Installing in Visual Studio Version 16.8 and Earlier 260 Installing in Visual Studio Version 16.9 and Later 261 Debugging Your App in WSL 262 Visual Studio Code 264 JetBrains IDEs 267 Utilizing GPU Compute Pass-Through 270 NVIDIA CUDA 270 DirectML for Non-NVIDIA GPUs 274 Chapter 11: Troubleshooting WSL 275 Installation 275 Ensure the Windows Optional Features Are Enabled 275 Check Your Security Application 278 Get the Latest Distro from the Windows Store 278 Virtualization 279 Linux Component Dependencies 279 systemd 280 dbus 280 Kernel Modules 282 Linux Applications 282 Using “strace” on WSL 1 283 Chapter 12: Deploying WSL at Scale 285 Considerations for Deploying 285 Using Intune to Deploy Ubuntu on WSL 286 Using Landscape to Manage Ubuntu on WSL 286 Enroll Ubuntu WSL into a Landscape Server 286 Executing a Script on the WSL Instance with Landscape 290 Managing Packages of the WSL Instance with Landscape 292 Using Ansible to Manage Ubuntu on WSL 296 Index 298 "This book covers everything a developer needs to know to hit the ground running and get the most out of Windows Subsystem for Linux (WSL). Since its release, Windows Subsystem for Linux (WSL) has been growing in popularity, moving from curious early adopters to wide-scale interest, including enterprise development teams using WSL in production. This authoritative guide to WSL covers the gamut, introducing developers to WSL architecture, installation and configuration, the WSL command line, all the way to advanced use cases and performance tunings. Practical examples are sprinkled throughout to reinforce understanding. This book is designed to efficiently and effectively get developers comfortable using this highly useful platform for open-source development on Windows. WSL is uniquely suited to cloud and cross-platform development, and system administrator workflows on Windows. Windows developers will begin with the basics of installation and then be introduced to the vast library of open source tools that they can integrate into their own workflows, using their existing development tools, such as Code, Visual Studio, and JetBrains IDEs. Readers will learn, hands on, about using WSL to develop cross-platform and cloud-native applications, work with containers, and deploy a local Kubernetes cluster on WSL. Much of what WSL is, is what developers make of it is expert Barnes' guiding mantra, a theme that is reinforced throughout this valuable cross-platform learning journey. Developers will get excited about the many new opportunities at their fingertips and be astounded at what they can do and achieve with WSL. What You Will Learn: Install and configure WSL, a unique and novel configuration process Receive an unbiased overview of WSL, its architecture, installation, the command line, practical use cases, and advanced configuration Create a development workstation using WSL Compare and contrast the differences between WSL 1 and WSL 2 Explore, in depth, some of the more popular workflows in WSL, including Docker containers Consider and plan key factors for a large scale enterprise deployment of WSL This book is for developers who need to know WSL and how to build a development stack, integrating it with their preferred code editor or IDE if they so choose. Existing Windows and Linux system administrators will learn how to install, deploy, and manage WSL. Power users who are comfortable in a command line, but may be new to Linux or WSL, will also find this book useful. Hayden Barnes is Engineering Manager for Ubuntu on Windows Subsystem for Linux (WSL) at Canonical, and a recognized Microsoft MVP. Hayden regularly presents on the topic of WSL at conferences such as Microsoft Build and is the founder of WSLConf. He has consulted for enterprises, academic institutions, and government agencies to help them deploy WSL. Before joining Canonical, Hayden founded Pengwin, the first company to create a custom Linux distribution built specifically for Windows. He is passionate about WSL because it opens up a myriad of opportunities for cross-platform development, open source development, and collaboration between Linux and other communities"--Page [4] of cover This book covers everything a developer needs to know to hit the ground running and get the most out of Windows Subsystem for Linux (WSL). Since its release, Windows Subsystem for Linux (WSL) has been growing in popularity, moving from curious early adopters to wide-scale interest, including enterprise development teams using WSL in production. This authoritative guide to WSL covers the gamut, introducing developers to WSL architecture, installation and configuration, the WSL command line, all the way to advanced use cases and performance tunings. Practical examples are sprinkled throughout to reinforce understanding. This book is designed to efficiently and effectively get developers comfortable using this highly useful platform for open-source development on Windows. WSL is uniquely suited to cloud and cross-platform development, and system administrator workflows on Windows. Windows developers will begin with the basics of installation and then be introduced to the vast library of open source tools that they can integrate into their own workflows, using their existing development tools, such as Code, Visual Studio, and JetBrains IDEs. Readers will learn, hands on, about using WSL to develop cross-platform and cloud-native applications, work with containers, and deploy a local Kubernetes cluster on WSL. "Much of what WSL is, is what developers make of it" is expert Barnes' guiding mantra, a theme that is reinforced throughout this valuable cross-platform learning journey. Developers will get excited about the many new opportunities at their fingertips and be astounded at what they can do and achieve with WSL. What You Will Learn Install and configure WSL, a unique and novel configuration process Receive an unbiased overview of WSL, its architecture, installation, the command line, practical use cases, and advanced configuration Create a development workstation using WSL Compare and contrast the differences between WSL 1 and WSL 2 Explore, in depth, some of the more popular workflows in WSL, including Docker containers Consider and plan key factors for a large scale enterprise deployment of WSL Who This Book Is For Developers who need to know WSL and how to build a development stack, integrating it with their preferred code editor or IDE if they so choose; existing Windows and Linux system administrators who want to learn how to install, deploy, and manage WSL; power users who are comfortable in a command line, but may be new to Linux or WSL
دانلود کتاب ویندوز سابسیستم برای لینوکس (WSL): ابزارها و شیوههای قدرتمند برای توسعه و همکاری چندسکویی