How to install Truffle & TestRPC on Ubuntu or Windows 10 with “Windows subsystem for Linux”

I previously wrote how you can install Truffle & TestRPC on a windows machine, by using the Windows installers for Node & npm.
However I have found it is a much nicer experience to use the Windows Subsystem for Linux which provides a native Ubuntu shell with bash, which allows me to run all the Linux tools natively without issues. These install steps will work on an Ubuntu machine as well.

Prerequisite if running on Windows

  1. Enable Windows subsystem for Linux.

    Follow this short guide on how to enable it


  2. After following the steps in the guide above. Simply start the Ubuntu bash shell



Install steps


# Takes a clean Ubuntu image, up to being Ethereum dev ready.
# installing npm from official repo as Ubuntu default apt-get has a very old version (NodeJS v4.1)
curl -sL | sudo -E bash –
sudo apt-get update -y && sudo apt-get upgrade -y

# install system basics
sudo apt-get install -y build-essential nodejs

# upgrade node/npm/npx and then install dev tools
sudo npx dist-upgrade
sudo npm install -g ethereumjs-testrpc truffle

# fix up permission issues. npm5 creates these as root, so user can’t modify by default
sudo chown -R $(whoami) ~/.npm
sudo chown -R $USER:$(id -gn $USER) ~/.config


now you should be able to create a folder, go into it and run `truffle init` to create a new project template.



Additional things to do

Now that your machine has it installed, I recommend you follow my other guide to get Visual Studio code configured for Truffle development.


4 thoughts on “How to install Truffle & TestRPC on Ubuntu or Windows 10 with “Windows subsystem for Linux”

  1. […] UPDATE 2017/08/25: Now that Truffle has made installation easier, I have cleaned up and streamlined the windows install steps below.However I recommend that instead look at using the new feature in Windows 10 that lets you run Linux tools directly in Windows. This is how I’ve been doing my development for the last few months… […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s