Bash on Ubuntu on Windows

I just opened up a command prompt on Windows 10, typed in bash, and watched as Ubuntu was installed on my computer.

I never, in 1 million years, thought that I would ever live to see the day that this happened. With each passing announcement, upgrade, release, and blog post Microsoft is proving itself to be an innovative company once again. I have never been more excited about Windows than I am right now.

  1. This completely changes most of the things I said in this post.
  2. I have been saying for a while that I predict that the next version of Windows Server will basically be a Linux Distro. I think we are one step closer to making this a reality, and I think that this changes everything.
  3. I am so excited to see what will happen in the future with this partnership.

You can read more details here. My mind is too blown to say anything else about this right now.

Development on Windows

Last weekend CircleCI hosted ClojureBridge and I volunteered as a TA. It was a super rewarding experience and I hope to be more involved in these types of events in the future. One thing I noticed (and I have noticed a similar trend in my previous experience as a mentor at various hackathons) is that many students and junior developers run windows.

Trying to run and develop Node, PHP, Rails, and even some Python apps on windows can be a pretty painful experience. Most developers who write in these languages use either Linux or OS X, and nearly all production applications written in these languages are running on a Linux server. In addition a lot of documentation assumes that you are running either Linux or OS X for many libraries and sample projects.

Most commonly Windows users will be encouraged to use a VM with VirtualBox and Vagrant. This is not bad advice and for most folks will probably be the best solution while you are learning. Vagrant is certainly worth learning, and I cannot stress how important it is to have a solid understanding of Linux.

However, I am stubborn enough to try to get things to work on Windows and after last weekend I consider myself a self proclaimed Clojure on Windows expert.

Common Gotchas

  1. The Windows PATH is very different from Linux or OS X.
  2. Remember that file paths in Windows use “\” while in Linux and OS X they use “/”
  3. CMD, vs PowerShell, vs Git Bash, vs Bash For Windows. Common theme is differences in the PATH. If you are used to doing stuff via the CLI, or are following some instructions online you can not typically just copy and paste.

Although Windows is generally more difficult for general FOSS development, when it comes to installing third party services and tools (such as databases, queues, app servers) it is typically easier from a beginners perspective to get started because pretty much every major service out there has a point and click GUI installer and configuration system.

There are certainly pros and cons to local windows development. I have a pretty beefy machine at home that I used to play games sometimes. I installed some development tools on it and realize that its a much more powerful computer than my Macbook Pro. I look forward to finding the edge cases and complaining about them in public here on this blog.

Working with NuGet CLI

I have been working with .NET Core lately and I am pretty excited about the future of .NET running outside of just windows. Ever since my first tech job at an enterprise healthcare company, I have had a soft spot in my heart for C#. I am also a huge fan of Visual Studio Code compared to the big ball of bloat that is Visual Studio proper, vscode is a refreshing take on a simple IDE.

The one thing that is not as intuitive as I thought was working with NuGet outside of Visual Studio.

NuGet is the package manager for the Microsoft development platform including .NET

Source: NuGet Gallery | Home

The easiest way to install third party libraries and tooling is with Nuget. Buried deep within the documentation is an executable called Nuget CLI that you can download to use nuget completely outside of Visual Studio. This supposedly works on OS X and Linux as well.

The quick and dirty way to get started is:

  1. Download the latest version of the Nuget CLI
  2. Copy it somewhere that you don’t mind being in your PATH. I have a special folder called C:\DevTools
  3. Open up a command prompt and run the nuget command

Remote Root Access for MariaDB on Ubuntu 16.04 LTS

Typically, when you install MySQL on Ubuntu, it asks you for a root password which you can then use to log into the database. It seems that MariaDB uses a plugin instead to authenticate the root user. This means that the only way to log into MariaDB by default as root is locally with sudo mysql -u root In order to give the root user a password and login the “traditional” way (which includes remote access via a tunnel) you have to do the following.

  1. Log into MariaDB as the Root user
    sudo mysql -u root
  2. Disable the Auth Plugin
    use mysql;
    update user set plugin='' where User='root';
  3. Create a password for the root user
    grant all privileges on *.* to 'root'@'' identified by '$STRONG_PASSWORD';
    flush privileges;
  4. Restart MariaDB
    sudo service mysql Restart

You can now access the root account with a password, and also over an SSH tunnel remotely.