Monday, November 12, 2018

Windows Subsystem for Linux, the best way to learn Linux on Windows

Earlier this year, Microsoft released the Windows Subsystem for Linux (WSL). WSL lets developers run the GNU/Linux shell environment on a Windows 10 PC, including most command-line tools, utilities and some services, directly from source repos without the overhead of a virtual machine.

WSL is also the best way to learn Linux on Windows!

About WSL

Currently WSL supports Ubuntu, Debian, Suse and Kali distributions and can:
  • run bash shell scripts 
  • run GNU/Linux command-line applications including: vim, emacs, tmux
  • run programming languages like Javascript/Node.js, Ruby, Python, C/C++, C# & F#, Rust, Go, etc.
  • run background services like sshd, MySQL, Apache, lighttpd;
  • install additional software using own GNU/Linux distribution package manager.
  • invoke Windows applications.
  • access your Windows filesystem

Installing WSL on Windows 10

Installing WSL is covered by Microsoft on this article and is as easy is two steps. Let's take a quick look.

Step 1 - Run a Powershell Command

To install WSL on your Windows PC, it will be necessary to run PowerShell as Administrator (shift + right-click) and run the following command:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux 
After the installation ends, restart your PC.

Step 2 - Install WSL

After the PowerShell module is installed, I recommend installing WSL through the Windows Store. To open the Windows Store on your Windows 10, click:
Start -> Type Store -> Click on the Windows Store:
Then type "Linux" on the search box and you should get something similar results to this:

To install any of those Distros, just click on the thumbnail, accept the terms and click Get!  Windows will download and install WSL for you

Running WSL

After installation started, you will be prompted to enter your username and password. After done, you'll get a cool Linux terminal to start playing with. You can even have multiple Distros installed on your Windows 10 machine.

On mine, I installed Debian and Ubuntu. Here's the last bit of the Debian installation :

Using the Terminal

After installation is done and you entered your credentials, potential next questions would be:
  • Where are my files? 
  • Do I have internet?
  • How do I install software?

Let's review those.

Accessing my Windows Files

It's all there on the /mnt/c mount point. To verify on yours type mount on the command prompt and look for C: on it. That's where your windows files should be.

Which I can list contents with ls:

Accessing the Internet

The WSL instance should have working internet out of the box. Testing the internet is as simple as doing a ping to Google:

If you're using Ubuntu, you can also verify your network info with ifconfig:

Installing Software

On Debian-based systems (Ubuntu included), installation is done by the apt command. For example, searching for a package is as simple as:
Then, to install Ruby on the Ubuntu subsystem is just running the command below as root:
$ apt-get install ruby-full

Other Tasks

Now that you understood how to locate your PC files, validated your access to the internet and installed some software, I'd recommend that you:

Conclusion

So you have the WSL installed on your machine and a Linux terminal ready to starting interacting with. Now what?

I would suggest that you learn basic system commands (ls, cp, man, rm, ps, etc), understand the filesystem, learn to manage software, understand the networking stack and review how to perform certain administrative tasks on the terminal.

The Linux terminal is perfect for users who want to learn Linux and to those who spent a lot of time on Windows but need access to a Linux terminal.

And who knows? Maybe you too realize that Linux is awesome and decide to install it as your main OS? =)

See Also

Thank You, Fedora
Building and Running Asp.Net Core apps on Linux
Installing Docker on Linux
Running RavenDB on Docker

For other Linux posts on this blog, please click here.

Further Reading

