CentOS 通过ssh x11 forwarding远程执行GUI程序:
一、服务器端的配置
1.1. 配置服务器的sshd
# vim /etc/ssh/sshd_config
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost ye
1.2、安装相关的依赖 ,重启sshd服务
# sudo yum install xorg-x11-xauth xorg-x11-fonts-* xorg-x11-font-utils xorg-x11-fonts-Type1 xclock
# service sshd restart
二、客户端配置
2.1、用putty+Xming完成远程执行GUI程序
2.1.1安装Xming
下载并安装Xming,地址:Xming - Download
2.1.2.配置Xming
通过XLaunch来完成启动,在托盘区会出现一个“X”形状的图标,这表示Xming已经在运行了,将鼠标悬停上去,能看到当前使用的“Display number”,默认是的0。
2.1.3.配置Putty
运行PuTTY,在配置界面,选择“Connection->SSh->X11”,选中“Enable X11forwarding”,“X display location”中填上上一步中“Display number”中的数字(此处就是“localhost:0”)。
连接登录远程主机后,运行命令xclock,弹出一个图形界面的时钟表示能正常执行GUI程序。
2.2、用MobaXterm 完成远程执行GUI程序
2.2.1下载并安装 MobaXterm
https://pan.baidu.com/s/1eS5xdYU
2.2.2远程连接服务器
"X11-forwarding" 和" DISPLAY" 两项都打上了绿色的勾,表示设置成功了。
连接登录远程主机后,运行命令xclock,弹出一个图形界面的时钟表示能正常执行GUI程序
三、其他问题
问题1:出现
“Failed to launch bus: Failed to connect to session busprocess 2182: D-Bus librar y appears to be incorrectly set up; failed to read machine uuid: Failed to open "/var/lib/dbus/machine-id": No such file or directory
See the manual page for dbus-uuidgen to correct this issue.
D-Bus not built with -rdynamic so unable to print a backtrace
Redirecting call to abort() to mozalloc_abort”的问题
解决方法:
# yum install dbus-x11
# dbus-uuidgen >/var/lib/dbus/machine-id