In Windows 10, there is a feature that allows you to run native Bash Linux. Pretty cool, and I’ve started using it to have a local Redis instance running on my local dev machine that runs Windows.
Install Bash on Windows
To get this feature, you need the Windows 10 “anniversary” update. You need to then turn on developer mode in Windows. To do this, go the Settings > Update & Security > select For developers on the left and select the Developer Mode radio button.
You then need to turn on the Bash feature in Windows. Go to Programs and Features on the control panel, select Turn Windows features on or off, then navigate to “Windows subsystem for Linux“.
You’ll probably need a restart.
You should now be able to find “Bash on Ubuntu on Windows” (snappy name) from a search in your start menu. Open it.
First thing we need to do is install Dotdeb – which has a bunch of packages – including Redis – for use here.
To install Dotdeb:
You need to add a couple of lines to your APT list that allows us to use Dotdeb. I did this using nano text editor, with the following command:
sudo nano /etc/apt/sources.list
You will probably then be asked for a password. The next screen displays a list of sources. you need to add a couple of lines to the bottom:
deb http://packages.dotdeb.org squeeze all deb-src http://packages.dotdeb.org squeeze all
Then press Cntl + O followed by enter to save in the same location. Then Cntl + X to exit nano.
Then run the following two commands to get and add GnuPG key.
wget https://www.dotdeb.org/dotdeb.gpg sudo apt-key add dotdeb.gpg
Finally you need to run the following the get the APT packages:
sudo apt-get update
Once this all is done, you have the simple step of installing Redis, which is done using the following:
sudo apt-get install redis-server
That should be you all set up.
Once you are installed you, obviously, will want to start up your local server. The command for this is:
sudo service redis-server start
You can check the server’s status with: sudo service redis-server status
You may also want to run look at what’s stored on your server. To do this enter the command redis-cli. Once in cli you can do stuff like:
Info – what is says on the tin – info about your server instance. Number of connections, memory usage etc.
keys * – lists all keys stored in the instance
get <myKey> – retrieves the object stored for supplied key.
Note: most of the information came from: http://www.hanselman.com/blog/DevelopersCanRunBashShellAndUsermodeUbuntuLinuxBinariesOnWindows10.aspx I have provided a bit more instruction on setting up Redis as I struggled a tad as a Linux noobie and figured I wouldn’t be the only one!