Modified 04-MAR-2009 Type HOWTO Status PUBLISHED
In this Document
Goal
Solution
1. Installation
2. System Configuration
3. Password
4. User Configuration
6. Test
7. Mouse buttons
References
Applies to:
Linux Kernel - Version: 4.4
Linux x86-64
Goal
This article describes how to setup a VNC (Virtual Network Computing ) server with clipboard support on Red Hat Enterprise Linux and Oracle Enterprise Linux.
Solution
1. Installation
Check if vnc-server rpm package is installed on your Linux OS:
rpm -q vnc-server
If it is not there, try to find vnc-server rpm package on Linux OS installation ISO/media and install it:
rpm -ivh
If you have Oracle Enterprise Linux support license and up2date configured, you can get vnc-server from ULN (Unbreakable Linux Network):
up2date -i vnc-server
Please consult ULN and ULN FAQ for how to update your Linux via up2date.
2. System Configuration
To automate the startup of vncserver after boot, the /etc/sysconfig/vncservers must be configured. The syntax of configuration file is:
# VNCSERVERS="
# VNCSERVERARGS[
The parameter "VNCSERVERS" indicates a vnc server is started as user
VNCSERVERS="1:root 10:oracle"
In the above case, There will be 2 VNC servers on display ":1" and ":10".
By default, the following ports will be opened:
port 5801 for "root", 5810 for "oracle":
- for VNC client connection over HTTP protocol, using a java-enabled browser.
port 5901 for "root", 5910 for "oracle":
- for VNC client connection over RFB protocol (e.g. vncviewer).
port 6001 for "root" 6010 for "oracle":
- for X applications to connect to the VNC server
The parameter "VNCSERVERARGS" specifies the session properties, for full details see the online documentation
man Xvnc
With RHEL5/OEL5, the supplied /etc/sysconfig/vncservers documents how to restrict sessions:
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
# Use "-nohttpd" to prevent web-based VNC clients connecting.
# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel. See the "-via" option in the
# `man vncviewer' manual page.
The vncserver is a Linux service, you manage it with "chkconfig" and "service" commands like other services. Refer to Note 551711.1 for enable/disable/start/stop operations. However, further configuration should be done prior to staring the service.
3. Password
Set the vnc access password:
# vncpasswd
Password:
Verify:
Please note the password must be set by each userid named on the "VNCSERVERS=" parameter. If this is not done, the service for the userid will not be started.
The vncpasswd command will also cause directory $HOME/.vnc to be created and populated with required files. Session log files will also be created here.
4. User Configuration
The vncserver service will start a VNC server "Xvnc", which runs script $HOME/.vnc/xstartup. This calls "vncconfig" which provides clipboard support. See the online manual for more information:
man vncconfig
Default xstartup script:
# cat xstartup
#!/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 &
If you follow the instructions "Uncomment the following two lines for normal desktop:" you will lose clipboard support. This is because "/etc/X11/xinit/xinitrc" will invoke “/etc/X11/xinit/Xclients” to setup Gnome or KDE, but command "exec" will terminate the current shell after executing, thus subsequent commands will not be run.
The "twm &" command will invoke a basic window manager. For a more advanced window manager, change the line to one of your choice, e.g.:
# cat xstartup
#!/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 &
gnome-session &
# or "startkde &" for KDE desktop
6. Test
Start the service:
service vncserver start
The service "vncserver" reads /etc/sysconfig/vncservers to find all allowed users and their parameters and then calls /usr/lib/vncserver. This perl script program reads $HOME/.vnc/xstartup to allow you to change the applications run at Xvnc's startup.
Any user also can manually invoke "vncserver" command to start a vnc server on next available port. If vncpasswd has not been run, it will be called.
To access your vnc server, you can use the vncviewer utility
vncviewer
Or point your java-enabled browser at port 58xx on the vncserver.
7. Mouse buttons
If you only have a two-button mouse, you may find you are unable to use some Xwindow mouse buttons.
Xwindow provides the ability to change the mapping of the mouse buttons with the "xmodmap" command, for example:
xmodmap -e "pointer = 1 3 2 4 5"
This command will "reverse" buttons 2 and 3
Thank you! Finally I was able to get an answer as to why I couldn't copy/paste to/from the clipboard!
ReplyDelete