Skip to content

Step by step setting up Ubuntu on AWS and connecting to GUI with MS Remote Desktop Connection

Notifications You must be signed in to change notification settings

scottsun17/AWSUbuntuSetupWithGUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 

Repository files navigation

AWS Ubuntu Setup With GUI on Windows Computer

Step by step setting up Ubuntu on AWS and connecting to GUI with MS Remote Desktop Connection on a windows computer

What you need to start

  • Windows Computer (mine is windows 7)
  • Remote Desktop Connection (come with windows)
  • AWS account (link below to register)
  • PuTTY (link below to download)

Register an account with AWS

Link: https://aws.amazon.com/ awsaccountsignup

How to set up Unbuntu with AWS and connect to the instance from our local computer?

  1. sign in to the console

  2. Under Build a solution, select Launch a virtual machine launchavm

  3. On the right side where all different type of OSs are listed, select Ubuntu Server 16.04 LTS (HVM), SSD Volume Type.
    The reason why I choose this version is that MS Remote Desktop Connection works on this version and I don't want to figure out if the same method work for the other version (Ubuntu Server 18.04 LTS (HVM), SSD Volume Type). choosevm

  4. Click Review and Launch if you want the free version. Nothing for you to set up.

  5. Again in the next page, click launch

  6. Now you are promoted with Selecting a new key pair. It is like username and password combination for your VM at AWS.
    If you never created VM at AWS before, you won't have any existing key pair. So select create a new key pair.
    Name it however you want - Mine is CallMeMaybe~~~
    Click Download Key Pair and you will get a file "whatever you named it".pem;
    This is the love of your life and you should keep it save and never delete it
    keypair

  7. Click Launch Instance
    Your Instances are now launching; scroll all the way down, you will see View Instance at the bottom right corner

  8. Click View Instance and you will see something like the picture below:
    Important things includes but not limited to the following:

    • Name of instance, you can name it however you want. Name it so you dont confused it with others. AWS free version allow up to two instance running at the same time. So you can get a Windows and a Linux running at the same time~~ way to go Amazon~
    • Instance ID is important
    • IPv4 public IP is important viewinstance
  9. Now you are done with Ubuntu set up. We now need a tool to connect to our VM - PuTTY

  10. Following the Installation instruction. There is nothing to set up...

  11. Once your PuTTY is installed, go to start menu:

  • All Programs
  • PuTTY Folder
  • PuTTYgen and you will get the following program:

puttygen

  1. The program is used to load the Key Pair(CallMeMaybe.pem as I generated in step 6) and generate private key
  • Click Load
  • Navigate to the folder where you saved your Key Pair. You will not be able to see the Key Pair because the file selection is default to PuTTY Private Key Files(.ppk). Change to All Files and you will see your AWS Key Pair

keyload openkeyload succe

  1. If you see the above picture, Key Pair is loaded.
  • Now you need to set password(passphrase) for your private key
  • Select RSA as the type of Key to generate
  • Number of bits in a generated key: 2048
  • save Private Key (CallMeMaybe.ppk)
  • exit PuTTYgen
    savepk
  1. Now let's connect to your AWS Ubuntu through PuTTY
  • Start menu:
  • All Programs
  • PuTTY Folder
  • PuTTY
  • Now you see the PuTTY Configuration
    puttymenu
  1. At the PuTTY landing Page (Session tab on the left menu), we need to fill out the following information (Go to Step 8 to find the information)
  • a. Host Name (or IP Address) - IPv4 public IP from the AWS Console Instance Page
  • b. Port 22 (Default)
  • c. Connection Type SSH (Default)
  • d. DO NOT load yet, we are not done
    ipv4
  1. On the left side menu, click Connection -> SSH -> Auth
  • Now you land on the Options controlling SSH authentication page
  • I kept all the default selection (see picture below)
  • click Browse
  • loack CallMeMaybe.PPK file (It's the PPK file generated by the PuTTYgen, not the pem file you download from AWS)!!!!
  • DO NOT Click Open!!!
    loadppk
  1. Now we navigate back to the Session page - > Name the session(CallMeMaybe Instance) -> Save -> and you will see the name appear inside the Saved Session box. Now click Open. See picture below: session

  2. This is the first time you connect to the VM through PuTTY, you will get a scary msg like the picture below. Just ignore it and click Yes :D scarymsg

  3. Now you are in the DOS where we need to login to our Ubuntu System. User Name: ubuntu Password: whatever password you set up for the private key - see step 13 dos

Now let's get GUI for our Ubuntu OS.

  1. Following the above step, you are login to the system. We need to check for Update; Type or copy the following to the DOC (please include "sudo", it's part of the cm...
sudo apt update && sudo apt upgrade

You will be promoted to install more in the additional disk(see below picture). Type Y. y

You will see the following page.. Select "Keep the local version currenly installed" - press enter enter

  1. Once you are done, let's config sshd_config file to allow password authentication on our ubuntu
sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
  1. We need to restart the SSH daemon for the new sshd config to take effect
sudo /etc/init.d/ssh restart

2code

  1. Get temporarry root privileges and change the password more security
sudo passwd ubuntu

Enter another password.. please dont forget it. you will need it to log in to the system. password

  1. Install the xfce4 desktop environment - xrdp
sudo apt install xrdp xfce4 xfce4-goodies tightvncserver

It will ask you if you want to continue. I typed Y too fast and forgot to screenshot.. Just type Y and wait for it to install

  1. set xfce4 as the default manager for RDP connections
echo xfce4-session> /home/ubuntu/.xsession
  1. Copy .xsession to the /etc/skel folder and Run the sed command to update the [xrdp1] section
sudo cp /home/ubuntu/.xsession /etc/skel
sudo sed -i '0,/-1/s//ask-1/' /etc/xrdp/xrdp.ini

67

  1. Restart xrdp
sudo service xrdp restart
  1. Now you are almost done! We now need to roboot the system.
sudo roboot
  1. We need to go back and config PuTTY again
  • at landing page (Session), select your saved session - mine is CallMeMaybe Instance
  • click load
    load
  1. On the left side Menu, select Connection -> SSH ->Tunnel and we need to do the following:
  • Source port: can be anything as long as they are not in conflict. we use 8888 here
  • Destination: It is the Private IPs from your AWS Ubuntu Instance + ":3389" (Dont forget the semicolon )
  • See picture below for a more clear view 3389
  1. Click add and it will appear in Forwarded Ports add

  2. Go back to Session page, click Save so next time you dont have to config again.

  3. Click Open and login

  4. Type in the following code to see if the port is connected

netstat -antp

3389dos

  1. If you find 0.0.0.0:3389, then you are connected. Now we can work on the Remote Desktop Connection

  2. Launch Remote Desktop Connection and type in the computer field; 8888 is the port number you set in the above step(step 11). If you set a different number, you should go back and check what the number

127.0.0.1:8888

8888

  1. Click Connect and Remote Desktop Connection will launch. Now type in username and password username: ubuntu password: Same Password you set in Step 4
    msremote

  2. You are in the GUI!! Select Default Config gui

  3. Now lets get you a browser

  • click Application
  • click Terminal Emulator
  • Type in the following code
sudo apt-get install firefox
  • Type Y to continue and now you have a brower to do whatever you want~~~ browser

About

Step by step setting up Ubuntu on AWS and connecting to GUI with MS Remote Desktop Connection

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published