There is no need for installing XVNC server on your server or installing desktop environment in case someone need GUI for installing some applications like Oracle DB or some web application.
You can use SSH X11 forwarding to GUI stuff.
Packages are:
xorg-x11-xauth
xorg-x11-fonts-*
xorg-x11-utils
It is wise to install and xorg-x11-utils because it provides xclock, simple GUI clock that can be test if you SSH X11 forwarding is working.
So:
yum install xorg-x11-xauth xorg-x11-fonts-* xorg-x11-util
#:cat /etc/ssh/sshd_config |grep X11FoX11Forwarding yes
I have to be yes if you want this to work.
After all this is set, you can start your SSH X11 forwarding session!
You can use SSH X11 forwarding to GUI stuff.
What is SSH X11 forwarding?
First you need to know what X11 is. Simple said - X11 is GUI. What is SSH? SSH is short from Secure SHell. You can connect to server with SSH sessions by using putty or some other program.
SSH session is very "light" and it is used for CLI access to server.
SSH X11 forwarding will enable GUI through SSH session. Meaning? You use GUI environment of your client machine to do work on server that needs to be done from GUI!
Why is this probably better then installing complete GUI environment on your server? Because, GUI environment can be pretty big and depending on your server resources can consumed much needed CPU or memory.
Why is this probably better then installing complete GUI environment on your server? Because, GUI environment can be pretty big and depending on your server resources can consumed much needed CPU or memory.
Check list for enabling SSH X11 forwarding
To enable X11 forwarding you do need to install few packages and make some configuration adjustments!Step 1 - enabling SSH X11 forwarding
Because I am doing this on RHEL 7.4, names of packages may slightly differ.Packages are:
xorg-x11-xauth
xorg-x11-fonts-*
xorg-x11-utils
It is wise to install and xorg-x11-utils because it provides xclock, simple GUI clock that can be test if you SSH X11 forwarding is working.
So:
yum install xorg-x11-xauth xorg-x11-fonts-* xorg-x11-util
Step 2 - enabling SSH X11 forwarding
Check if X11 forwarding is enabled. This is checked in SSH server configuration file#:cat /etc/ssh/sshd_config |grep X11FoX11Forwarding yes
I have to be yes if you want this to work.
Step 3 - enabling SSH X11 forwarding
This step is needed for RHEL 7.X, Centos 7.X.
In sshd_config file there is parameter named AdressFamily. This parameter is by default set to any.
cat /etc/ssh/sshd_config |grep any
#AddressFamily any
#AddressFamily any
Even do this parameter is commented, it is active because, default value is any. What does this mean anyway? Address Family is referred acceptance of connections from ipv4 or ipv6 networks. Any means it can be both but first is default value of OS. In older Linux distributions, default value any was referred to ipv4 address family. In newer distros such as RHEL 7.X or Centos 7.x, value any is referred to ipv6 adress family.
Funny thing is that if this parameter is set to any, you can connect to server with regular SSH session(no X11 forwarding) but if you connect to SSH with X11 forwarding enabled on your client, you will not be able to start X11 session. Your error will be
program you want to run Error: Can't open display:
In my case this is
# xclock
Error: Can't open display:
Error: Can't open display:
If you, did not set this right, your X11 SSH session will not have DISPLAY variable set. exit
No comments:
Post a Comment