Xming是一个在Microsoft Windows操作系统上运行X Window System(也常称为X11或X X的工作站)的自由软件,可用于在Windows运行Linux的程序(需要在本地Windows上运行一个X Server,即是本程序)。
Linux 以及各种Unix like的操作系统现在都用基于X Window图形界面。但是由于体积臃肿导致在Linux运行3D游戏十分困难。但是得益于其接口良好、扩展性和可移植性优秀的特点(重要的是具有网络透 明性),利用它可以很方便的远程启动Linux的图形程序。
下载地址:
https://sourceforge.net/projects/xming/
或者http://www.straightrunning.com/XmingNotes/
Xming 用OpenGL展示界面
Xming-fonts 标准X字体,部分传统的X应用的显示也需要这些字体
Xming-mesa 用更慢的Mesa展示界面, 有时X转发会更好
Xming-portable-PuTTY 提供X界面转发ssh程序
Xming-tools-and-clients 提供一些X应用专用的工具
Putty: http://www.putty.org/
1)保证Linux server中 /etc/ssh/sshd_config
X11Forwarding yes
2)Putty中X11 forwarding:
Putty Configuration–>Preffered SSH protocal version->SSH版本是2.
Connection–>SSH–>X11–>Enable X11 forwarding, X display location填上localhost:0, 下面的协议选择MIT-Magic-Cookie-1.
3)windows下起linux下的图形界面
启动Xming,”Display number”中的数字, 使用默认的0.
使用Putty连接Linux server,在putty终端下运行
set DISPLAY=10.160.13.229:0(注意:这里IP是Xming安装程序所在的主机的IP地址,即:X Server的IP地址,这里就是你的windows的地址,X Client是linux 服务器)
(DISPLAY 环境变量格式如下hostname: displaynumber.screennumber,我们需要知道,在某些机器上,可能有多个显示设备共享使用同一套输入设备,例如在一台PC上连接 两台CRT显示器,但是它们只共享使用一个键盘和一个鼠标。这一组显示设备就拥有一个共同的displaynumber,而这组显示设备中的每个单独的设 备则拥有自己单独的 screennumber。displaynumber和screennumber都是从零开始的数字。这样,对于我们普通用户来说, displaynumber、screennumber就都是0。
hostname指Xserver所在的主机主机名或者ip地址, 图形将显示在这一机器上, 可以是启动了图形界面的Linux/Unix机器, 也可以是安装了Exceed, X-Deep/32等Windows平台运行的Xserver的Windows机器.如果Host为空, 则表示Xserver运行于本机, 并且图形程序(Xclient)使用unix socket方式连接到Xserver, 而不是TCP方式.
使用TCP方式连接时, displaynumber为连接的端口减去6000的值, 如果displaynumber为0, 则表示连接到6000端口;
使用unix socket方式连接时则表示连接的unix socket的路径,如果displaynumber为0, 则表示连接到/tmp/.X11-unix/X0 .
creennumber则几乎总是0. )
然后运行gvim,发现linux下的gvim显示在你的windows桌面上了。
如果出现:
Xlib: connection to “10.160.13.229:0.0” refused by server Xlib: No protocol specified
在右下角点击Xming server的view log,发现有如下消息
AUDIT: … Xming: client 4 rejected from IP 10.160.23.18
这个10.160.23.18正是linux server的地址
解决办法:
右键桌面上的Xming图标,修改Xming的命令,取消权限控制,使用-ac选项:
C:\Program Files\XMing\Xming.exe :0 -clipboard -multiwindow -ac
然后启动Xming,发现可以在windows下显示linux的图形界面了。。
My solution step by step:
1) login with option -X remote host login root
ssh -X root@192.168.1.39
2) check if existing .Xauthority file
[root@localhost ~]# ls -al
[root@localhost ~]# vim .Xauthority
3) copy .Xauthority file to directory the other user
[root@localhost ~]# cp .Xauthority /home/oracle/
cp: overwrite `/home/oracle/.Xauthority’? y
4) set permissions for this file
[root@localhost ~]# chown oracle:oinstall .Xauthority
[root@localhost ~]# chmod 0600 .Xauthority
5) login oracle user
[root@localhost ~]# su - oracle
6) display setting in localhost:10.0
[oracle@localhost ~]
ssh -X root@192.168.1.39 2) check if existing .Xauthority file [root@localhost ~]# ls -al [root@localhost ~]# vim .Xauthority 3) copy .Xauthority file to directory the other user [root@localhost ~]# cp .Xauthority /home/oracle/ cp: overwrite `/home/oracle/.Xauthority’? y 4) set permissions for this file [root@localhost ~]# chown oracle:oinstall .Xauthority [root@localhost ~]# chmod 0600 .Xauthority 5) login oracle user [root@localhost ~]# su - oracle 6) display setting in localhost:10.0 [oracle@localhost ~]
echo
DISPLAYlocalhost:10.0[oracle@localhost ]
D
I
S
P
L
A
Y
l
o
c
a
l
h
o
s
t
:
10.0
[
o
r
a
c
l
e
@
l
o
c
a
l
h
o
s
t
]
ls -al
7) lists xauth cookies existing
[oracle@localhost ~]
xauthlistlocalhost.localdomain/unix:11MIT−MAGIC−COOKIE−1310f1b02c1080e73059391c193a1881blocalhost.localdomain/unix:10MIT−MAGIC−COOKIE−141843db100830a2aa352641ac47bb7598)adding[oracle@localhost ]
x
a
u
t
h
l
i
s
t
l
o
c
a
l
h
o
s
t
.
l
o
c
a
l
d
o
m
a
i
n
/
u
n
i
x
:
11
M
I
T
−
M
A
G
I
C
−
C
O
O
K
I
E
−
1
310
f
1
b
02
c
1080
e
73059391
c
193
a
1881
b
l
o
c
a
l
h
o
s
t
.
l
o
c
a
l
d
o
m
a
i
n
/
u
n
i
x
:
10
M
I
T
−
M
A
G
I
C
−
C
O
O
K
I
E
−
1
41843
d
b
100830
a
2
a
a
352641
a
c
47
b
b
759
8
)
a
d
d
i
n
g
[
o
r
a
c
l
e
@
l
o
c
a
l
h
o
s
t
]
xauth add localhost.localdomain/unix:10 MIT-MAGIC-COOKIE-1 41843db100830a2aa352641ac47bb75
9) test
[oracle@localhost ~]$ xclock
Hope they serve! @wcaraza