How can I run an OpenGL application installed on a linux machine from my windows machine? - linux

In the spirit of being helpful, this is a problem I had and solved, so I will answer the question here.
Problem
I have:
An application that has to be installed on on Redhat or SuSE enterprise.
It has huge system requirements and requires OpenGL.
It is part of a suite of tools that need to operate together on one machine.
This application is used for a time intensive task in terms of man hours.
I don't want to sit in the server room working on this application.
So, the question came up... how do I run this application from a remote windows machine?
I'll outline my solution. Feel free to comment on alternatives. This solution should work for simpler environments as well. My case is somewhat extreme.

Solution
I installed two pieces of software:
PuTTY
XMing-mesa The mesa part is important.
PuTTY configuration
Connection->Seconds Between Keepalives: 30
Connection->Enable TCP Keepalives: Yes
Connection->SSH->X11->Enable X11 forwarding: Yes
Connection->SSH->X11->X display location: localhost:0:0
Lauching
Run Xming which will put simply start a process and put an icon in your system tray.
Launch putty, pointing to your linux box, with the above configuration.
Run program
Hopefully, Success!

If you want the OpenGL rendering to be performed on your local machine, using a Windows X server, like Xming is a good solution. However, if you want rendering to be done on the remote end with just images sent to the local machine, you want a specialized VNC system that can handle remote OpenGL rendering, like VirtualGL.

You could also use VNC ( like cross platform remote desktop )
X is more efficent since it only sends draw commands rather than pixels, but if you are using opengl it is likely that most of the data is a rendered image anyway.
Another big advantage of VNC is that you can start the program locally on the server and then connect to it with VNC, drop the connection, reconnect from another machine etc without disturbing the main running program.

For OpenGL, running an X server is definitely a better solution. Just make sure the application is developed to be networked. It should NOT use immediate mode for rendering and textures should be RARELY transferred.
Why is X server a better solution in this case (as opposed to VNC)? Because you get acceleration on workstation, while VNC'ed solution is usually not even accelerated on the mainframe. So as long as data is buffered on the X server (using vertex arrays, vertex buffer objects, texture objects, etc) you should get much higher speed than using VNC, especially with complex scenes since VNC has to analyze, transfer and decode them as pixels.

If you need server glx version 1.2 the free version of Xming (Mesa 2007) works fine. But if your application needs version 1.4, example qt5, the X Server from Cygwin works free to run it use this commands:
[On server]
sudo vi /etc/ssh/ssh_config
Add:
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalHost no
AllowTcpForwarding yes
TCPKeepAlive yes
ClientAliveInterval 30
ClientAliveCountMax 10000
sudo vi ~/.bashrc
Add:
export DISPLAY=ip_from_remote:0
Now restart ssh server
[On Client slide]
Install Cygwin64 (with support to X package) after that run this command:
d:\cygwin64\bin\run.exe --quote /usr/bin/bash.exe -l -c "cd; /usr/bin/xinit /etc/X11/xinit/startxwinrc -- /usr/bin/XWin :0 -ac -multiwindow -listen tcp"
Now execute ssh client:
d:\cygwin64\bin\mintty.exe -i /Cygwin-Terminal.ico -e /usr/bin/ssh -Y user_name#ip_from_server

Related

Standalone program for accessing and developing in Linux in web browser

