Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with OpenID
Advertise on LowEndTalk.com

In this Discussion

How to Install VNC on CentOS?

How to Install VNC on CentOS?

DewlanceVPSDewlanceVPS Member
edited October 2012 in Tutorials

Hello,

Most of peoples want to use Desktop Instead of SSH because of many problems(If they can't configure something from SSH or they don't know how to manage VPS through command line)

How to Install VNC on CentoS VPS? Login to your SSH Client and run this command.

yum install vnc-server (If asking for permission then send "y" command)

yum install vnc (Send "y" command if ask for permission)

yum groupinstall "GNOME Desktop Environment" (This can take long time but depend on your vps hardware performance and internet speed)

yum install nano (Ignore this command if already installed)


Modify vncservers file

nano /etc/sysconfig/vncservers Replace this with this line VNCSERVERS="2:root" VNCSERVERARGS[1]="-geometry 640x480"


Now we need to start vncserver

vncserver (Note: If ask for password then enter your VPS Root password)
If successfully started then you will get a output result like New 'hostname.example.com:1 (root)' desktop is hostname.yourdomain.com:1 Starting applications specified in /root/.vnc/xstartup Log file is /root/.vnc/hostname.example.com:1.log


Currently vnc is running but we need to start VNC in gnome session :)

nano /root/.vnc/xstartup Uncomment 2 lines in xstartup file(Remove "#" from starting lines) '#unset SESSION_MANAGER' '#exec /etc/X11/xinit/xinitrc`

And Change last line to:

exec gnome-session &


Kill VNC Process

vncserver -kill :1


Now Again you need to Start VNC

vncserver


Finally you will see a success output like: New 'hostname.example.com:1 (root)' desktop is hostname.yourdomain.com:1 Starting applications specified in /root/.vnc/xstartup Log file is /root/.vnc/hostname.example.com:1.log


Congarulations Now you can access your VNC Account using your main IP of VNC

Example: xx.x.x.x:1


How to Access VNC? You can access your VNC from any VNC Viewer or VNC Client. (Search in google: "VNC Viewer")

If show blank screen or "X" mouse cursor? - If your server is protected by Firewall(iptables,etc) then try to disable your firewall and If start working then restart your firewall and open VNC Ports.

How to open VNC Port in iptables?

'iptables -I INPUT -m state –state NEW -p tcp –dport 5800 -j ACCEPT' 'iptables -I INPUT -m state –state NEW -p tcp –dport 5801 -j ACCEPT' 'iptables -I INPUT -m state –state NEW -p tcp –dport 5900 -j ACCEPT' 'iptables -I INPUT -m state –state NEW -p tcp –dport 5901 -j ACCEPT'

Tagged:
Thanked by 1ErawanArifNugroho

Comments

Sign In or Register to comment.