{"id":36,"date":"2015-05-01T14:00:00","date_gmt":"2015-05-01T14:00:00","guid":{"rendered":"https:\/\/www.tech-and-dev.com\/blog\/2015\/05\/01\/installing-vnc-server-on-centos-7\/"},"modified":"2021-02-22T01:03:59","modified_gmt":"2021-02-22T01:03:59","slug":"installing-vnc-server-centos7","status":"publish","type":"post","link":"https:\/\/www.tech-and-dev.com\/blog\/2015\/05\/installing-vnc-server-centos7.html","title":{"rendered":"Installing VNC Server on CentOS 7"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align: left;\">\n<div style=\"clear: both; text-align: center;\"><a style=\"margin-left: 1em; margin-right: 1em;\" href=\"https:\/\/www.tech-and-dev.com\/blog\/wp-content\/uploads\/2021\/02\/1_vnc-logo.png\"><img decoding=\"async\" title=\"VNC Server Logo\" src=\"https:\/\/www.tech-and-dev.com\/blog\/wp-content\/uploads\/2021\/02\/1_vnc-logo.png\" alt=\"VNC logo\" border=\"0\" \/><\/a><\/div>\n<p>&nbsp;<\/p>\n<div style=\"text-align: justify;\">VNC allows you to connect to your server or computer remotely using a graphical user interface.<\/div>\n<p>&nbsp;<\/p>\n<h2 style=\"text-align: left;\">Installing The VNC Server:<\/h2>\n<p>Install the CentOS desktop<\/p>\n<pre>yum groupinstall \"GNOME Desktop\"<\/pre>\n<p><a name=\"more\"><\/a><br \/>\nInstall the VNC server<\/p>\n<pre>yum install -y tigervnc-server<\/pre>\n<p>&nbsp;<\/p>\n<div style=\"text-align: justify;\">Create a new user to connect remotely to your server, you can use root, but it&#8217;s highly not suggested due to security risks.<\/div>\n<pre>useradd vncuser\r\npasswd vncuser<\/pre>\n<p>&nbsp;<\/p>\n<div style=\"text-align: justify;\">Copy the generic VNC service file to the service system directory.<\/div>\n<div style=\"text-align: justify;\">By default VNC runs on port 5900. <b>4<\/b> in <b>vncserver@:4.service<\/b> will tell VNC to run on port 5904, this is useful when several VNC servers for different users need to be created.<\/div>\n<pre>cp \/usr\/lib\/systemd\/system\/vncserver@.service \/etc\/systemd\/system\/vncserver@:4.service<\/pre>\n<p>Edit the service file<\/p>\n<pre>vi \/etc\/systemd\/system\/vncserver@:4.service<\/pre>\n<p>&nbsp;<\/p>\n<div style=\"text-align: justify;\">Add\/Modify the below in <b>[service]<\/b> (You may use a different resolution if you wish):<\/div>\n<pre>ExecStart=\/sbin\/runuser -l vncuser -c \"\/usr\/bin\/vncserver %i -geometry 1280x800 -nolisten tcp\"\r\nPIDFile=\/home\/vncuser\/.vnc\/%H%i.pid<\/pre>\n<p>Reload systemd (system daemons) to scan for new or changed service file(s).<\/p>\n<div style=\"text-align: justify;\">systemctl daemon-reload<\/div>\n<p>&nbsp;<\/p>\n<p>Enable the service:<\/p>\n<pre>systemctl enable vncserver@:4.service<\/pre>\n<p>Create the configuration files for the VNC user and set a password when asked:<\/p>\n<pre>su vncuser\r\nvncserver\r\nexit<\/pre>\n<p>Start the VNC server:<\/p>\n<pre>systemctl start vncserver@:4.service<\/pre>\n<p>Configure centOS 7 firewall<\/p>\n<pre>firewall-cmd --permanent --zone=public --add-service vnc-server\r\nfirewall-cmd --reload<\/pre>\n<h2 style=\"text-align: left;\">Connecting to VNC Remote Server From Windows using Putty:<\/h2>\n<p>Download and install <a href=\"http:\/\/www.realvnc.com\/download\/vnc\/\" target=\"_blank\" rel=\"nofollow noopener\">VNC client<\/a><a href=\"http:\/\/www.realvnc.com\/download\/vnc\/\" target=\"_blank\" rel=\"nofollow noopener\"> from here<\/a><\/p>\n<p>By default, VNC doesn&#8217;t provide a free way to connect over an encrypted connection.<\/p>\n<p>We will use PuTTY to tunnel the connection from our computer to the server:<\/p>\n<p>Download <a href=\"http:\/\/www.chiark.greenend.org.uk\/~sgtatham\/putty\/download.html\" target=\"_blank\" rel=\"nofollow noopener\">PuTTY from here<\/a> if you don&#8217;t have it.<\/p>\n<p>Enter the IP address of your server in the <b>Host Name<\/b>. Make sure to replace xxx.xxx.xxx.xxx by your server&#8217;s IP addres.<\/p>\n<div style=\"clear: both; text-align: center;\"><a style=\"margin-left: 1em; margin-right: 1em;\" href=\"https:\/\/www.tech-and-dev.com\/blog\/wp-content\/uploads\/2021\/02\/putty-session.png\"><img decoding=\"async\" title=\"Putty Host Name\" src=\"https:\/\/www.tech-and-dev.com\/blog\/wp-content\/uploads\/2021\/02\/putty-session.png\" alt=\"Putty Host Name or IP\" border=\"0\" \/><\/a><\/div>\n<p>Go to Connection =&gt; SSH =&gt; Tunnels, enter the source port number (5904 in this example) and enter the IP of the server and the VNC port (IP:PORT (xxx.xxx.xxx.xxx:5904 in this example).<\/p>\n<div style=\"clear: both; text-align: center;\"><a style=\"margin-left: 1em; margin-right: 1em;\" href=\"https:\/\/www.tech-and-dev.com\/blog\/wp-content\/uploads\/2021\/02\/putty-tunneling.png\"><img decoding=\"async\" title=\"Putty Tunneling\" src=\"https:\/\/www.tech-and-dev.com\/blog\/wp-content\/uploads\/2021\/02\/putty-tunneling.png\" alt=\"Tunneling with Putty\" border=\"0\" \/><\/a><\/div>\n<p>Make sure to replace xxx.xxx.xxx.xxx by your server&#8217;s IP address<\/p>\n<p>Click <b>Open<\/b> and login to your server.<\/p>\n<p>Open VNC client and connect to localhost with the port number you specified in PuTTY.<\/p>\n<div style=\"clear: both; text-align: center;\"><a style=\"margin-left: 1em; margin-right: 1em;\" href=\"https:\/\/www.tech-and-dev.com\/blog\/wp-content\/uploads\/2021\/02\/vnc-client.png\"><img decoding=\"async\" src=\"https:\/\/www.tech-and-dev.com\/blog\/wp-content\/uploads\/2021\/02\/vnc-client.png\" border=\"0\" \/><\/a><\/div>\n<p>Congratulations, you should be able to see your remote desktop!<\/p>\n<p>If you are using Linux, you can install <b>Remmina<\/b> and the <b>remmina-plugin-vnc<\/b> and connect to the vnc server.<\/p>\n<p><b>Questions or Comments? Please leave them below!<\/b><\/p>\n<p>&nbsp;<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; VNC allows you to connect to your server or computer remotely using a graphical user interface. &nbsp; Installing The VNC Server: Install the CentOS desktop yum groupinstall &#8220;GNOME Desktop&#8221; Install the VNC server yum install -y tigervnc-server &nbsp; Create a new user to connect remotely to your server, you can use root, but it&#8217;s [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[17,6,52,51,50],"tags":[],"class_list":["post-36","post","type-post","status-publish","format-standard","hentry","category-centos","category-linux","category-putty","category-tunneling","category-vnc"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/posts\/36","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/comments?post=36"}],"version-history":[{"count":1,"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/posts\/36\/revisions"}],"predecessor-version":[{"id":314,"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/posts\/36\/revisions\/314"}],"wp:attachment":[{"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/media?parent=36"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/categories?post=36"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tech-and-dev.com\/blog\/wp-json\/wp\/v2\/tags?post=36"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}