X windows for Unix

https://www.ibm.com/developerworks/mydeveloperworks/blogs/paixperiences/entry/remotex11aix?lang=en

Forward GUI installer to Windows from Unix.

First download Cygwin or X Manager, and enable X11 fowwarding as below in PuTTY. Start X server.

[@more@]

Forward GUI installer to Windows from Unix.

First download Cygwin or X Manager, and enable X11 fowwarding as below in PuTTY. Start X server.

C:DOCUME~1ADMINI~1LOCALS~1Tempmsohtml11clip_image002.jpg

  1. Use putty to login to the server. Here is a issue incurred: after use my own account to log on, then sudo su – oracle, unable to start xclock, echo $DISPLAY also shows nothing. It’s OK if use account oracle to login directly.

bash-4.2$ echo $DISPLAY

localhost:10.0

bash-4.2$ xclock

We can use xclock to test the X windows.

C:DOCUME~1ADMINI~1LOCALS~1Tempmsohtml11clip_image004.jpg

Remote X11 Windows to AIX

UrbanBiel | Aug 2 2012 | Tags: cygwin aix xwindows x11 ssh | Comments (7) | Visits (5,007)

I love a command line. It's numerous advantages over GUI is hard to list, but there are situations, where you need a remote X Windows connection. I've been asked many times by my colleagues, how to set up remote X Windows (X11, as the most recent version of X Windows is 11) on AIX, why it doesn't work, etc.

Basic overview of X11 Windows architecture

X11 is a client / server architecture. You need to know two things:
  • an application e.g. xclock is an X11 client
  • the application's content is displayed by an X11 server

Anyway, some people are confused here: I'm connecting to an AIX server using ssh/telnet, thus my workstation is an ssh/telnet client. What do I have to run on my local machine: an X11 client or an X11 server? You obviously need to install and run an X11 server on your local workstation. If you run e.g. xclock on a remote machine (AIX), that's an X11 client.

Let's have a quick look at a connection between an X11 client and an X11 server. The connection can be a unix socket or TCP/IP. The socket is used, when the client and the server run on the same machine, which is not our case. Remote X Windows connection is using the TCP/IP. To tell the client, where the X11 server runs, you need to set up a DISPLAY environment variable. By default an X11 server listens on port 6000. You can have more X server instances, but that's out of the topic.

Your workstation

If you want to display a program on your local workstation, that is running on a remote AIX, you need to install and run an X server locally. If you run Linux on your workstation and you're reading this in a browser, you're done. On Windows there is a few X servers; some are commercial, some are free. Very popular is Xming, I use Cygwin.

A quick Cygwin howto:
  • Install Cygwin from www.cygwin.org
  • select at least the following extra packages: xorg-server xinit xauth xclock xterm xhost
  • Make an entry in your Startup folder: C:cygwinbinrun.exe /usr/bin/bash.exe -l -c /usr/bin/startxwin.exe
Start the X11 server from the Startup folder and from a Windows command line check, if it's listening for TCP/IP connection on port 6000:
C:UsersIBM_ADMIN>netstat -atn | findstr 6000
TCP 0.0.0.0:6000 0.0.0.0:0 LISTENING InHost
TCP [::]:6000 [::]:0 LISTENING InHost

If you see the output like this, you're done with your workstation.

Remote AIX server

An X Windows minimum installation includes filesets: X11.base.lib X11.base.rte X11.apps.config. I suggest to install X11.apps.clients too, that contains xclock program. By running this program I check the time, and of course the X11 setup. For an X11 client to run, it needs to establish TCP/IP connection to your X11 server. You can do this directly or you can tunnel the connection.

Direct X11 TCP/IP connection

The simplest scenario. It works, if there is no firewall blocking port 6000 to your workstation and there is no NAT. Try to ping your workstation from the AIX server, and if it works, try telnet to port 6000 to your workstation. If everything is fine, set the DISPLAY variable to an IP address of your workstation, for example export DISPLAY=192.168.0.100:0. On your workstation, allow the IP address of the AIX server to open an X11 session using xhost + <ip_address_of_the_aix_server>. Run xclock on AIX and enjoy.

SSH X11 port forwarding

This is the way professionals do it, as ssh is installed by default on AIX now. Advantages:

  • you do not care about network infrastructure, VPNs, NATs and firewalls between you and the target server. All you need is a working ssh connection
  • you do not care about DISPLAY anymore
  • X11 session is automatically authenticated
  • X11 session is automatically encrypted

On the AIX check, that ssh X11 forwarding requests are allowed:

# grep X11Forwarding /etc/ssh/sshd_config
X11Forwarding yes

