Bash on Ubuntu on Windows – Everything I never knew I needed.

in #ubuntu7 years ago (edited)

While trying to compile a Linux application on a VPS, I was quickly fed up. 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. The install process was pretty easy:

  1. Open Settings.
  2. Click on Update & security.
  3. Click on For Developers.
  4. Under “Use developer features”, select the Developer mode option to setup the environment to install Bash.
  5. A warning will pop up; On the message box, click Yes to turn on developer mode.
  6. Sometimes after the necessary components install, you’ll need to restart your computer. I did not have to.
  7. Once your computer reboots, open Control Panel.
  8. Click on Programs.
  9. Click on Turn Windows features on or off.
  10. Check the Windows Subsystem for Linux (beta) option.
  11. Click OK.
  12. 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

  1. From here you can open the start menu, open command prompt and type bash.
  2. Type y and press Enter to download and install Bash from the Windows Store.
  3. 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”).
  4. 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.

  1. Start by uninstalling openssh-server: sudo apt-get remove openssh-server

  2. Then reinstall it:sudo apt-get install openssh-server

  3. From there make changes to the ssh config file:sudo nano /etc/ssh/sshd_config ; disallowed root login by setting PermitRootLogin no Then add a line beneath it that says:
    AllowUsers yourusername Make sure PasswordAuthentication is set to yes if you want to login using a password.

  4. Disable privilege separation by adding/modifying : UsePrivilegeSeparation no
    Then restart the SSH server service:sudo service ssh --full-restart
    Your config will end up looking like this:

  5. Then restart the SSH server service:sudo service ssh --full-restart

Congrats, you now have Bash on Ubuntu on Windows set up. You can compile applications , install and run terminal applications and all that fun jazz.

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.

Sort:  

Cool find! Thanks for the info!

Coin Marketplace

STEEM 0.29
TRX 0.12
JST 0.033
BTC 62963.68
ETH 3115.67
USDT 1.00
SBD 3.89