Installing WSL
Installing WSL
Figure 2-18. Permission model restrictions Updating and Upgrading the Distro Now we know how to install WSL and initialize it for first use, but even though you did a fresh install, itis highly likely that some of the default packages and tools that come with your Linux distribution are a little outdated and new versions of these exist. So, we need a mechanism to update them to the latest versions, because those are most stable and come bug fixes and security improvements. Note For the sake of simplicity to the readers, we are working under an assumption that you are using Ubuntu or Debian Linux distributions, which are two most popular distributions. if you are using any other Linux distributions, then the following commands to update/upgrade may not apply for you. 38CHAPTER 2 DOWNLOADING, INSTALLATION, AND SETUP First things first, before jumping into how to do that, let's first understand the general difference between update and upgrade. An upgrade is the act of replacing the current product with a newer and more superior version of the product, whereas an update modifies your current product. In Linux terms, more specifically to Ubuntu and Debian, “update” means to refresh the list of packages installed, like bumping up the versions and so on without modifying anything else, and “upgrade” means to install any updates to the list of installed packages. Almost all distros are lightweight minimal software packages that can be quickly downloaded and initialized; they have only the necessary tools and libraries shipped with them. Itis a good idea to update and upgrade your distro using the following, command in Listing 2-5; please note that this step may take a while to finish, and you will see packages getting downloaded like in Figure 2-19. Listing 2-5. Updating and upgrading the Windows Subsystem for Linux sudo apt update && sudo apt upgrade Orme rateek:-$ sudo apt update && sudo apt 21 http://eecurity-vbuntscon/sbuntu blonic-security TnRelease [88.7 k8] 1:2 http: /Jarchive-buntu.cos/ubuntu bionic TnRelease 3 hetp://erehive ubuntU.coe/Ubunt Bionic-updates Infeleose [68.7 kB) htt://archive ubuntu-cow/abuntu bionic-beckports TnRelease [74.6 KB) hetp://archive-ubuntu-cow/ubuntu bionic/universe anda Packages [8570 kB) 4:6 http://seeurity-sbunts.con/sbunty bionic-security/main ond6a Packages [448 KO) 17 hetp://security ubuntu, con/ubuntu bionie-security/main Translation-en [136 8) 8 http://security ubuntu.con/ubuntu bionic-security universe and64 Packages (570 kB] 1:9 http: //security bunts con/sbunts bionie-security/universe Translation en [185 KB) fax (8 Packages store 0 8} [5 Packages 1188 K8/8570 kB 14x} [9 Translation-en 35.7 K9/18S kE 20K) Figure 2-19. Update/upgrade WSL distro In Figure 2-19, apt stands for “Advanced Package Tool,’ and apt is a command- line tool which helps in handling packages on Ubuntu, Debian, and related Linux distributions. apt interacts with Ubuntu and Debian packaging systems to find and install new packages and to upgrade or remove packages. But there is a common misconception that apt update installs the new version updates of software packages on Linux, which is not the case. Instead, it updates the database called the apt package index, which keeps a list of available packages from the distro’s software repositories in the '/etc/apt/sources.list file. 39CHAPTER 2 DOWNLOADING, INSTALLATION, AND SETUP For example, if you have Python v3.5 installed then after apt update, the aforementioned database will be aware that a newer version of Python exists, version 3.6, and is available, Now when you run apt upgrade, it will upgrade Python v3.5 to the newer version. But the story doesn't end here, and as a developer, you will stil need other tools and packages in your Linux distribution for various reasons; so now we will look {nto installing additional software on your Windows Subsystem for Linux in the next subsection. Installing Additional Tools and Packages ‘The real purpose of having a Windows Subsystem for Linuxis to enable developers to use their favorite Linux tools in Windows to enhance their overall development experience. Just like any flavor of the Linux operating system, on the Windows Subsystem for Linux, most of these Linux utilities, tools, and packages can be easily installed using a package ‘manager like apt which is a collection of tools to manage packages. In the following, ‘example, we are installing nodejs, git, and nmap on our Linux distribution using the apt instal] command sudo apt install nodejs git nmap APTis a collection of tools like apt, apt-get, and apt-cache which brings a little more to the table, like the ability to search for packages using the apt-cache search by specifying a search keyword, and it can even check the detailed information of the package like Architecture, Size, MD5 checksum, and so on using the apt-cacke show command as demonstrated in Figure 2 apt-cache search aws-cli apt-cache show python3-botocore 40CHAPTER 2 DOWNLOADING, INSTALLATION, AND SETUP @praesorninipa — prateek@Thinkpad:~$ prateeksThinkpad:~$ apt-cache search aws-cli Python-botocore - Low-level, data-driven core of boto 3 (Python 2) python3-botocore - Low-level, data-driven core of boto 3 (Python 3) prateek@Thinkpad:~$ prateekThinkpad:~$ apt-cache show python3-botocore Package: python3-botocore Architecture: all Version: 1.8.48¢repack-1 Priority: optional Section: universe/python Source: python-botocore Origin: Ubuntu Maintainer: Ubuntu DevelopersOriginal-Maintainer: Debian Python Modules Team = 3 Filenane: pool/universe/p/python-botocore/python3-botocor Size: 1764396 MDSsun: ce61c81a93e4197be@dcFo3acFbBa5e2 SHA1: 642079815514036b59065#2312612535a7#80a73 SHA2S6: cd0ac5¥e4636f23401a3b67331bad4697a74ecf6256d8e73dFbd4498F467¢8ab Homepage: https: //github.com/bote/botacore Description-en: Low-level, data-driven core of boto 3 (Python 3) ‘A low-level interface to a growing number of Anazon Web Services. The botocore package is the foundation for AWS-CLT. ‘This package contains the module for Python 3. Description-nd5: sbfe6z0f1a2dee565164398a617b5493 prateeksThinkpad:~$ sudo apt install python3-botocore Reading package lists... Done Building dependency tree Reading state information... Done The follwing package was autonatically installed and is no longer required: Libdunbnet2 Use ‘sudo apt autorenove’ to renove it. The following additional packages will be installed: Figure 2-20. Search and install packages using apt alCHAPTER 2 DOWNLOADING, INSTALLATION, AND SETUP Summary In this chapter, we learned how to enable the Windows Subsystem for Linux on Windows 10 systems and various methods to download and install the Linux distribution. Once that was done, we launched the Windows Subsystem for Linux for first use, followed by setup, configuration, and user management. Going forward in the next chapter, we are going to learn to build mixed experience between Windows and Linux environments by worlds to developers and system administrators. dging the gap between the two operating systems and providing the best of two 42.