If it's necessary, change the value and restart the ssh service. You can do it while you're logged in, your current ssh session will not be dropped. Keep in mind, that the ssh X11 forwarding will apply only to new ssh sessions, that are opened with X forwarding.

stopsrc –s sshd; sleep 2; startsrc –s sshd

Now set the X11 forwarding on your workstation. If you have an command line ssh client e.g. as part of Cygwin, run ssh -X <server_ip> to log in. If you use Putty, check that X11 forwarding is set for your session and don't forget to save the change. For other ssh clients check a documentation (or browse through all the session settings, as pros do....)

image

After you log in, check the DISPLAY and authentification value. If it is as on an example below, run xclock and enjoy.

# echo $DISPLAY
DISPLAY=localhost:10
# xauth list
server/unix:10 MIT-MAGIC-COOKIE-1 6299564796e4cf089e38619a354cfdcc
Note: If you open more ssh sessions to one host, with the X11 forwarding turned on, every session will have different offset number in the DISPLAY variable. The offset number is the one after a colon, e.g. 10 in the example above.

Issues

A few FAQ's I'm being asked

I run xclock, but it hangs out and does not display anything

  • Realy? An X11 windows can open underneath other windows. Check again.
  • A DISPLAY variable is not set or is set incorrectly. In this case it takes few minutes for an application to terminate.
  • An X11 server is not running on your local machine.

I use ssh the X11 forwarding, but the DISPLAY variable is not set

  • Check X11Forwarding directive in sshd_config
  • Check that ssh client has X11 forwarding option set
  • The AIX machine is missing xauth programm. Install X11.apps.config fileset.
  • There are some older OpenSSH or OpenSSL versions that are buggy. I have had issues with OpenSSH versions 4.6.X, OpenSSH_4.3p2, OpenSSL 0.9.7l 28
Normal0falsefalsefalseMicrosoftInternetExplorer4

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/14377/viewspace-1060346/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/14377/viewspace-1060346/

Windows 系统上实现 X Server 的主要方式是通过第三方软件,这些工具能够让 Windows 主机作为 X Window System 中的显示服务器,从而运行和显示来自远程主机(如 Unix/Linux)的图形化应用程序。常见的适用于 Windows 的 X Server 实现包括: ### 1. **Xming** Xming 是一个轻量级且广泛使用的 X Server 实现,专为 Windows 平台设计。它支持多种连接方式,包括通过 SSH 转发运行远程 Linux/Unix 上的 GUI 应用程序,并将其显示在 Windows 桌面上。Xming 免费供个人使用,适合开发人员和系统管理员。 示例启动方式(假设已安装 Xming 并配置好 SSH 客户端): ```bash ssh -X user@remote_host ``` 之后可在远程主机上运行图形应用,例如 `xterm` 或 `gedit`,它们将通过 Xming 显示在本地 Windows 屏幕上[^1]。 ### 2. **VcXsrv (X Server for Windows)** VcXsrv 是另一个流行的开源 X Server 实现,支持现代 Windows 系统(包括 Windows 10 和 Windows 11)。它提供多种配置选项,包括全屏模式、多显示器支持以及与 Windows 显示管理器的集成。VcXsrv 可通过简单的安装程序部署,并可通过命令行或图形界面进行配置。 启动 VcXsrv 后,设置环境变量以指向本地 X Server: ```bash set DISPLAY=localhost:0.0 ``` 然后即可在本地或远程运行 X11 应用程序,例如: ```bash xclock ``` ### 3. **Cygwin/X** Cygwin 提供了一个类 Unix 的运行环境,其组件中包含完整的 X Server 实现(即 Cygwin/X)。该方案适合需要完整 Unix-like 开发环境的用户,不仅支持 X11 图形应用程序的运行,还允许在 Windows 上编译和调试 X Client 程序。 安装 Cygwin 时需选择 `xorg-server` 和相关 X11 包,之后通过如下命令启动 X Server: ```bash startxwin & ``` 随后可运行 X Client 应用或将远程应用转发到本地窗口系统。 ### 4. **Xpra** Xpra 是一种“持久性”的 X Server 解决方案,支持断线重连功能,非常适合远程工作场景。它可以在 Windows 上作为服务运行,并允许多个客户端连接到同一个会话。Xpra 不仅支持传统的 X11 应用程序,还可以托管现代桌面应用并进行高效编码传输。 安装完成后,可以通过以下命令启动 Xpra 服务端: ```bash xpra start :10 --start-child=xterm ``` 客户端则通过: ```bash xpra attach tcp:localhost:10 ``` 来连接并查看运行中的 X 应用程序界面。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值