{"id":4547,"date":"2015-04-12T22:57:31","date_gmt":"2015-04-12T14:57:31","guid":{"rendered":"http:\/\/rmohan.com\/?p=4547"},"modified":"2015-04-12T22:57:31","modified_gmt":"2015-04-12T14:57:31","slug":"vnc-server-on-centos-7","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=4547","title":{"rendered":"VNC server on Centos 7"},"content":{"rendered":"<p><strong>VNC server on Centos 7<\/strong><br \/>\na)\u00a0 yum groupinstall &#8220;X Window System&#8221;<\/p>\n<p>b) yum install gnome-classic-session gnome-terminal nautilus-open-terminal control-center liberation-mono-fonts<\/p>\n<p>unlink \/etc\/systemd\/system\/default.target<\/p>\n<p>ln -sf\u00a0 \/lib\/systemd\/system\/graphical.target\u00a0 \/etc\/systemd\/system\/default.target<\/p>\n<p>reboot<\/p>\n<p>After reboot, you will get Centos 7 desktop .<\/p>\n<p>Now start installing VNC packages.<\/p>\n<p>Issue the below command to install VNC package.<\/p>\n<p>yum install tigervnc-server -y<\/p>\n<p>Create a file vncserver@:1.service in \/etc\/systemd\/system\/ directory by copying example config file \/lib\/systemd\/system\/vncserver@.service<\/p>\n<p>cp \/lib\/systemd\/system\/vncserver@.service \/etc\/systemd\/system\/vncserver@:1.service<\/p>\n<p>Now open \/etc\/systemd\/system\/vncserver@:1.service file and replace with your username .<br \/>\nFind these lines ..<br \/>\nExecStart=\/sbin\/runuser -l &lt;USER&gt; -c &#8220;\/usr\/bin\/vncserver %i&#8221;<br \/>\nPIDFile=\/home\/&lt;USER&gt;\/.vnc\/%H%i.pid<\/p>\n<p>Replace ( Considering username as mohan )<br \/>\nExecStart=\/sbin\/runuser -l mohan -c &#8220;\/usr\/bin\/vncserver %i&#8221;<br \/>\nPIDFile=\/home\/mohan\/.vnc\/%H%i.pid<\/p>\n<p>If you are creating for root user .<br \/>\nExecStart=\/sbin\/runuser -l root -c &#8220;\/usr\/bin\/vncserver %i&#8221;<br \/>\nPIDFile=\/root\/.vnc\/%H%i.pid<\/p>\n<p>Reload systemd for changes.<\/p>\n<p>systemctl daemon-reload<\/p>\n<p>Create VNC password for the user .<br \/>\nsu &#8211; mohan<\/p>\n<p>vncpasswd<\/p>\n<p>Enable and start the service using the below commands.<br \/>\nEnable service at startup ( Permanent ).<\/p>\n<p>systemctl enable vncserver@:1.service<\/p>\n<p>systemctl start vncserver@:1.service<\/p>\n<p>Allow VNC service in firewall.<\/p>\n<p>firewall-cmd &#8211;permanent &#8211;add-service vnc-server<br \/>\nsystemctl restart firewalld.service<\/p>\n<p>You can use VNC client like Tightvnc viewer and Realvnc viewer to connect Server.<br \/>\nFor additional users create files with different ports ( Refer Step 2 ) vncserver@:2.service by copying example config file and continue the steps 3,4,5 and 6 by replacing service name. Please make sure you logged in as that particular user for creating vnc password ( Step 5 ).<\/p>\n<p>Additional Commands :<br \/>\nTo stop VNC service .<br \/>\nsystemctl stop vncserver@:1.service<\/p>\n<p>To disable VNC service from startup ( permanent ).<br \/>\nsystemctl disable vncserver@:1.service<\/p>\n<p>To stop firewall ( For troubleshooting ).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>VNC server on Centos 7 a) yum groupinstall &#8220;X Window System&#8221;<\/p>\n<p>b) yum install gnome-classic-session gnome-terminal nautilus-open-terminal control-center liberation-mono-fonts<\/p>\n<p>unlink \/etc\/systemd\/system\/default.target<\/p>\n<p>ln -sf \/lib\/systemd\/system\/graphical.target \/etc\/systemd\/system\/default.target<\/p>\n<p>reboot<\/p>\n<p>After reboot, you will get Centos 7 desktop .<\/p>\n<p>Now start installing VNC packages.<\/p>\n<p>Issue the below command to install VNC package.<\/p>\n<p>yum install tigervnc-server -y<\/p>\n<p>Create a file [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4547"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4547"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4547\/revisions"}],"predecessor-version":[{"id":4548,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4547\/revisions\/4548"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4547"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4547"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4547"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}