{"id":446,"date":"2013-11-24T20:24:23","date_gmt":"2013-11-24T20:24:23","guid":{"rendered":"http:\/\/blog.shineservers.com\/?p=446"},"modified":"2013-11-24T20:24:23","modified_gmt":"2013-11-24T20:24:23","slug":"install-vnc-server-centos","status":"publish","type":"post","link":"https:\/\/www.shineservers.com\/2013\/11\/24\/install-vnc-server-centos\/","title":{"rendered":"How To Install VNC Server On CentOS"},"content":{"rendered":"<p><strong>VNC (Virtual Network Computing<\/strong>\u00a0<strong><\/strong>) is a graphical desktop sharing system that uses the Remote Frame Buffer protocol to remotely control another coumputer on a network.<\/p>\n<p>To run the VNC Server on CentOS, we have to install these required packages:<\/p>\n<div>Code:\u00a0<a>[Select]<\/a><\/div>\n<pre><code>yum groupinstall Desktop\nyum install tigervnc-server\nyum install xorg-x11-fonts-Type1\nyum install vnc<\/code><\/pre>\n<p><strong>To start VNC Server on boot<\/strong><\/p>\n<div>Code:\u00a0<a>[Select]<\/a><\/div>\n<pre><code>chkconfig vncserver on<\/code><\/pre>\n<p><strong>To setup users\u2019 VNC password:<\/strong><\/p>\n<div>Code:\u00a0<a>[Select]<\/a><\/div>\n<pre><code>vncpasswd<\/code><\/pre>\n<p><strong>Edit the \/etc\/sysconfig\/vncservers file:<\/strong><\/p>\n<div>Code:\u00a0<a>[Select]<\/a><\/div>\n<pre><code>nano \/etc\/sysconfig\/vncservers<\/code><\/pre>\n<p><strong>Add the following to the end of the file:<\/strong><\/p>\n<div>Code:\u00a0<a>[Select]<\/a><\/div>\n<pre><code>VNCSERVERS=\"1:arbab\"\nVNCSERVERARGS[1]=\"-geometry 1024x600\"\n<\/code><\/pre>\n<p><strong>The iptables rules need to be amended to open the VNC ports:<br \/>\n<\/strong><\/p>\n<div>Code:\u00a0<a>[Select]<\/a><\/div>\n<pre><code>iptables -I INPUT 5 -m state --state NEW -m tcp -p tcp -m multiport --dports 5901:5903,6001:6003 -j ACCEPT\nservice iptables save\nservice iptables restart\n<\/code><\/pre>\n<p><strong>Restart the VNC Server:<\/strong><\/p>\n<div>Code:\u00a0<a>[Select]<\/a><\/div>\n<pre><code>service vncserver restart<\/code><\/pre>\n<p><strong>Now kill the VNC Server:<\/strong><\/p>\n<div>Code:\u00a0<a>[Select]<\/a><\/div>\n<pre><code>vncserver -kill :1<\/code><\/pre>\n<p><strong>Edit the xstartup file in .vnc directory:<br \/>\n<\/strong><\/p>\n<div>Code:\u00a0<a>[Select]<\/a><\/div>\n<pre><code>nano .vnc\/xstartup\n<\/code><\/pre>\n<p><strong>Comment the last line and run the Gnome:<\/strong><\/p>\n<div>Code:\u00a0<a>[Select]<\/a><\/div>\n<pre><code>#twm &amp; \nexec gnome-session &amp;<\/code><\/pre>\n<p><strong>Restart the service:<\/strong><\/p>\n<div>Code:\u00a0<a>[Select]<\/a><\/div>\n<pre><code>service vncserver restart<\/code><\/pre>\n<p>Now, download VNCViewer onto our desktop computer from which we want to access the shared desktop.<br \/>\nConnect using ServerIP\/Name:1 (:1 is for the VNC server window)<\/p>\n<p><a href=\"http:\/\/www.realvnc.com\/download\/viewer\/\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/www.realvnc.com\/download\/viewer\/<br \/>\n<\/a><\/p>\n<p>Enter the password that we created using the vncpasswd command:<\/p>\n<p><strong>Ability to connect for multiple users:<br \/>\n<\/strong><br \/>\nCreate a local user, using the following command:<\/p>\n<div>Code:\u00a0<a>[Select]<\/a><\/div>\n<pre><code>adduser ali<\/code><\/pre>\n<p><strong>Create a password for newly created user:<\/strong><\/p>\n<div>Code:\u00a0<a>[Select]<\/a><\/div>\n<pre><code>passwd ali<\/code><\/pre>\n<p><strong>Switch to the newly created user and run vncpasswd command for it:<\/p>\n<p>su ali<\/strong><\/p>\n<div>Code:\u00a0<a>[Select]<\/a><\/div>\n<pre><code>vncpasswd<\/code><\/pre>\n<p><strong>Edit the \/etc\/sysconfig\/vncservers file:<\/strong><\/p>\n<div>Code:\u00a0<a>[Select]<\/a><\/div>\n<pre><code>nano \/etc\/sysconfig\/vncservers<\/code><\/pre>\n<p><strong>Add these lines for new user:<\/strong><\/p>\n<div>Code:\u00a0<a>[Select]<\/a><\/div>\n<pre><code>VNCSERVERS=\"1:arbab 2:ali\"\nVNCSERVERARGS[1]=\"-geometry 1024x600\"\nVNCSERVERARGS[2]=\"-geometry 1024x600\"<\/code><\/pre>\n<p><strong>Restart the VNC service:<\/strong><\/p>\n<div>Code:\u00a0<a>[Select]<\/a><\/div>\n<pre><code>service vncserver restart<\/code><\/pre>\n<p><strong>Kill the vncserver session for new user and edit the xstartup file:<\/strong><\/p>\n<div>Code:\u00a0<a>[Select]<\/a><\/div>\n<pre><code>su ali\nvncserver -kill :2\ncd ~\nnano .vnc\/xstartup\n<\/code><\/pre>\n<p><strong>Modify the file so it looks like this:<br \/>\n<\/strong><\/p>\n<div>Code:\u00a0<a>[Select]<\/a><\/div>\n<pre><code>#twm &amp; \nexec gnome-session &amp;\n<\/code><\/pre>\n<p><strong>Restart the VNC service:<br \/>\n<\/strong><\/p>\n<div>Code:\u00a0<a>[Select]<\/a><\/div>\n<pre><code>service vncserver restart<\/code><\/pre>\n<p>Connect with newly created user using centos:2, Where centos is my server name:<\/p>\n<p>Enter the password that we created using the vncpasswd command:<\/p>\n","protected":false},"excerpt":{"rendered":"<p>VNC (Virtual Network Computing\u00a0) is a graphical desktop sharing system that uses the Remote Frame Buffer protocol to remotely control another coumputer on a network. To run the VNC Server on CentOS, we have to install these required packages: Code:\u00a0[Select] yum groupinstall Desktop yum install tigervnc-server yum install xorg-x11-fonts-Type1 yum install vnc To start VNC [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[60],"tags":[159],"class_list":["post-446","post","type-post","status-publish","format-standard","hentry","category-linux","tag-how-to-install-vnc-server-on-centos"],"acf":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/posts\/446","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/comments?post=446"}],"version-history":[{"count":0,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/posts\/446\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/media?parent=446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/categories?post=446"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/tags?post=446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}