{"id":2159,"date":"2017-10-05T17:53:45","date_gmt":"2017-10-05T12:23:45","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=2159"},"modified":"2026-09-16T09:13:51","modified_gmt":"2026-09-16T03:43:51","slug":"start-vncserver-boot-ubuntu-14-04","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/start-vncserver-boot-ubuntu-14-04\/","title":{"rendered":"Start vncserver at boot\u2014Ubuntu 14.04."},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Virtual Network Computing (VNC) allows administrators to remotely access and manage a graphical desktop environment on a Linux server. In some environments, it may be necessary for the VNC server to start automatically whenever the server is rebooted.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On Ubuntu 14.04, this can be configured by creating a startup script and calling the script from the <code>\/etc\/rc.local<\/code> file. This ensures that the VNC server is started automatically during the system boot process.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this blog, we will explain how to create a startup script for VNC Server, configure it to run during system startup, and verify that the VNC server is accessible after rebooting the server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before configuring VNC Server to start automatically, make sure you have:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>An Ubuntu 14.04 server.<\/li>\n\n\n\n<li>Root or sudo access to the server.<\/li>\n\n\n\n<li>VNC Server installed and configured.<\/li>\n\n\n\n<li>SSH access to the server.<\/li>\n\n\n\n<li>A VNC client installed on the system from which you want to connect.<\/li>\n\n\n\n<li>The VNC display number configured for the server.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">In this example, the VNC server will run on display <code>:1<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Implementation<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Create the VNC Startup Script<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Create a script named <code>startvnc.sh<\/code> under the <code>\/root<\/code> directory:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">vi \/root\/startvnc.sh<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the following content:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#!\/bin\/bash\n\nUSER=root\nHOME=\/root\n\nexport USER HOME\n\ncd \/root\n\n\/usr\/bin\/vncserver :1<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This script sets the required user and home directory environment variables and starts the VNC server on display <code>:1<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Make the Script Executable<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">After creating the script, assign execute permission:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">chmod +x \/root\/startvnc.sh<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can verify the permission using:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">ls -l \/root\/startvnc.sh<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Configure <code>rc.local<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Ubuntu 14.04 is used <code>\/etc\/rc.local<\/code> to execute commands during the system startup process.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Open the file:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">vi \/etc\/rc.local<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Locate the following line:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">exit 0<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the VNC startup command <strong>above<\/strong> <code>exit 0<\/code>:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># Start VNC Server\n\n\/root\/startvnc.sh\n\nexit 0<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The final <code>\/etc\/rc.local<\/code> configuration should look similar to:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#!\/bin\/sh -e\n\n# Start VNC Server\n\/root\/startvnc.sh\n\nexit 0<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Reboot the Server<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Once the configuration is complete, reboot the server:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">reboot<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After the server has restarted, the startup script should automatically launch the VNC server.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 5: Verify the VNC Server<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You can verify that the VNC server is running by connecting from a VNC client.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For display <code>:1<\/code>, use:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SERVER_IP:1<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Alternatively, the VNC display <code>:1<\/code> commonly corresponds to the TCP port <code>5901<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the connection is successful, the VNC desktop should be accessible without manually starting the VNC server after every reboot.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Architecture Diagram<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The startup process can be represented as follows:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image.png\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"245\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image-1024x245.png\" alt=\"\" class=\"wp-image-11768\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image-1024x245.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image-300x72.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image-768x184.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2017\/10\/image.png 1247w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Configuring the VNC server to start automatically at boot can eliminate the need to manually start the service after every server reboot.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On Ubuntu 14.04, this can be achieved by:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Creating <code>\/root\/startvnc.sh<\/code>.<\/li>\n\n\n\n<li>Adding the VNC startup command to the script.<\/li>\n\n\n\n<li>Making the script executable.<\/li>\n\n\n\n<li>Calling the script from <code>\/etc\/rc.local<\/code>.<\/li>\n\n\n\n<li>Rebooting the server and verifying the VNC connection.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Once configured, the VNC server will automatically start during the boot process and can be accessed through a VNC client using the configured display number.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> Ubuntu 14.04 is an obsolete operating system release. The <code>\/etc\/rc.local<\/code> approach described here is specifically relevant to older Ubuntu versions. For newer Ubuntu releases, <code>systemd<\/code> service configuration is generally preferred.<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">FAQ<\/h2>\n\n\n\n<h4 class=\"wp-block-heading\">1. What is a VNC server?<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">VNC (Virtual Network Computing) is a remote desktop technology that allows users to access and interact with a graphical desktop environment on a remote server.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">2. Why configure VNC Server to start at boot?<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Without an automatic startup configuration, the VNC server may need to be started manually after every server reboot. Configuring it at boot ensures that the VNC service starts automatically.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">3. Where should the VNC startup script be created?<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">In this example, the script is created at:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/root\/startvnc.sh<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">4. How do I make the script executable?<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Run:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">chmod +x \/root\/startvnc.sh<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">5. Where should the startup command be added?<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Add the following command to <code>\/etc\/rc.local<\/code>, above <code>exit 0<\/code>:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/root\/startvnc.sh<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Related Articles<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/pheonixsolutions.com\/blog\/disable-ping-icmp-replies-ubuntu-server-16-04-2-temporarily\/?utm_source=chatgpt.com\" target=\"_blank\" rel=\"noreferrer noopener\">Disable Ping (ICMP) Replies on Ubuntu Server 16.04.2 Temporarily<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/pheonixsolutions.com\/blog\/install-postgresql-ubuntu-16\/?utm_source=chatgpt.com\" target=\"_blank\" rel=\"noreferrer noopener\">Install PostgreSQL on Ubuntu 16<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Talk to our experts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Looking for the right technology solution for your business? Our team of experts can help you with development, cloud, DevOps, design, and a wide range of other technology needs. Get in touch with our team&nbsp;<a href=\"https:\/\/pheonixsolutions.com\/contact\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Virtual Network Computing (VNC) allows administrators to remotely access and manage a graphical desktop environment on a Linux server. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[390],"class_list":["post-2159","post","type-post","status-publish","format-standard","hentry","category-web-architecture","tag-vncserver","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-yP","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2159","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=2159"}],"version-history":[{"count":3,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2159\/revisions"}],"predecessor-version":[{"id":11796,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2159\/revisions\/11796"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=2159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=2159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=2159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}