Was trying to configure vnc on centos 6. Following are the steps which I used.
#yum install vncserver
useraccount 'tom' was already created
therefore just logged on as the user and ran the following command to set the vnc password
#vncpasswd
which creates a .vnc directory under the home directory of the user
Edit the server configuration {/etc/sysconfig/vncservers } as follows
VNCSERVERS="1:tom"
VNCSERVERARGS[1]="-geometry 640x480"
Then restart the services:
#service vncserver start
Change the firewall settings by editing /etc/sysconfig/iptables and I had to allow the following as I had other users configured as well
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5900 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6001 -j ACCEPT
Now I can connect from ubuntu or realvnc clents from other workstations.
But I encountered the following error when restarting the system and service
A VNC server is already running as :10
When I checked the logs, what I saw was:
but checking for processes running on 5910 and 5810 showed that none were listening:
after some searching, I finally found this link that lead me to the answer.
There was another stray process that was listening at tcp port 6010 as shown below
All I had to do was kill that process 19464 and then the vncserver was able to start up correctly.
ADDENDUM I finally found out what was causing it. It was my own ssh sessions to the server with X11Forwarding enabled that were causing the conflicts. So the ultimate resolution to the problem was to add the following into the "/etc/ssh/sshd_config" file.
References:
1) http://monsterjam.org/blog/20071228103211
2) http://wiki.centos.org/HowTos/VNC-Server
#yum install vncserver
useraccount 'tom' was already created
therefore just logged on as the user and ran the following command to set the vnc password
#vncpasswd
which creates a .vnc directory under the home directory of the user
Edit the server configuration {/etc/sysconfig/vncservers } as follows
VNCSERVERS="1:tom"
VNCSERVERARGS[1]="-geometry 640x480"
Then restart the services:
#service vncserver start
Change the firewall settings by editing /etc/sysconfig/iptables and I had to allow the following as I had other users configured as well
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5900 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6001 -j ACCEPT
Now I can connect from ubuntu or realvnc clents from other workstations.
But I encountered the following error when restarting the system and service
A VNC server is already running as :10
When I checked the logs, what I saw was:
Starting up the machine number 10
Cannot bind the socket to the display. Error:1 at /usr/bin/vncserver line 275.
A VNC server is already running as :10
but checking for processes running on 5910 and 5810 showed that none were listening:
[root@myserver]$ netstat -an | grep 5910
[root@myserver]$ netstat -an | grep 5810
[root@myserver]$
after some searching, I finally found this link that lead me to the answer.
There was another stray process that was listening at tcp port 6010 as shown below
[root@myserver]$ /usr/sbin/lsof -i tcp:6010
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
sshd 19464 root 8u IPv4 143749109 TCP localhost.localdomain:x11-ssh-offset (LISTEN)
All I had to do was kill that process 19464 and then the vncserver was able to start up correctly.
ADDENDUM I finally found out what was causing it. It was my own ssh sessions to the server with X11Forwarding enabled that were causing the conflicts. So the ultimate resolution to the problem was to add the following into the "/etc/ssh/sshd_config" file.
X11DisplayOffset 50
and restart the sshd.References:
1) http://monsterjam.org/blog/20071228103211
2) http://wiki.centos.org/HowTos/VNC-Server
Thanks for the info..
ReplyDeleteinstall vnc on centos 6