While trying to compile a Linux application on a VPS, I was quickly fed up with resource limitation, disconnects and the overall feeling of being far away. I knew there had to be a better way than creating a virtual machine or renting a virtual server to compile these applications on Ubuntu – for Windows. Apparently, Windows 10 introduced Bash on Ubuntu on Windows. A Linux subsystem for native command line integration of Bash in Windows 10. The install process was pretty easy:
- Open Settings.
- Click on Update & security.
- Click on For Developers.
- Under “Use developer features”, select the Developer mode option to setup the environment to install Bash.
- A warning will pop up; On the message box, click Yes to turn on developer mode.
- Sometimes after the necessary components install, you’ll need to restart your computer. I did not have to.
- Once your computer reboots, open Control Panel.
- Click on Programs.
- Click on Turn Windows features on or off.
- Check the Windows Subsystem for Linux (beta) option.
- Click OK.
- Again, you may have to restart your computer here, mine did not prompt for reboot.
Next we will set up Bash on Ubuntu on Windows
- From here you can open the start menu, open command prompt and type bash.
- Type y and press Enter to download and install Bash from the Windows Store.
- Then you’ll need to create a default UNIX user account. This account doesn’t have to be the same as your Windows account. Enter the username in the required field and press Enter (you can’t use the username “admin” or “root”).
- Input and verify the password you would like to use for the account.
You can now use the command prompt to open bash sessions. I personally use MobaXterm for all of my linux/VNC needs, so I needed to be able to SSH locally to my Bash sessions. To do this, I needed to set up an OpenSSH server on my computer.
- I first started by uninstalling openssh-server:
sudo apt-get remove openssh-server
- I then reinstalled it:
sudo apt-get install openssh-server
- From there I made some changes to the ssh config file:
sudo nano /etc/ssh/sshd_configand disallowed root login by setting
- Then add a line beneath it that says:
AllowUsers yourusernameand make sure
PasswordAuthenticationis set to
yesif you want to login using a password.
- Disable privilege separation by adding/modifying :
- Then restart the SSH server service:
sudo service ssh --full-restart
Full native Windows Explorer browsing can be used on the file system by navigating to “%localappdata%\Lxss\rootfs”
To navigate the windows file system from within bash, cd to /mnt/c
For more information and learning resources regarding BOUOW, go here:https://msdn.microsoft.com/en-us/commandline/wsl/about
Otherwise, any Ubuntu 16.04 documentation can be used to troubleshoot and find information on the bash commands and uses itself.