Some interesting articles to explore on this topic could be:
    WSL - FAQ
    WSL - Installing
    WSL - Documentation
    WSL - Command Line Reference
    An A-Z of Linux – 40 Essential Commands You Should Know
    Linux Command Line tips that every Linux user should know
    Must-Know Linux Commands For New Users

    Tuesday, November 6, 2018

    Thank You, Fedora


    Today, it's Fedora's 15th anniversary. To celebrate this date, the Fedora Community Operations Team organized the Fedora Appreciation Week (FAW). It happens on the week of November 6th to coincide with the announcement of the project 15 years ago.

    This week-long event celebrates the efforts of the Fedora contributors and is and opportunity to share our thank you with the team. Appreciation can be an IRC message, a message on a mailing list, Fedora Happiness Packets or a blog post.

    My Thank You

    My thank you to the Fedora Community is this humble blog post.

    Thanks to all the Fedora team and to the whole amazing Open Source communities that contributed on hundreds of projects that compose this fantastic free, open source operating system!

    Thank you developers, QAers, devops engineers, designers, beta-testers, community members, volunteers, translators, program managers and everyone else that helped this project all these years. =)

    Fedora and Me

    I've been using Fedora Linux as my primary operating system for almost 5 years. Using a Linux-based OS may seem a strange choice for a .NET developer. So how did that happen? And why Fedora?

    I have been using Linux for 15 years but always in dual-boot mode. Recently I decided it was time to switch definitively to Linux and I was motivated by the release of the .NET Core Framework.

    The difficult part was to choose the distro. For someone who loves Linux and tested every option on that Distrowatch list during the last years, Fedora was the distro that best fit my own requirements Let's review them.

    Why choose Fedora

    Simplicity

    I chose to put simplicity first because it is indeed on of the characteristics that I enjoy the most and the most commonly asked by new users. From the installation to the default UI, everything seems integrated, animations are smooth. All of this without sacrificing performance.

    A Fedora workstation running Gnome 3.30 / Source

    Stability

    Fedora is very stable. And differently from what people think, Fedora is not a beta-testing environment for RHEL. Packages are tested on its development channel, validated and once mature and all dependencies are met and stable, millions of users get the update. Be sure that for each update that you get, hundreds of ours of tests were performed.

    Security

    We know that keeping the system up to date is as important as having a good anti-virus software, a working firewall and safe web browsing habits. Fedora shines on this aspect. Due to its SELinux integration, frequent software and kernel updates, chances are you're running a safe system.

    Privacy

    Linux users shouldn't be concerned about privacy. Or should we?  Fedora discloses its Privacy Policy publicly and adheres to it as to its core principles: Freedom, Friends, Features and First.

    Excellent for Development

    Developers are pretty much covered with everything on the development site. Docker, Swift, Python, NodeJs, Ruby, Java,  among others can be found in the repos. Personally, Visual Studio Code, git, Firefox and the dotnet cli cover pretty much everything that I do.

    Performance

    Fedora performs. My 3 yr-old laptop boots in 5 seconds. The performance is mainly due to more up to date software and to keeping the OS running only with the necessary resources. Yes there are faster options and yes, Gnome is not as light as other window managers but it's still a very good for the avg user.

    Freedom

    With Fedora, free alternatives are chosen to proprietary code and content and limit the effects of proprietary or patent encumbered code on the Project. Releases that are predictable and 100% legally redistributable for everyone.

    Reliability

    The Fedora project serves as the base for RHEL and CentOS. So it needs to be mature, it needs to be stable. It's a very serious Linux-based OS used by millions of users and servers and it needs to be reliable. I haven't read a glitch in the last 3 years.

    Cutting-Edge Software

    As previously stated, First is one of the foundations of the Fedora Project. Even not being a rolling release, the Fedora repos are pretty up to date. My opinion is that it is the best mix without being a rolling release. And remember, you can always add different repos or install software trough universal Linux packages like Snap or FlatPak.

    Software can be downloaded through the command line or using the nice Software tool.

    Frequent Software and Kernel Updates

    Fedora updates are frequent. Sometimes, multiple times a week I get software upgrades covering security issues, performance, stability and even Kernel updates.

    It's also common to get multiple kernel updates per release. That usually means running a more mature, stable and secure kernel. It also means better performance and supported hardware too.

    Custom Software Repositories

    The amount of software available on the official Fedora repo is incredible. Probably everything that you need, you can find there. But if you're not covered for the package selection on the free/default repo, you still could make use of RPM Fusion to install software that doesn't adhere to Fedora's requirements.

    Development of new Features

    The Fedora community creates many of the technical features that have made Linux powerful, flexible, and usable for a wide spectrum of millions of users, administrators, and developers worldwide. In fact, this is the Missions and Foundations of the project:
    The Fedora community prefers approaches that benefit the progress of free software in the future over those that emphasize short term ease of use.
    Some of the features developed with Fedora include a new display system (Wayland), a new audio and video subsystem (PipeWire), doing application packaging through Flatpak, among many others.

    Two upgrades per year

    Because Fedora releases happen twice a year, you'll get big system updates (including Gnome, GCC and base libs) twice a year. It's the best way to have up to date software without the complexities and issues rolling release distros have.
    Upgrading is as simple as 2 clicks on the Software app or 4 commands from the terminal.

    Universal Linux Packages

    You know you can install software using the package repos. Another option is using Snap or FlatPak. And installation is as simple as opening Software -> Searching and clicking install.

    RHEL

    Many people ignore this but another strong reason to use Fedora is because it's the incubator for RHEL, the leading Linux-based OS on servers. You'll be interacting with Yum/DNF, SystemD, SELinux, RH system directories, etc. Very useful knowledge if you intend to work with RH software.

    Multiple Variants 

    Fedora also ships different Spins including KDE, Xfce, LXQt, MATE, Cinnamon, LXDE and SoaS (Sugar on a Stick), available in both 64-bit and 32-bit versions. It has even an ARM release.

    Fedora in some of its variants
    You can also find on Labs, variants that are target to designers, astronomers, scientists and musicians.

    Modularity

    We also have access to the new Modularity optional repository that ships additional versions of software on independent life cycles. This way users can keep their operating system up-to-date while having the right version of an application for their use case, even when the default version in the distribution changes.

    Conclusion

    Fedora is a very polished, stable and secure Linux-based OS. With all its variants, I'm pretty sure there will be something for everyone. If you have never used it, I would suggest that you try it, regardless of your technical background. If you use another distro, I would kindly recommend that you to try Fedora 29.

    And please, join me sending a thank you to the @Fedora community under the hashtag #WeAreFedora on this Fedora Appreciation Week.

    See Also

    Building and Running Asp.Net Core apps on Linux
    Installing Docker on Linux
    Running RavenDB on Docker

    For other Fedora posts on this blog, please click here.

    References

    Fedora Appreciation Week
    Announcing Fedora Core 1
    Download Fedora
    Fedora Project
    Fedora - Official Documentation
    Fedora 29, hands-on: Installing and upgrading