Difference between revisions of "VNC Access on headnode"
Jump to navigation
Jump to search
(Created page with "===== Install VNC ===== If you want to use vncviewer on the actual headnode, you need to install the pacakge '''vnc''' <syntaxhighlight> yum install vnc # on > centos 5.6, use vnc-serv...") |
|||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
| − | ===== | + | === Super Quick + Easy install === |
| + | <syntaxhighlight> | ||
| + | curl https://raw.githubusercontent.com/TurboVNC/repo/main/TurboVNC.repo > /etc/yum.repos.d/TurboVNC.repo | ||
| + | yum install turbovnc icewm xorg-x11-xauth xorg-x11-xkb-utils xkeyboard-config | ||
| + | |||
| + | [root@headnode ~]# cp /opt/TurboVNC/bin/xstartup.turbovnc /opt/TurboVNC/bin/xstartup.turbovnc.orig | ||
| + | [root@headnode ~]# cat <<EOF > /opt/TurboVNC/bin/xstartup.turbovnc | ||
| + | #!/bin/bash | ||
| + | [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup | ||
| + | [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources | ||
| + | sleep 1 | ||
| + | icewm-session | ||
| + | EOF | ||
| + | </syntaxhighlight> | ||
| + | ==== Modified xstartup for xfce ==== | ||
| + | <syntaxhighlight> | ||
| + | [root@headnode ~]# cat <<EOF > /opt/TurboVNC/bin/xstartup.turbovnc | ||
| + | #!/bin/sh | ||
| + | unset SESSION_MANAGER | ||
| + | unset DBUS_SESSION_BUS_ADDRESS | ||
| + | sleep 1 | ||
| + | xterm & | ||
| + | startxfce4 | ||
| + | EOF | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | == start turbovnc == | ||
| + | <syntaxhighlight> | ||
| + | [root@headnode ~]# /opt/TurboVNC/bin/vncserver | ||
| + | |||
| + | Desktop 'TurboVNC: headnode.cluster:1 (root)' started on display headnode.cluster:1 | ||
| + | |||
| + | Starting applications specified in /opt/TurboVNC/bin/xstartup.turbovnc | ||
| + | Log file is /root/.vnc/headnode.cluster:1.log | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | === check log for errors === | ||
| + | <syntaxhighlight> | ||
| + | [root@headnode ~]# cat /root/.vnc/headnode.cluster\:1.log | ||
| + | TurboVNC Server (Xvnc) 64-bit v3.1 (build 20231117) | ||
| + | Copyright (C) 1999-2023 The VirtualGL Project and many others (see README.md) | ||
| + | Visit http://www.TurboVNC.org for more information on TurboVNC | ||
| + | |||
| + | 18/12/2023 12:40:13 Using security configuration file /etc/turbovncserver-security.conf | ||
| + | 18/12/2023 12:40:13 Enabled security type 'tlsvnc' | ||
| + | 18/12/2023 12:40:13 Enabled security type 'tlsotp' | ||
| + | 18/12/2023 12:40:13 Enabled security type 'tlsplain' | ||
| + | 18/12/2023 12:40:13 Enabled security type 'x509vnc' | ||
| + | 18/12/2023 12:40:13 Enabled security type 'x509otp' | ||
| + | 18/12/2023 12:40:13 Enabled security type 'x509plain' | ||
| + | 18/12/2023 12:40:13 Enabled security type 'vnc' | ||
| + | 18/12/2023 12:40:13 Enabled security type 'otp' | ||
| + | 18/12/2023 12:40:13 Enabled security type 'unixlogin' | ||
| + | 18/12/2023 12:40:13 Enabled security type 'plain' | ||
| + | 18/12/2023 12:40:13 Desktop name 'TurboVNC: headnode.cluster:1 (root)' (headnode.cluster:1) | ||
| + | 18/12/2023 12:40:13 Protocol versions supported: 3.3, 3.7, 3.8, 3.7t, 3.8t | ||
| + | 18/12/2023 12:40:13 Listening for VNC connections on TCP port 5901 | ||
| + | 18/12/2023 12:40:13 Interface 0.0.0.0 | ||
| + | 18/12/2023 12:40:13 Framebuffer: BGRX 8/8/8/8 | ||
| + | 18/12/2023 12:40:13 New desktop size: 1240 x 900 | ||
| + | 18/12/2023 12:40:13 New screen layout: | ||
| + | 18/12/2023 12:40:13 0x00000040 (output 0x00000040): 1240x900+0+0 | ||
| + | 18/12/2023 12:40:13 Maximum clipboard transfer size: 1048576 bytes | ||
| + | 18/12/2023 12:40:13 VNC extension running! | ||
| + | /usr/bin/startxfce4: X server already running on display :1 | ||
| + | xterm: cannot load font '-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1' | ||
| + | generating cookie with syscall | ||
| + | generating cookie with syscall | ||
| + | generating cookie with syscall | ||
| + | generating cookie with syscall | ||
| + | gpg-agent[14440]: a gpg-agent is already running - not starting a new one | ||
| + | |||
| + | (xfce4-session:14413): xfce4-session-WARNING **: 12:40:16.137: gpg-agent returned no PID in the variables | ||
| + | |||
| + | (xfce4-session:14413): xfce4-session-WARNING **: 12:40:16.140: xfsm_manager_load_session: Something wrong with /root/.cache/sessions/xfce4-session-headnode.cluster:1, Does it exist? Permissions issue? | ||
| + | vmware-user: could not open /proc/fs/vmblock/dev | ||
| + | SELinux Troubleshooter: Applet requires SELinux be enabled to run. | ||
| + | W: [pulseaudio] main.c: This program is not intended to be run as root (unless --system is specified). | ||
| + | |||
| + | (xfsettingsd:14459): xfsettingsd-WARNING **: 12:40:16.472: Failed to get the _NET_NUMBER_OF_DESKTOPS property. | ||
| + | /usr/share/system-config-printer/applet.py:44: PyGIWarning: Notify was imported without specifying a version first. Use gi.require_version('Notify', '0.7') before import to ensure that the right version gets loaded. | ||
| + | from gi.repository import Notify | ||
| + | [root@headnode ~]# | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | it might look a bit unhappy but it still works perfectly | ||
| + | ==== if using tigervnc ==== | ||
| + | tigervnc is way slower but in the default repos so easier to install it requires a DIFFERENT xstartup in the older default path | ||
| + | |||
| + | <syntaxhighlight> | ||
| + | [root@headnode ~]# cat ~/.vnc/xstartup | ||
| + | #!/bin/sh | ||
| + | unset SESSION_MANAGER | ||
| + | unset DBUS_SESSION_BUS_ADDRESS | ||
| + | xsetroot -solid grey | ||
| + | autocutsel -fork | ||
| + | geometry 1240x900 | ||
| + | startxfce4 & | ||
| + | xterm & | ||
| + | </syntaxhighlight> | ||
| + | main difference is tigervnc expects the desktop to run in the background and turbovnc expects it to run in the foreground block the shell | ||
| + | === Install VNC === | ||
If you want to use vncviewer on the actual headnode, you need to install the pacakge '''vnc''' | If you want to use vncviewer on the actual headnode, you need to install the pacakge '''vnc''' | ||
<syntaxhighlight> | <syntaxhighlight> | ||
| + | # On centos 7 | ||
| + | sudo yum install tigervnc-server | ||
| + | |||
| + | #others | ||
| + | |||
yum install vnc | yum install vnc | ||
| Line 9: | Line 115: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| − | + | === Update Server config === | |
Edit the /etc/sysconfig/vncservers file | Edit the /etc/sysconfig/vncservers file | ||
| Line 19: | Line 125: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| − | + | === Set User Passwords === | |
For each user you've added, run vncserver to set a password: | For each user you've added, run vncserver to set a password: | ||
| Line 44: | Line 150: | ||
vncpasswd | vncpasswd | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| − | + | === Modify User XStartup File === | |
Edit the ~/.vnc/xstartup file for earch user | Edit the ~/.vnc/xstartup file for earch user | ||
| Line 63: | Line 169: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| − | + | === Restart the VNCServer === | |
kill off any vnc servers and restart the daemon | kill off any vnc servers and restart the daemon | ||
Latest revision as of 12:52, 18 December 2023
Super Quick + Easy install
curl https://raw.githubusercontent.com/TurboVNC/repo/main/TurboVNC.repo > /etc/yum.repos.d/TurboVNC.repo
yum install turbovnc icewm xorg-x11-xauth xorg-x11-xkb-utils xkeyboard-config
[root@headnode ~]# cp /opt/TurboVNC/bin/xstartup.turbovnc /opt/TurboVNC/bin/xstartup.turbovnc.orig
[root@headnode ~]# cat <<EOF > /opt/TurboVNC/bin/xstartup.turbovnc
#!/bin/bash
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
sleep 1
icewm-session
EOFModified xstartup for xfce
[root@headnode ~]# cat <<EOF > /opt/TurboVNC/bin/xstartup.turbovnc
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
sleep 1
xterm &
startxfce4
EOFstart turbovnc
[root@headnode ~]# /opt/TurboVNC/bin/vncserver
Desktop 'TurboVNC: headnode.cluster:1 (root)' started on display headnode.cluster:1
Starting applications specified in /opt/TurboVNC/bin/xstartup.turbovnc
Log file is /root/.vnc/headnode.cluster:1.logcheck log for errors
[root@headnode ~]# cat /root/.vnc/headnode.cluster\:1.log
TurboVNC Server (Xvnc) 64-bit v3.1 (build 20231117)
Copyright (C) 1999-2023 The VirtualGL Project and many others (see README.md)
Visit http://www.TurboVNC.org for more information on TurboVNC
18/12/2023 12:40:13 Using security configuration file /etc/turbovncserver-security.conf
18/12/2023 12:40:13 Enabled security type 'tlsvnc'
18/12/2023 12:40:13 Enabled security type 'tlsotp'
18/12/2023 12:40:13 Enabled security type 'tlsplain'
18/12/2023 12:40:13 Enabled security type 'x509vnc'
18/12/2023 12:40:13 Enabled security type 'x509otp'
18/12/2023 12:40:13 Enabled security type 'x509plain'
18/12/2023 12:40:13 Enabled security type 'vnc'
18/12/2023 12:40:13 Enabled security type 'otp'
18/12/2023 12:40:13 Enabled security type 'unixlogin'
18/12/2023 12:40:13 Enabled security type 'plain'
18/12/2023 12:40:13 Desktop name 'TurboVNC: headnode.cluster:1 (root)' (headnode.cluster:1)
18/12/2023 12:40:13 Protocol versions supported: 3.3, 3.7, 3.8, 3.7t, 3.8t
18/12/2023 12:40:13 Listening for VNC connections on TCP port 5901
18/12/2023 12:40:13 Interface 0.0.0.0
18/12/2023 12:40:13 Framebuffer: BGRX 8/8/8/8
18/12/2023 12:40:13 New desktop size: 1240 x 900
18/12/2023 12:40:13 New screen layout:
18/12/2023 12:40:13 0x00000040 (output 0x00000040): 1240x900+0+0
18/12/2023 12:40:13 Maximum clipboard transfer size: 1048576 bytes
18/12/2023 12:40:13 VNC extension running!
/usr/bin/startxfce4: X server already running on display :1
xterm: cannot load font '-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1'
generating cookie with syscall
generating cookie with syscall
generating cookie with syscall
generating cookie with syscall
gpg-agent[14440]: a gpg-agent is already running - not starting a new one
(xfce4-session:14413): xfce4-session-WARNING **: 12:40:16.137: gpg-agent returned no PID in the variables
(xfce4-session:14413): xfce4-session-WARNING **: 12:40:16.140: xfsm_manager_load_session: Something wrong with /root/.cache/sessions/xfce4-session-headnode.cluster:1, Does it exist? Permissions issue?
vmware-user: could not open /proc/fs/vmblock/dev
SELinux Troubleshooter: Applet requires SELinux be enabled to run.
W: [pulseaudio] main.c: This program is not intended to be run as root (unless --system is specified).
(xfsettingsd:14459): xfsettingsd-WARNING **: 12:40:16.472: Failed to get the _NET_NUMBER_OF_DESKTOPS property.
/usr/share/system-config-printer/applet.py:44: PyGIWarning: Notify was imported without specifying a version first. Use gi.require_version('Notify', '0.7') before import to ensure that the right version gets loaded.
from gi.repository import Notify
[root@headnode ~]#it might look a bit unhappy but it still works perfectly
if using tigervnc
tigervnc is way slower but in the default repos so easier to install it requires a DIFFERENT xstartup in the older default path
[root@headnode ~]# cat ~/.vnc/xstartup
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
xsetroot -solid grey
autocutsel -fork
geometry 1240x900
startxfce4 &
xterm &main difference is tigervnc expects the desktop to run in the background and turbovnc expects it to run in the foreground block the shell
Install VNC
If you want to use vncviewer on the actual headnode, you need to install the pacakge vnc
# On centos 7
sudo yum install tigervnc-server
#others
yum install vnc
# on > centos 5.6, use vnc-server
yum install vnc-serverUpdate Server config
Edit the /etc/sysconfig/vncservers file
<append the following>
VNCSERVERS="1:root 2:viglen"
VNCSERVERARGS[1]="-geometry 1280x1024"
VNCSERVERARGS[2]="-geometry 1280x1024"Set User Passwords
For each user you've added, run vncserver to set a password:
[pacey@pcmtest ~]$ vncserver
You will require a password to access your desktops.
Password:
Verify:
New 'pcmtest.viglen.co.uk:3 (pacey)' desktop is pcmtest.viglen.co.uk:3
Creating default startup script /home/pacey/.vnc/xstartup
Starting applications specified in /home/pacey/.vnc/xstartup
Log file is /home/pacey/.vnc/pcmtest.viglen.co.uk:3.logOr if you need to change the user password
# NOTE vnc password are insecure, only first 8 characters are used
vncpasswdModify User XStartup File
Edit the ~/.vnc/xstartup file for earch user
#!/bin/sh
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
#xsetroot -solid grey
#vncconfig -iconic &
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &Restart the VNCServer
kill off any vnc servers and restart the daemon
[root@pcmtest ~]# pkill Xvnc
[root@pcmtest ~]# /etc/init.d/vncserver restart
Shutting down VNC server: 1:root 2:pacey 3:viglen [ OK ]
Starting VNC server: 1:root
Welcome! The PCM web GUI is installed. It is available here:
http://pcmtest.viglen.co.uk:8080/platform
New 'pcmtest.viglen.co.uk:1 (root)' desktop is pcmtest.viglen.co.uk:1
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/pcmtest.viglen.co.uk:1.log
2:pacey
New 'pcmtest.viglen.co.uk:2 (pacey)' desktop is pcmtest.viglen.co.uk:2
Starting applications specified in /home/pacey/.vnc/xstartup
Log file is /home/pacey/.vnc/pcmtest.viglen.co.uk:2.log
3:viglen
New 'pcmtest.viglen.co.uk:3 (viglen)' desktop is pcmtest.viglen.co.uk:3
Starting applications specified in /home/viglen/.vnc/xstartup
Log file is /home/viglen/.vnc/pcmtest.viglen.co.uk:3.log
[ OK ]
Access the VNC Server
Use ssh for port forwarding instead of having the VNC port open
ssh -L9000:localhost:5903 viglen@pcmtest.viglen.co.uk
then on another terminal run:
vncviewer localhost:9000
[* note vncviewer is part of the vnc package in centos, may need to be installed]
NOTE
- vnc password is the one that was set using vncpasswd above
- desktop lock password is the users standard password
- once user logs out from ssh session, vnc access will no longer be available