Is there any software working like this?
Runs as a standalone program. No install is needed. Thus, can be used as an Ansible module.
After running the program in a remote Linux machine, I can open up a web browser, then open a web page provided by the program. The program provides features similar to file explorer, IDE-level code editor, debugger, etc. In terms of debugger, there is already similar one; gdbgui.
There is another way such as Gnome, KDE or X11. However, these requires much packages to be installed. I don't want they be installed, because my Linux machines are kept to be small and secure.
You might consider having some terminal emulator running inside a browser. Such things exist, e.g. libonion has oterm as an example application. Then you can do all the things that a command line interface thru a unix shell provides (of course, you won't be able to run GUI applications, e.g. X11 clients such as GTK or Qt applications).
You could also consider some webmin like stuff.
Notice that you don't need to have a desktop environment on a remote Linux machine. Most of them (e.g. internet servers) have only command line interface.
Learn more about X11: you could have an X11 server on your laptop (e.g. under Windows if so needed) and run remotely X11 clients (that is GUI applications) with ssh -X on your remote Linux system.
However, these requires much packages to be installed. I don't want they be installed, because my Linux machines are kept to be small and secure.
I don't understand that requirement. On my VPS, running in some OVH datacenter, I do have X11 client applications (notably emacs). I don't believe that lowers the security of my system, and the disk space consumption for X11 applications and libraries is small enough these days. And of course I use standard commands (like cp(1), mv(1), rm(1), grep(1), find(1), less(1), file(1), sed(1) ....) to manage files. Any graphical file manager is useless (and I never use them, while using Unix since 1986)
You really should learn how to use the command line on Linux. It is incredibly powerful.

Installing a headless VNC server on Bananian?

I started this project with a Raspberry Pi, but realized that the Banana's hardware set is a much better fit for what I'm doing. Unfortunately, it appears that, even though LeMaker (the group behind the BPi) offers just about every OS imaginable pre-optimized for the Banana, only Bananian supports all the hardware that I need, and it doesn't come with a GUI of any kind.
So, given a Debian-derivative on an ARM chip that will never see a physical display and has root SSH functional by default, how can I make it boot to an auto-logged-in VNC server?
Here's what I've done so far, as root over SSH:
# bananian-config
# bananian-update
# apt-get update
# apt-get upgrade
# adduser pi
# passwd root
# apt-get install task-lxde-desktop
(the first two are announced in the SSH welcome message and are used to initially setup the generic image for this variation of the board)
Then I uncommented these lines in /etc/lightdm/lightdm.conf:
autologin-user=pi
autologin-user-timeout=0
[VNCServer]
enabled=true
command=Xvnc
port=5900
width=1024
height=768
depth=8
At this point, I rebooted and tried to connect with VNC, but the client gave the same error as when the server doesn't exist. SSH still works as root and now the "pi" user also, except that the "pi" user doesn't know sudo.
At this point, I'm lost. I don't know if there's a desktop waiting for me on the HDMI plug or not, or whether I need an explicit VNC server like x11vnc or tightvnc, or if there's something else wrong.
This is all I've done so far. I can re-flash the image if needed; I want to make this part work before adding anything project-specific.
Okay, I noticed in LeMaker's own instructions to make Wifi work that they included Android and Lubuntu too, and that someone on their forum had made VNC work on Lubuntu. I didn't see before that some other OS's would support the WiFi chip.
So I switched to Lubuntu, which already has a working desktop, installed x11vnc per its instructions, and it basically just worked.
Then I backed up the SD card and spent all of Saturday trying different ways to make it a WiFi access point, which usually resulted in kicking myself out and restoring the backup to try again. And finally that works too. So I backed up the card again and now I can work on the real functionality.

Cloning display output via ssh

Is it possible to clone image from display via ssh? I want to see what is on my first laptop display from another laptop, but without any additional software like teamviewer or vnc.
The short answer is: Yes, but you may be unhappy with the results.
The protocol you are looking for is called X11 Forwarding. This option must be enabled on your server by setting X11Forwarding yes in /etc/ssh/sshd_config, then reloading the daemon.
Once enabled on the server, the client must initiate their ssh session using the -x flag.
The major limitations of this technology are that:
The data is not optimized for transfer over the wire. For most environments you end up with a low framerate and/or graphical artifacts. As long as you're doing something like running a GUI installer it should not be a problem, but do not expect to be able to stream video / play a game using X11 forwarding.
The client must have an X server installed. If you are connecting from a Windows machine (or another machine that does not have an X server installed), you may need to use a project such as Xming in order to actually interpret the data once you get it to the client.

X session, but only remote

I would like to setup a small computer (Raspberry Pi) running Arch Linux to accept remote X sessions. Doing this usually means setting up Xorg server and running one of the Display Managers. I have done this before, and I will go this route if I have to. However, since the machine is very underpowered, and it is actually not connected to a physical monitor, I was hoping to setup the X server to accept only remote sessions. This way no memory would be wasted on managing the local graphics card, video memory etc, since they are not being used. Is it possible to setup the X server to accept only remote sessions without going into local graphical mode? And how?
It's possible to set up a *ix to remote display to a system you're sitting in front of, without an X server on the machine running the app.
You need X11 libraries, one or more X11 applications, and you probably want openssh set up for remote X11 forwarding - all on the raspberry pi. You'll also want an X server running on the machine you're sitting in front of.
On the Raspberry Pi, change your sshd_config to include "X11Forwarding yes". After making this change, restart sshd or reboot.
Then apt-get or yum your X11 libraries and app(s).
When you connect to the Raspberry Pi machine, use "ssh -Y" instead of just ssh to pass along xauth data.
Good luck!
Disable automatic start of the login manager and X server, instructions are googlable, say http://www.debianadmin.com/howto-boot-debian-in-text-mode-instead-of-graphical-mode-gui.html. From personal experience running X apps on raspberry remotely is not too good either.

How do I get a Remote Desktop for Linux (XDMCP, VNC)

I do this all the time using VNC and it is very easy, but I am curious about a few things like XDMCP. As I understand it, this is a way of creating the entire desktop on a remote X-Server which seems fairly elegant.
Several years ago, I worked on a Solaris server and multiple developers had X-Servers running in Windows and we were able to access a full remote X-desktop. All my efforts so far in X based systems seem to indicate that only one instance, remote or local, of the desktop can be loaded, so I guess this Solaris thing was an actual application that "emulated" a desktop, but who knows....
Any input ?
From Windows I've found the best way to do this is using the Xwin command in cygwin.
Steps:
Install Cygwin, making sure to install X11. (Do this by scrolling to the bottom of the list on the "select packages" screen and click on the word "default" to the right of "X11". Give it a second or two and it will change to "install".)
Then, just run the Xwin command like this:
Xwin -query your.unix.system.name
You'll get a full-screen login window from you unix box. That's it!
Btw, sometimes firewalls get in the way of the UDP protocol for XDMCP. If that happens, look up the port numbers (one UDP outgoing, and one TCP incomming) and unblock them. Other xdmcp troubleshooting tips here.
NX will allow you to use a complete remote desktop environment locally, and most Linux distros already have the server available.
As an alternative to full cygwin install you might want to look at Xming. It is quite a bit lighter and should provide the same functionality.
In Xorg/GDM/LightDM options : "listen" should be activated (disabled by default)
In windows, try Xwin32.
In Linux, try Xnest (windowed) or X with "-query" command.
Be careful: it's slow and everything (passwords included) is transmitted in clear. So keep it on local network, tunnel it in SSH or better don't use it.
I found an additional remote desktop implementation which works quite nicely with LXDE:
x2go
Has clients for Windows, Linux and MacOS X.

Resources