Wednesday, December 25, 2013

Setting up VNC on CentOS 6

I prefer to use tigervnc, and you have to open up the firewall.

5800, 5900, and 6000 are for display 0. 5801, 5901, and 6001 are for display 1, etc.

Display 0 is the default desktop, System > Remote Desktop > Allow Vwiew & Control ...

Open Terminal

su
vim /etc/sysconfig/iptables

# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5800:5810 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5900:5910 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6000:6010 -j ACCEPT
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

Alternative:
iptables -I INPUT 5 -m state --state NEW -m tcp -p tcp -m multiport --dports 5901:5903,6001:6003 -j ACCEPT

service iptables save
service iptables restart

yum groupinstall Desktop
yum install tigervnc-server
yum install xorg-x11-fonts-Type1
yum install vnc
chkconfig vncserver on
vncpasswd

echo "HOSTNAME=plato" >> /etc/sysconfig/network
hostname "plato"

xauth: (stdin):1: bad display name "myserver:3" in "add" command

vim /etc/hosts
CTRL+O
::1 apollo apollo.localhost

Could not init font path element unix/:-1, removing from list!

Fatal server error:
could not open default font 'fixed'

X would not start. So using my mad lynx skillz, i googled the issue and found a recommendation to add the following lines to my xorg.conf

FontPath "/usr/X11R6/lib/X11/fonts/75dpi"
FontPath "/usr/X11R6/lib/X11/fonts/encodings"
FontPath "/usr/X11R6/lib/X11/fonts/misc"
FontPath "/usr/X11R6/lib/X11/fonts/Speedo"
FontPath "/usr/X11R6/lib/X11/fonts/TTF"
FontPath "/usr/X11R6/lib/X11/fonts/Type1"

yum install libXfont
yum install xorg-x11-xfs
yum install xorg-x11-xfs-utils
yum install xorg-x11-xinit
yum install xorg-x11-xdm

!!! Remember to use a different user than root for vnc

vncserver

service vncserver restart
Shutting down VNC server:                                  [  OK  ]
Starting VNC server: no displays configured                [FAILED]

No comments:

Post a Comment