How to Access an Ubuntu Server GUI on GCP Using Windows 10 RDP
In this tutorial, you'll learn how to create an Ubuntu instance on Google Cloud Platform (GCP), install a desktop environment with XRDP, set up your user credentials, and connect using Windows 10 Remote Desktop.
Step 1: Create a Compute Engine Instance
1. Log into the [Google Cloud Platform Console](https://console.cloud.google.com/).
2. Navigate to **Compute Engine** → **VM instances** and click **Create Instance**.
3. Configure:
- **Name:** Choose a name for your VM.
- **Region/Zone:** Select your preferred location.
- **Machine Type:** Default is fine for testing.
- **Boot Disk:** Click **Change**, select **Ubuntu 20.04 LTS** (or your preferred Ubuntu version), and click **Select**.
4. Under **Firewall**, enable HTTP/HTTPS if required.
5. Click **Create**.
Step 2: Connect via SSH and Update Your System
1. In the VM instances list, click the **SSH** button next to your instance.
2. Run the following commands to update your system:
sudo apt-get update
sudo apt-get upgrade -y
Step 3: Install a Desktop Environment (XFCE)
Since Ubuntu servers do not include a GUI, install the lightweight XFCE desktop:
sudo apt-get install -y xfce4 xfce4-goodies
Set XFCE as the default session:
echo xfce4-session > ~/.xsession
Step 4: Install and Configure XRDP
Install XRDP to enable Remote Desktop connections:
sudo apt-get install -y xrdp
Enable and restart XRDP:
sudo systemctl enable xrdp
sudo systemctl restart xrdp
Step 5: Set Your Username and Password
Option 1: Set a Password for Your Existing User
1. Check your current username:
whoami
2. Set or update the password for your user:
sudo passwd your_username
Replace `your_username` with the name obtained from `whoami`.
Option 2: Create a New User
1. Create a new user:
sudo adduser new_username
2. Follow the prompts to set the password and fill in user details.
Step 6: Configure the Firewall for RDP
Allow inbound traffic on TCP port 3389.
1. In the GCP Console, go to **VPC Network** → **Firewall Rules**.
2. Click **Create Firewall Rule** and configure:
- **Name:** allow-xrdp
- **Targets:** All instances (or restrict with network tags if needed)
- **Source IP ranges:** 0.0.0.0/0 (or a specific IP range for better security)
- **Protocols and ports:** Check "Specified protocols and ports," select **tcp**, and enter `3389`
3. Click **Create**.
Step 7: Connect via Windows 10 RDP
1. Note the external IP address of your instance from the Compute Engine list.
2. Open **Remote Desktop Connection** on your Windows 10 PC.
3. Enter the external IP and click **Connect**.
4. When prompted, log in using your Ubuntu username and the password you set.
5. Accept any certificate warnings, and you should see the XFCE desktop environment.
Conclusion
Following these steps, your Ubuntu VM on GCP is now configured with a desktop environment accessible via Windows 10 RDP. Enjoy your fully graphical remote session!
Comments
Post a Comment