Skip to main content
How to Access an Ubuntu Server GUI on GCP Using Windows 10 RDP
Introduction:
In this tutorial, we’ll walk you through setting up an Ubuntu server on Google Cloud Platform (GCP) with a graphical desktop environment. You’ll learn how to create a Compute Engine instance, install a lightweight desktop (XFCE), configure XRDP for remote access, and finally, connect via Windows 10’s Remote Desktop. Let’s break it down into easy-to-follow steps.
Step 1: Create a Compute Engine Instance
• Log into your GCP Console and navigate to Compute Engine → VM instances.
• Click “Create Instance,” then:
– Pick a name, region, and zone that suit your needs.
– Choose a machine type (the default works well for testing).
– Under Boot Disk, click “Change” and select Ubuntu 20.04 LTS (or your favorite version).
• Under Firewall, enable HTTP/HTTPS if you plan to run web services.
• Click “Create” to launch your VM.
Step 2: Connect via SSH and Update Your System
• In the VM list, press the “SSH” button to open a terminal session.
• Run these commands to ensure your system is up-to-date:
sudo apt-get update
sudo apt-get upgrade -y
Explanation:
“apt-get update” fetches the latest package information and “apt-get upgrade -y” installs any available updates automatically.
Step 3: Install a Desktop Environment (XFCE)
Ubuntu servers come without a GUI. To install a light desktop, run:
sudo apt-get install -y xfce4 xfce4-goodies
Then, set XFCE as the default by executing:
echo xfce4-session > ~/.xsession
Explanation:
This installs the XFCE desktop along with extra goodies (applications and tools) and configures your session to start XFCE when you log in.
Step 4: Install and Configure XRDP
XRDP is the service that allows remote desktop connections. Install and configure it with:
sudo apt-get install -y xrdp
sudo systemctl enable xrdp
sudo systemctl restart xrdp
Explanation:
Installing XRDP sets up the remote desktop server. “Enable” ensures XRDP starts automatically after reboot, and “restart” immediately applies these settings.
Step 5: Set Your Username and Password
To log in through XRDP, you need valid credentials.
Option 1: Update Your Existing User
• Find your username with:
whoami
• Set a password for that user with:
sudo passwd your_username
Replace “your_username” with the one you saw.
Option 2: Create a New User
• To add a new user, run:
sudo adduser new_username
• Follow the prompts to choose a password and fill out details.
Explanation:
This step ensures you have a secured account for logging in remotely.
Step 6: Configure the Firewall for RDP
You need to allow traffic on TCP port 3389 (the default RDP port):
• In the GCP Console, go to VPC Network → Firewall Rules.
• Click “Create Firewall Rule” with these details:
– Name: allow-xrdp
– Targets: All instances (or restrict to specific ones using tags)
– Source IP ranges: 0.0.0.0/0 (or limit to known IPs for enhanced security)
– Protocols and ports: Enable “tcp” and enter 3389
• Click “Create.”
Explanation:
This rule opens port 3389 so that remote desktop traffic can reach your VM.
Step 7: Connect via Windows 10 RDP
• Locate the external IP address of your instance in the Compute Engine list.
• Open the Remote Desktop Connection app on your Windows 10 PC.
• Enter your VM’s external IP address and click “Connect.”
• Log in using the Ubuntu username and the password you set.
• Accept any certificate warnings if prompted, and you’ll see the XFCE desktop.
Conclusion:
Following these steps, your Ubuntu VM on GCP is now configured with a user-friendly desktop environment accessible from Windows 10 via RDP. Enjoy your fully graphical remote session, and feel free to experiment further with your new setup!
Popular posts from this blog
Comments
Post a Comment