Remote display (operation) server GUI (graphical interface) (based on X11 Forwarding + Centos + MobaXterm), centosmobaxterm

Source: Internet
Author: User

Remote display (operation) server GUI (graphical interface) (based on X11 Forwarding + Centos + MobaXterm), centosmobaxterm

When doing data analysis (data mining or machine learning), we often need to draw statistical charts. These statistical and drawing programs often run on servers, however, for the sake of performance and efficiency, the server usually does not have a graphical interface installed, so these statistical and drawing programs cannot run on the server, or they cannot be directly displayed, this is embarrassing! Here, Dr. mi teaches you how to remotely display the graphical interface (GUI program) on the server through MobaXterm and X11 Forwarding ).

I. Principles

1. X protocol

Linux itself does not have a graphical interface. The so-called graphical interface system only contains Linux applications. This is different from Windows. Since Windows 95, the GUI has been directly implemented in the system kernel and is an indispensable part of the operating system. The graphical interface of Linux is based on the X protocol at the underlying layer.

The X protocol consists of X server and X client:

  • X server manages display-related hardware settings (such as graphics card, hard disk, and mouse) on the host. It is responsible for drawing and Displaying Screen images and setting input (such as keyboard and mouse) X client.
  • X client (that is, X application) is mainly responsible for event processing (that is, Program Logic ).

For example, if you click the left mouse button, because the mouse is managed by X server, X server captures the mouse click action and then tells X client about the action, because the X client is responsible for the program logic, the X client tells the X server according to the pre-defined logic (for example, drawing a circle): "Please click the mouse, draw a circle ". Finally, the X server responds to the request of the X client and draws and displays a circle at the place where the mouse clicks.

2. X11 Forwarding

What is the significance of this round? Of course!

In many cases, X server and X client are on the same host. However, X server and X client can run on different machines as long as they communicate with each other through the X protocol. As a result, we can do some "magic" things, such as the GUI program running on the server (X client) displayed locally (X server) As mentioned at the beginning of this article ). This operation can be implemented through SSH X11 Forwarding (Forwarding.

X in X11 refers to the X protocol, and 11 refers to the 11th versions using the X protocol.

3. MobaXterm

What is MobaXterm? MobaXterm is an open-source, free, and full-featured terminal software. It is similar to PuTTY, but it is much more powerful than PuTTY. One of the most practical functions is that MobaXterm comes with X Server. In this way, we don't have to worry about how to start X server on Windows.

Summary: The entire implementation logic is:

The local machine uses MobaXterm (with X server) to connect to the remote server. Then, run the GUI Program (X client) on the server and forward it to the local machine (Windows machine) through SSH X11 Forwarding ).

Ii. Practice

1. Server Side

Install X11 Forwarding Software

1 sudo yum install xorg-x11-xauth xorg-x11-fonts-* xorg-x11-font-utils xorg-x11-fonts-Type1 xclock

Enable X11 Forwarding

1 sudo vim /etc/ssh/sshd_config

Remove the # Before X11Forwarding and X11UseLocalhost, and set X11Forwarding to yes and X11UseLocalhost to no.

1 #AllowAgentForwarding yes2 #AllowTcpForwarding yes3 #GatewayPorts no4 X11Forwarding yes5 #X11DisplayOffset 106 X11UseLocalhost no

Restart sshd service

1 sudo systemctl restart sshd.service

2. Local (Windows)

Download and install MobaXterm

Https://pan.baidu.com/s/1eS5xdYU

Connect to the server remotely

Note that both X11-forwarding and DISPLAY are marked with a green check, indicating that the setting is successful.

3. Verify

Run a GUI program on the server, such

1 xclock

At this time, you can see the corresponding graphical interface (window) on the local (Windows)

[Original article] simplified/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.