• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

How to install and configure vncserver in Ubuntu

May 10, 2013 by Sharad Chhetri Leave a Comment

How to install and configure tightvncserver in Ubuntu

If you simply install vncserver in Ubuntu and do not edit xstartup file, on remotel vnc access it will not show desktop menu.
In this tutorial we will learn how to install and configure vncserver in Ubuntu and also get desktop menu on remote access.

The practical was done in Ubuntu 12.04 and 12.10.

Follow these steps:

(1) login with username in Ubuntu

(2) Install tightvncserver package

sudo apt-get install tightvncserver

(2) After installation run vncpasswd command to set the password of VNC server. And be careful it will ask you “Would you like to enter a view-only password”, here you have to type n

sharad@mypc:~$ vncpasswd
Using password file /home/sapplican/.vnc/passwd
Password:
Verify:
Would you like to enter a view-only password (y/n)? n
sharad@mypc:~$

(3) Now we will take the backup of xstartup file (taking backup is good practice).

sharad@mypc:~/.vnc$ cd ~/.vnc
sharad@mypc:~/.vnc$cp -p xstartup xstartup.orig
sharad@mypc:~/.vnc$> xstartup

(4) Now edit xstartup file and paste the given below code .(here,I am using vi editor)

sharad@mypc:~/.vnc$ vi xstartup

#!/bin/sh

# Change “GNOME” to “KDE” for a KDE desktop, or “” for a generic desktop
MODE=”GNOME”

#Uncommment this line if using Gnome and your keyboard mappings are incorrect.
#export XKL_XMODMAP_DISABLE=1

# Load X resources (if any)
if [ -e “$HOME/.Xresources” ]
then
xrdb “$HOME/.Xresources”
fi

# Try a GNOME session, or fall back to KDE
if [ “GNOME” = “$MODE” ]
then
if which gnome-session >/dev/null
then
gnome-session –session=ubuntu-2d &
else
MODE=”KDE”
fi
fi

# Try a KDE session, or fall back to generic
if [ “KDE” = “$MODE” ]
then
if which startkde >/dev/null
then
startkde &
else
MODE=””
fi
fi

# Run a generic session
if [ -z “$MODE” ]
then
xsetroot -solid “#DAB082”
x-terminal-emulator -geometry “80×24+10+10” -ls -title “$VNCDESKTOP Desktop” &
x-window-manager &
fi

Save and exit by pressing key , esc :wq enter

(4) Now run the vncserver by using following command

sharad@mypc:~/.vnc$ vncserver

New ‘X’ desktop is mypc:1

Creating default startup script /home/sharad/.vnc/xstartup
Starting applications specified in /home/sharad/.vnc/xstartup
Log file is /home/sharad/.vnc/mypc:1.log

sharad@mypc:~/.vnc$

Note : mypc:1 states that from remote access you have to use DISPLAY :1 and here mypc is my machine host name

Now from remote PC with the help of vnc client access the Ubuntu vnc server.

In Linux I use vncviewer.hence command is

vncviewer ipaddress-of-server:1

To kill the vncserver process

vncserver -kill :DISPLAY_Number
eg.

vncserver -kill :1

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. How to install and configure FTP server in Ubuntu 12.04 LTS
  2. How to install and configure Secure FTP server in Ubuntu 12.04 LTS
  3. How to install and configure FTP server with chroot in Ubuntu 12.04 LTS
  4. How to install and configure nagios nrpe client in Ubuntu with apt-get command
  5. Install and configure nagios core 4 on Ubuntu 12.04 LTS
  6. Install and configure elasticsearch cluster on Ubuntu 14.04 LTS
  7. How to configure self signed SSL certificate in owncloud Ubuntu
  8. How to configure static ip address through command line in Ubuntu
  9. How to configure multiple mysql instance in Ubuntu
  10. Configure ethernet to get IP address from DHCP in Ubuntu and Debian

Filed Under: Linux, Ubuntu Tagged With: vncserver

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

df command not showing correct free space in linux

How to convert float to integer number

How to use grep command to get fixed pattern or exact keyword

How to forcefully send mail from mailq in sendmail MTA

rsync all files,hidden files,symlinks,hardlinks to remotes Linux Server

send email after mysql backup through bash script in simple way

GNU Screen

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy