How to forward a Program Display from a Remote Linux Server using X11

Introduction

Software is usually installed via command-line tools. It can be automated, scheduled, and repeated with minimal effort. However, for quick testing and demo purposing, or when you are new to some products, you might prefer discovering the new options using a graphical interface. For example, when installing Oracle Grid Infrastructure, Oracle Database, or Oracle Database Client. Tip: when you need an Oracle Database and quickly get started, just provision one on Oracle Cloud, fully automated.

This blog post provides a step-by-step guide on enabling X11 on your Linux server and forwarding the program display to your local Windows machine.

The Environment

  • Oracle Linux VM on Oracle Cloud.
  • Local Windows machine with PuTTY as SSH client and Xming as X Window server.

Preparation

Step 1: Install PuTTY and Xming

Download and install PuTTY and Xming on your local Windows machine.

Step 2: Install the required packages on the Linux server

On your Linux server, install the xorg-x11-xauth package:

sudo yum install xorg-x11-xauth -y

Step 3: Configure X11 forwarding on the Linux server

On your Linux server, make sure that /etc/ssh/sshd_config file contains the following option:

sudo vi /etc/ssh/sshd_config
...
X11Forwarding yes
...

If you made changes to the sshd_config file, restart the sshd service:

sudo systemctl stop sshd.service
sudo systemctl start sshd.service
sudo systemctl enable sshd.service

Connection

Step 4: Configure and start Xming

Configure and start Xming via the provided XLaunch utility. Search for the XLunch application and start it. Keep the defaults, click Next, then Finish:

Step 5: Establish an SSH connection via PuTTY

In your PuTTY session, enable the X11 forwarding checkbox and establish the connection:

Step 6: Test display forwarding

To test the display forwarding, install and start the xclock application:

sudo yum install xclock -y
xclock

The clock graphical application will be shown on your Windows machine:

Xming will show the currently 1 client connected.

Troubleshooting

If you are still getting the “Can’t open display” error message. Restart your PuTTY session. When the session opens, you might see the “file /home/opc/.Xauthority does not exist” message. Nevertheless, display forwarding will work now. The message does not appear anymore when you start a new session again.