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.

No comments:

Post a Comment

Autoscaling: Azure HDInsight Cluster