Monday, December 2, 2013

How to Install & Configure VNC Server

Hello ... Friends Today we are going to install & Configure a VNC  Server. So we need to know what is VNC, VNC is Virtual Networking Computing it is a remote sharing system Graphically. if we talk more clearly then we can say by using VNC server we can resolve any problem in our system via Internet while not presenting there physically, we can see remote machine we can use remote keyboard & mouse.
We have more advantages of VNC server like we can use our Linux Machine by window machine.I think it will more clear when we work practically on it so let's start

Step 1: we need to install Desktop screen first of all if you are using your server in CLI mode then we need to install GUI mode & to do so we just need to use the command as # yum groupinstall "X Window System" "Desktop"  in my system i am using GUI already so i have no need to install it

Step 2: now we need to install TightVNC package , This is a package which provides us remote Desktop connection so logged in as root user & type the following commands

# yum -y install tigervnc-server xorg-x11-fonts-Type1



Step 3: after installing vnc completely next we need to create a user for vnc logged in here i am creating user Govind . & set password for this normal user if you want to set already user as a vncuser then we just need to logged in as user & set the vnc password for that user by command vncpasswd. let's see how to do that


So here we have a Que that we create password twice for a user, why ? the password we create first will be used for logged in via ssh while this password by command vncpasswd will be used for vnc screen logged in password. so it will create a .vnc directory in the home/Govind/.vnc , Let's test it now in my machine i have 2 local user with name nullport & Govind & we can see the directory for both user as


here we can see clearly that .vnc directory does't exist here for nullport user
Step 4: Now we need to stop the vnc service by just  # /etc/init.d/vncserver stop command
Now Let's set resolutions for view & for that we need to open file # vi /etc/sysconfig/vncservers 
& now we need to edit some commands in this config file

## Single User ##
VNCSERVERS="1:Govind"
VNCSERVERARGS[1]="-geometry 1280x1024"

this is only for single user as you know we create a user Govind for vnc server but as we want multiple users to access this vnc server we need to change as

## Multiple Users ##
VNCSERVERS="2:nullport 3:yash 4:Amit 5:Jitender 6:manish
VNCSERVERARGS[2]="-geometry 1280x1024"
VNCSERVERARGS[3]="-geometry 1280x1024"
VNCSERVERARGS[4]="-geometry 1280x1024"
VNCSERVERARGS[5]="-geometry 1280x1024"
VNCSERVERARGS[6]="-geometry 1280x1024"

as you know from this config file here this 1,2,3,4,5,6... etc all are the user IDs & next user names so,if we talk about general commands so VNCSERVERARGS[x]="-geometry 1280x1024"  here x is ID of the user

now start the vncserver again  # /etc/init.d/vncserver start  as we run this command then it create file with name xstartup in the /home/user/.vnc directory as here we can start this service again then it create some files


Step 5: Next we need to clear the path so that we can access it remotely so we need to open up the port which is used by the vnc server, hmm here i want to share about port vnc use port no.5901 for ID 1 & 5900 for ID 0 ( root user ID ) & for multiple vnc users as port no. increase with 5902,5903,5904,5905 etc. So now we need to open up port by simple commands

 #  iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT 

the upper commands open up port 5901 from the iptables, & bellow command is just only if we are using multiple users for vncservers.

 #  iptables -I INPUT  5 -m state --state NEW -m tcp -p tcp  -m --multiport --dports 5902:5904 -j ACCEPT 

Now save iptables by # service iptables save command as iptables saved then restart iptable services by command   # service iptable restart



Step 6: Next we need to logged in via vnc viewer from the remote machine so here i am using windows xp as my remote machine to connect with this vncserver So we need a vnc viewer for it

Download from here 

according to your machine


now logged in with address:1 & press connect button, Now it ask for password give the vncpasswd as we define during installation shown bellow


wow we get the remote machine using vnc server, as you get this then it again ask for password & this time it is the user password as i logged in as Govind then here i need to give password of Govind


so here is a short description about vnc server ... 

No comments:

Post a Comment