Thank you for contacting us. We will get back to you shortly.
April 24, 2018 - by Carol Cobine
Open source developers tend to work on macOS because, for much of the coding that they do, all of the tools they need are available and run more smoothly on macOS than in Windows. Also known as "Bash on Windows", 'Bash on Ubuntu on Windows", "Linux on Windows", Windows Subsystem for Linux (WSL) availability gives developers access to familiar tools but with Windows drives and file interoperability. Triton CLI on WSL is worth exploring as a way to seamlessly access both Linux capabilities and Windows integration on a single desktop.
When we initially discovered WSL, it was in beta testing. WSL graduated to a Windows feature with the Windows 10 Fall Creators Update and it is continuously improving. At the time of writing the first draft of this blog, you needed to be in developer mode and Ubuntu was the only Linux distrobution available. Now, you don't need to enable developer mode and there are many Linux distrobutions to choose from.
This post explains how to set up Ubuntu on WSL on Windows 10 Professional and then install Triton CLI.
WSL is a complete Linux system inside Windows. In WSL, Ubuntu Linux runs directly on top of Windows, it is not a virtual machine or a Linux emulator like Cygwin. WSL runs the same binaries as Ubuntu Linux, but Linux isn't the underlying OS kernel. Instead, WSL has the utilities and software typically available in a Bash shell, performing real-time translation of Linux syscalls into Windows OS syscalls.
Before you begin, ensure that you have a Triton Compute Service account with valid billing information.
WSL also requires that you are running the 64-bit version of the Windows operating system. You can do this by checking the computer's system information. As a best practice, ensure that you are running the latest version of Windows 10 with the most recent updates. Because WSL is still evolving, you may need to adjust the steps below in accordance with your current configuration.
To manually enable WSL:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
You can also enable WSL via the Control Panel: Programs > Programs and Features > Turn Windows features on or off > Windows Subsystem for Linux. Select the check box and restart your machine.
Now that you have set up the necessary components, you can install the Linux distribution of your choice. If you choose a distribution other than Ubuntu, you’ll need to customize the instructions in this blog.
On Windows, Ubuntu runs only from the C drive, so make sure Ubuntu is installed and stored on the C drive. If you are an intrepid installer and have already deployed the application to a different location, to change the location: Go to Settings > Storage > More Storage Settings: Change where new content is saved and select C Drive here.
To install Ubuntu:
Right after the install completes, you are asked to set a unix username and password as part of the Ubuntu account setup. This request appears only during setup. The username doesn’t have to match your Windows account, and you won’t be allowed to use "admin" as the username. This account is an admin account with sudo privileges.
apt tool functions to install software packages in Ubuntu. WSL has the minimal tools you'll need to get started, but we'll need to install a few more items in order to work with Triton. In this step, we update, upgrade, and add essential native Linux compilers to replace the Windows Linux binaries. This ensures a more stable environment for Node.js tools.
Note that most developers familiar with Linux may be more familiar with
apt-get. In WSL,
apt works without the additional configuration tweaks currently required to run
apt-get in a Windows-based environment.
In WSL Ubuntu,
apt update downloads and synchronizes the package index files from their sources. This updates the list of available packages. An update must always be performed before upgrading software to ensure you get the latest version. Execute the following:
$ sudo apt update
Upgrading software to the latest is a best practice for a first time install. In general, it may be better to upgrade or patch after the initial installation, depending on your current configuration. In this case, we will install upgrades to ensure to include the build dependencies needed for software such as curl and npm. To upgrade your software, run:
$ sudo apt upgrade
build-essential package that installs a number of packages commonly used for software development and needed to install Node.js and Triton CLI tools.
To install Linux compilers, run:
$ sudo apt install build-essential
In WSL, the Node Version Manager (NVM) of tool gives you the ability to install and use multiple versions of Node.js. We install NVM to ensure Node detects and runs the Linux binaries added in
build-essential. The code example also includes
checksum to ensure that the file you are downloading is in fact the version of the file that you expect.
$ curl -L -s -o /tmp/install.sh "https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh" && \ echo 'f3c026098b6e2190373e5d8fdaaf27ee99a97b1d976a712d9550b85699c023fe /tmp/install.sh' | sha256sum -c && \ bash /tmp/install.sh
A note about
checksum: You can run the
curl command without a check, but the best practice is to ensure that the file transfer completes without corruption. You also want to be sure that you've gotten the right file. There have been many attacks where malware is inserted on a server and added to open source tools. A checksum works to prevent this.
After the install completes, exit the terminal, and start a new Ubuntu session. Remember to start Ubuntu as Admin.
Now, install the latest stable version of Node:
$ nvm install stable
When using NVM, you'll need to explicitly specify the Node version you want to use. Running the
install command automatically starts Node.js running. But, each time you run Ubuntu, you'll need to specify the version using the command
nvm use stable. To simplify the set up, you’ll probably want to add this command to
And that is it! Now, you are ready to install
triton. You can head on over to Joyent's getting started documentation and follow the instructions for installing
triton, generating SSH Keys, creating profiles, spinning up instances, and more.
You can explore more
triton methods and resources from Joyent's API reference documentation. You can create containers and virtual machines such as Docker containers, infrastructure containers, or hardware virtual machines. You can add images, create custom images, and so much more.
For more information on WSL, read:
We want to hear about how you run
triton on WSL or if you use
triton in another way on your Windows machine. Tweet us @Joyent.