This is an old revision of the document!
Table of Contents
Install TigerVNC
This page shows how to install a VNC server on a CentOS 6.4 64-bit machine so that you can connect to it from a desktop using a VNC client.
Prerequisites
You must have a CentOS machine already set up in accordance with the the “Install CentOS 6” guide.
Install VNC
Install prerequisite software as well as the tigervnc-server package
yum -y install pixman pixman-devel libXfont tigervnc-server*
Configure VNC server to start automatically on boot.
chkconfig --level 5 vncserver on
Configure User
Replace USERNAME with the name of the user account you want to grant VNC access to. Pick any password.
su - USERNAME vncpasswd exit
Configure the resolution to have when connecting as this user. Replace USER with the name of the user account you want to grant VNC access to.
cat << EOF >> /etc/sysconfig/vncservers VNCSERVERS="1:tomcat" VNCSERVERARGS[1]="-geometry 1500x900" EOF service vncserver restart
=Configure Firewall=
Port 5901 is the port the VNC clients access. Port 5801 is a web server port that you can use to view the desktop through a web browser. 'Note', you will have to change the 1 at the end of the port number to be whatever you set “1:tomcat” to be. E.G. if you set “3:user1 7:user2” you will need to open ports 5903 and 5097 for normal VNC and port 5803 and 5807 for web VNC.
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 5801 -j ACCEPT iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT service iptables save service iptables restart
Configure View Only
Sometimes you want people to connect and view the desktop but not be able to edit it. (Thinking of the web page specifically here).
TigerVNC does not support this. However, you can set the default to 'view only'. It is trivial to click the 'Options' button when using the web interface and set 'View only' to false if you need to make a change. However, if broadcasting something, it it kinda safe in a company this size. It helps prevent accidental damage rather than anything else.
vi /usr/share/vnc/classes/index.vnc
AFTER this line
<param name=PORT value=$PORT>
add this line
<param name="View only" value="Yes">
Save and exit
service vncserver restart
=Connect= If you are using the TightVNC client on your Windows desktop, put the following value in the 'Remote Host:' text field and click 'Connect' (replacing HOSTNAME with the name of the server)
HOSTNAME::5901
You can also go to the following URL to view the machine through the web browser (replacing HOSTNAME with the name of the server).
http://HOSTNAME:5801/
REMEMBER: When you are finished with the desktop session, do NOT log out. Just close the VNC window.
You may have to reduce the security settings of Java on your machine. See [http://www.java.com/en/download/help/jcp_security.xml here].
Control Panel→Java→Security→Set Security Level to Medium.
Disable Annoying Popup Using VNC
When you vnc into a CentOS box, you can get an annoying popup asking for the root password to run
org.freedesktop.packagekit.system-network-proxy-configure
Open a terminal window and run
gnome-session-properties
Untick packagekit
