在 Mac OS X (Snow Leopard) 和 Ubuntu 10.10 之间使用 Xnest

发布于 2024-10-31 19:37:06 字数 792 浏览 4 评论 0 原文

我刚刚在系统上安装了 Ubuntu 10.10 桌面来进行一些开发工作。我想在我的 MacBook 上运行 X 服务器环境,而不是键盘跳跃(Ubuntu 盒子上的图形系统不是很好)。

在网上浏览后,我发现了可以从 Mac OS X 终端运行的以下命令:

/usr/X11/bin/Xnest -geometry 1280x900 :1 & DISPLAY=:1 ssh -X -Y grog@ubuntusys gnome-session

注意,我已经设置了 ssh,因此身份验证会自动进行。

这看起来效果很好——Ubuntu 桌面出现在我的 Mac OS X 屏幕上! (如果 X11 尚未运行,它似乎足够聪明,可以启动它)。但是,如果我尝试打开任何程序,它就会消失。这么近。

任何建议表示赞赏。

更新:感谢下面的答案提供了教程链接,我学会了如何进行基本的 X 转发。您可以从 Mac 上的 X 终端窗口执行此操作,如下所示:

ssh -X -Y username@targetsystem

然后您可以启动在远程系统上运行的 X 应用程序,但它们的窗口位于 Mac X 服务器上。我现在遇到的问题是我想启动 gnome 桌面会话:

gnome-session

但问题是该会话接管了整个 Mac 桌面。您无法调整其大小或移动它。更糟糕的是,由窗口管理器管理的窗口顶部最终位于 Mac OS 放置的菜单栏下方,因此您无法访问这些控件。我认为这是 Xnest 旨在解决的问题,还是我误解了它的含义?

I just installed an Ubuntu 10.10 desktop on a system to do some development work. I would like to run the X server environment on my MacBook instead of keyboard hopping (the graphics system on the Ubuntu box is not so great).

Poking around on the web I uncovered the following command that I can run from a terminal in Mac OS X:

/usr/X11/bin/Xnest -geometry 1280x900 :1 & DISPLAY=:1 ssh -X -Y grog@ubuntusys gnome-session

Note I have ssh set up so authentication happens automatically.

