Windows Subsystem for Linux 2

Linux on Windows has always been a bit of a mess when trying to mimic a Unix(MacOS) experience. Cygwin has been my de facto tool of choice to be able use all my linux tools from a command line however packages don’t always all work right and may not work as expected.

There’s always the option of using a VM with the linux flavor of the month but there’s a bit of clunky-ness to it that always got in the way. Copy/Paste issues from VM to Desktop and back. Mouse focus has to be toggled off while leaving focus from the VM interface and Alt+Tab to quickly cycle through to the application you want to be focused on doesn’t work from the interface. Some of this is more true depending on which virtualization technology you’re using but I’ve worked with both Oracle VirtualBox and VMware WorkFusion and most the little annoyances are there both of them.

It is hard not to need virtualization depending on your needs, but if you’re like many of us developers, it’s nice to have a native space you can install Nginx or Apache onto and locally access via http://localhost or http://whatever.name.you.add.to/etc/hosts/file. Basically it’s your linux distro playground that will be very similar to where most applications are deployed.

Enter WSL1 and WSL2, Windows Subsystem for Linux. In their words — “The Windows Subsystem for Linux lets developers run a GNU/Linux environment — including most command-line tools, utilities, and applications — directly on Windows, unmodified, without the overhead of a traditional virtual machine or dualboot setup.

The process to install was real easy. The only quirk I’ve noticed so far is that I needed to add legitimate nameservers(e.g. Google’s 8.8.8.8 and 8.8.4.4) to the Ubuntu installation in order for URLs to resolve properly. The annoying thing is that I need to do it again every time I kill the terminal session to it and come back. But it’s really not that often my local development needs to reach outside of the network, I’m sure I’ll find a more permanent fix if it does. So far so good! Within a day I had a Composer initialized instance of a simple “Hello World” application using Laravel PHP framework served up by Nginx on an Ubuntu server that was all backed by the WSL2.

So far I’m a huge fan. It’s not a solution for all my linux needs, but it’s a huge step towards convenience and I’m sure it’ll only get better. They have great set of instructions here https://docs.microsoft.com/en-us/windows/wsl/install-win10 for installation on Windows and I highly recommend all devs on Windows check it out.

GIF – Pronunciation War Settled

For as long as I can remember there has always been uncertainty and scattered conversations about how the file format extenstion GIF is pronounced. I WIN!!! According to the articles below the creator of the file format intended it to be pronounced it JIF with a soft “G”. Woot! Woot!

https://www.cnn.com/2013/05/22/tech/web/pronounce-gif/index.html

http://bits.blogs.nytimes.com/2013/05/23/battle-over-gif-pronunciation-erupts

Managing SSL Certs

If you want to install a certificate on your web server or any other type of server you must first obtain one.

STEPS:
  • Determine where you need to install the cert. It is generally the load balancer, proxy or server that a URL points to and that URL is used as the Common Name. You can add more URLs or Subject Alternative Names to cover other instances and/or more URLs using one cert but that is beyond the scope of this piece.
  • Generate a CSR and private key
  • Submit CSR to a Certificate Authority (e.g. Digicert, Entrust, Let’s Encrypt).
  • Certificate Authority will provide a signed certificate and possibly an intermediary certificate.

DigiCert has a nice wizard that helps create the OpenSSL command(on Linux) for generating a CSR. It also has wizards/instructions for generating CSRs using other methods.

Converting a .crt to .pem and other conversions.

openssl x509 -in cert.crt -out cert.pem

Creating a .pfx using OpenSSL

openssl pkcs12 -export -in linux_cert+ca.pem -inkey privateky.key -out output.pfx

Creating a .pfx using OpenSSL with root and intermediate

openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile more.crt

Helpful links:

https://serverfault.com/questions/768773/converting-pem-to-pkcs12-using-intermediate-certificate

Using Postfix

It is easy to forget how to test Postfix from the command line as it is usually a dependency of another program that leverages it in the background and the command line is not used for any practical purposes in our day to day activities. Sometimes it’s necessary to test from the command line for various reasons beyond the scope of this article. That said, I’ve documented a couple of very basic practical examples of how it can be used.

Example 1(one liner on command line):
    echo "Subject: Test Email" | sendmail my@email.com

Example 2(one liner but it involves file):
    sendmail -t < fileWithEmailInfo.txt

Contents of fileWithEmailInfo.txt
To: my@email.com
Subject: sendmail test two
From: me@myserver.com

And here goes the e-mail body, test test test..

 

References:

Kung Fu Watch List

Please make suggestions to add to the list.

  • The Buddhist Fist
  • Ip Man 1-4
  • Kung Fu Hustle
  • Ong Bak (maybe move to Awesome Fight Choreography section)
  • Once Upon a Time in China 1-2
  • Kung Fu Killer
  • The Legend
  • Drunken Master
  • The Forbidden Kingdom
  • Crippled Masters
  • Enter the Dragon
  • Fist of Fury
  • The Way of the Dragon
  • Hero
  • Iron Monkey

Set up a Minecraft (Java Edition) server on Shockbyte!

Setting up a Minecraft server can be done in many different ways. Some are simple and some advanced. I’ve experienced most variations, everything from setting up a home server to using a hosted service.

That said, I’ve decided to go with a hosted solution since it is very affordable and much easier to set up and maintain. It practically sets itself up. It won’t setup the network for you(not without paying extra), but at least the creation of each server will be straight forward and easily repeatable as you want to add more worlds/mini-games.

What is the difference between a Minecraft network and a single server?

In a single server setup one server is used to host everything. In a network setup there are multiple servers behind a proxy server so there is a minimum of 2 servers needed to set it up. Both network setups and single server setups can support multiple worlds and a lobby system. At first glance there seems to be no advantage to a network setup but the scalability implications are obvious.

I tinkered with both setups and decided there was no difference to me except that the network setup had one more thing to manage and maintain(the proxy). I am not expecting a lot of traffic and so I doubt scalability is an issue. I have switched to a network and back and the process was straight forward so I have no issues with keeping it simple now and expanding in phases if needed.

What we will setup and configure:

1 Minecraft Spigot Server

Steps:

Go to https://shockbyte.com/ and purchase 1 instance. The minimum size is okay for now. Once you decide you like your setup and are going to keep it for a while you can upgrade the size to the performance level you need. The third tier is good for personal/friend use.

Once purchased, for sake of easy navigation let’s assume you’re back at the home page. Click on “Client Area” button at the top right. Find the login button and log in.

Then Navigate to Manage -> Multicraft ( I know, it’s not the most intuitive navigation )

You will now see 1 server listed and likely all with the same default name advertising Shockbyte. Click on it to start configuring it.

Rename it whatever you’d like and for “Server Type” select “AUTO UPDATING: Spigot Latest” and click save. Also click start button at the top. Note the IP address including the port number (e.g. 123.456.789:25546). Navigate to server edit page -> Files -> Config Files and the main pane will list a bunch of config files. Edit any configurations as you please and restart the server to apply your changes.

It’s as easy as that! Use the IP address to connect to your new Minecraft server!

Update: For Bedrock server select the latest Bedrock server available from the “Server Type” drop-down.