Showing posts with label Windows. Show all posts
Showing posts with label Windows. Show all posts

Wednesday, January 30, 2019

Quick steps to setup Ubuntu GUI & RDP from Windows Machine

Introduction

The post will discuss mainly about provisioning an Ubutu machine on Amazon AWS, setting up GUI on the machine and finally able to do the RDP from the windows machine.

The approach really helped me to cut my cost of running my Machine Learning experiments from the Ubuntu (Linux) machine rather running them from a Windows machine. This actually reduced the bill by whooping 50%.

Step 1: Provision a Ubuntu machine on AWS

As explained in my earlier post, from the documentation we can acquire the Ubuntu machine on Amazon AWS. The tutorial also help with the process to connect to the new machine using Putty tool.

Step 2: Setup GUI on Ubuntu

Once we are successfully login and connected to the Ubuntu machine, execute the following commands in sequence:-

Command 1: sudo apt update
Command 2: sudo apt upgrade 
Command 3: sudo sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
Command 4: sudo /etc/init.d/ssh restart 
Command 5: sudo passwd ubuntu (this will ask for password reset for user'ubuntu'. Remember it!)
Command 6: sudo apt install xrdp xfce4 xfce4-goodies tightvncserver
Command 7: echo xfce4-session > /home/ubuntu/.xsession 
Command 8: sudo cp /home/ubuntu/.xsession /etc/skel 
Command 9:  sudo sed -i '0,/-1/s//ask-1/' /etc/xrdp/xrdp.ini 
Command 10: sudo service xrdp restart 
Command 11: reboot


Step 3: Configure and Save Connections from Putty

Enable tunneling from the putty to use the localhost port# 8888 (just an e.g.) to the Ubuntu machine RDP port# 3389. Here we also need to use the Private IP of the remote machine and map its port# 3389 to the tunnel. Save the connection for connecting with the machine multiple times later.



Step 4: Connecting Via Windows machine

Again connect to the remote machine by “Load” the above saved putty configuration.
Once connected to machine using putty, use RDP (Run -> mstsc.exe) to connect to the remote machine by using: localhost:8888 in ‘computer’ field. This is the port# which I have used to enable tunneling via local computer.





Once connected – it will prompt for ‘ubuntu’ password which we configured in Step#2, command 5. Upon successful login we will be connected to the Ubuntu GUI from our Windows via RDP.



Conclusion

Once I was able to setup my Ubuntu GUI machine, then I further installed Visual Studio code as an IDE for my experiments and development and later installed my ML Docker image to have a fully functional Python and TensorFlow development environment.

Wednesday, January 23, 2019

Preparing Visual Studio Code for TensorFlow Development

Introduction

Visual Studio Code is a popular open-source IDE distributed by Microsoft. This is a powerful tool which support wide variety of code development almost across all the platforms. This allows various extensions which can be installed to support entire end-to-end development life-cycle.

Google’s TensorFlow is well known Deep Learning library which was originally available for the Python developers.

This article describe about preparing TensorFlow development environment on Visual Studio Code on Windows VM.

Prerequisites

  1. Download and install Visual Studio Code
  2. Python: TensorFlow support version 3.4, 3.5, 3.6 (64-bit version)
  3. Pip: Which installs as an option with Python
  4. VirtualEnv: To setup virtual environment for TF
  5. Download and install Visual C++ 2015 Redistributable Update 3 from this URL: https://www.microsoft.com/en-us/download/details.aspx?id=53587

Setup Steps

  1. Download and install Visual Studio Code on the Windows 64-bit machine. The the download url and installation instructions are available on VS Code site
  2. Open VS Code and create a workspace folder. Also create a dummy python file, call it tf_test.py.
  3. Once the file is created – VS Code will prompt for Python installation and Python extensions for VS Code. Install Python 3.6 from official download site. [Ignore if Python is already installed].
  4. Allow VSCode to install and enable necessary extensions for Python, e.g. Pylint, etc..
  5. TensorFlow installation: refer the [url]
  6. Install Virtual env
    PS C:\Program Files\Python36> pip3 install -U pip virtualenv
  7. Create new TensorFlow virtual environment:
    virtualenv --system-site-packages -p python ./tensorflow
  8. Activate the TenforFlow virtualenv:
    PS C:\Program Files\Python36> ./tensorflow/scripts/activate
    (tensorflow) PS C:\Program Files\Python36>
  9. Execute the python script as:
    (tensorflow) PS C:\Program Files\Python36> python <filePpath>\tf_test.py.
Lastly, to deactivate and exit the virtual environment use : deactivate

Conclusion

This simple tutorial for TensorFlow setup on the Windows machine will help developers who are not comfortable to start with training Deep Learning models on Ubuntu (or any Linux) machine. 



Autoscaling: Azure HDInsight Cluster