This seems to work great -- the Ubuntu desktop appears on my Mac OS X screen! (It seems to be smart enough to start X11 if it isn't running already). However if I try to open any program, it dies out. So close.

Any suggestions appreciated.

Update: Thanks to the answer below that provides a tutorial link I learned how to do basic X forwarding. You can do this from an X terminal window on the Mac simply like this:

ssh -X -Y username@targetsystem

then you can start X applications that run on the remote system but their windows are on the Mac X server. The issue that I now have is I want to start the gnome desktop session:

gnome-session

but the problem there is that the session takes over the whole Mac desktop. You cannot resize it or move it. Worse, the top part of the windows managed by the window manager end up underneath the menu bar that Mac OS puts up there so you cannot access those controls. I think this is a problem that Xnest was intended to solve, or am I misunderstanding what it is all about?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

乖乖公主 2024-11-07 19:37:06

在 Mac OS X 上以这种方式使用 Xnest 或 Xephyr:

Xnest :1 -geometry 1280x800 -query 10.0.1.x

Xephyr :1 -screen 1280x1024 -query 192.168.1.x

您唯一需要做的就是启用远程登录在 Linux 中,通过手动编辑 /etc/gdm/custom.cfg 或使用 gdmsetup GUI 程序。这里以CentOS 5为例。在 Ubuntu 中情况会有些不同。

这种方法与 VNC 非常不同,VNC 就像 Microsoft 的 RDP(屏幕捕获),而 XDMCP 利用 Mac 的图形功能来辅助 Linux 系统。

请记住,X11 专门设计用于通过网络连接而不是在集成或附加的显示设备上使用。 X 具有网络透明性:运行应用程序(客户端应用程序,例如 Linux 上的 Firefox)的计算机可能与用户的本地计算机(显示服务器,即 Mac 上的 X11)不同。这种方法允许在用户的本地 X 服务器上充分加速 2D 和 3D 操作。

Use Xnest or Xephyr this way on your Mac OS X:

Xnest :1 -geometry 1280x800 -query 10.0.1.x

Xephyr :1 -screen 1280x1024 -query 192.168.1.x

The only thing you have to do is to enable remote login in your Linux by manually editing /etc/gdm/custom.cfg or using the gdmsetup GUI program. Here CentOS 5 is taken as an example. In Ubuntu things will be a little differrent.

This approach is very different to VNC which is like Microsoft's RDP (screen capture) while XDMCP utilizes the graphic power of your Mac to assist Linux system.

Remember that X11 was specifically designed to be used over network connections rather than on an integral or attached display device. X features network transparency: the machine where an application (the client application, for instance Firefox on Linux) runs can differ from the user's local machine (the display server, that is the X11 on your Mac). This approach allows both 2D and 3D operations to be fully accelerated on the user's local X server.

梦开始←不甜 2024-11-07 19:37:06

根据您运行的 OSX 版本,最好的选择可能是本机 Mac X11 发行版。它位于安装 CD 上(或者,如果您像我一样通过 App Store 获得了 Lion,则默认情况下可以在“实用程序”文件夹中找到它)。

启动它(应用程序 > 实用程序 > X11)会显示一个特定的 X11 x 终端,您可以使用它来 ssh 转发到您的 Ubuntu 系统。答案 1 中的链接相当旧,我发现这个链接更有帮助: http://www.craigryder.com/linux-ubuntudebetc/x11-forwarding-and-ssh-for-remote-linux-ubuntu-desktop/

我使用的唯一额外选项是-C 标志,用于在运行 ssh 命令时启用压缩。请注意,您不必运行完整的 gnome 会话来使用 X 功能 - 您只需运行您想要的程序(即 $ gedit&)。这可以让你不再使用整个桌面,但这有点奇怪,因为你的 Mac 桌面仍然会变黑。您可以找到有关此技术的更多信息 @ http://ubuntuforums.org/showthread.php ?t=1373823&page=2

我还注意到,在 10.10 Ubuntu 上,我的系统显示了您提到的相同奇怪的 UI 控制行为,但当我将我的发行版升级到 Ubuntu 11。我并没有真正深入了解是否简单地将 X 升级到 10.10 Ubuntu 系统上的最新版本就可以解决该问题,但我可以确认它不会出现在 11 中。

最后一个请注意,这似乎仍然强制 Mac X11 服务器进入全屏模式,但是如果您按 COMMAND-ALT-A,它会立即带您离开 X 桌面并返回到 Lion 桌面,这使我可以同时运行和运行当我仍然富有成效时需要跳出我的Ubuntu系统。我似乎总是能够访问所有 X 应用程序的所有标题和菜单栏,就像我坐在 Ubuntu 桌面上一样。

需要注意的是 - 我正在运行上述命令来连接到我的工作站上运行 Ubuntu(启用了 3D 加速)的 VMWare Workstation VM - 连接到实际硬件可能(尽管我无法理解如何)导致略有不同的行为。

希望这有帮助!

Depending on which version of OSX you're running, the best bet is probably the native Mac X11 Distribution. It's on the install CD (or if you're like me you got Lion through the App Store, it is available in the Utilities folder by default).

Launching it (Applications > Utilities > X11) brings up a specific X11 x-terminal, which you can use to ssh forward over to your Ubuntu system. That link in Answer 1 is pretty old, I found this one to be more helpful: http://www.craigryder.com/linux-ubuntudebetc/x11-forwarding-and-ssh-for-remote-linux-ubuntu-desktop/

The only extra option I use is the -C flag to enable compression when I run my ssh command. Please note that you do NOT have to run a full gnome-session to use the X features - you can simply run the program you want (ie, $ gedit&). This gets you out of using the whole desktop, but it is kind of weird since your Mac desktop still gets blacked out. You can find more on this technique @ http://ubuntuforums.org/showthread.php?t=1373823&page=2

I also noticed that on 10.10 Ubuntu, my system showed the same odd UI control behaviors you mention, but those disappeared when I upgraded my distribution to Ubuntu 11. I didn't really go to deep to see if simply upgrading X to the latest version on the 10.10 Ubuntu system would have fixed that issue, but I can confirm that it does not appear in 11.

One final note, this still seems to force the Mac X11 server into Full-Screen mode, but if you press COMMAND-ALT-A it immediately takes you out of the X desktop and back into your Lion desktop, which allows me to have both running and still be productive when I need to jump out of my Ubuntu system. I seem to be able to always access all the title and menu bars for all of my X apps just as though I was sitting at the Ubuntu desktop.

One caveat - I'm running the above to connect to a VMWare Workstation VM running Ubuntu (with 3D acceleration enabled) on my workstation - connecting to actual hardware may (though I can't fathom how) result in slightly different behavior.

Hope this helped!

终弃我 2024-11-07 19:37:06

VNC 不适合您吗?
或者通过 SSH 进行常规 X 转发。

Is VNC not working for you?
Or regular X forwarding over SSH.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文