centostricks

Just another WordPress.com site

VNC Server/Client


 

What is VNCserver?
VNC stands for Virtual Network Computing. It was originally developed by AT&T as a way to administer machines without using the console.

Why use VNCserver?
In Linux, everything can be done from a shell. However, there may be a time when you need to access the machine as if you were at the console.

Getting Started
You will need several things to get started:

• root privledges
• VNC client software (tightVNC)
• A good password!

As I mentioned above, this example is done with RHEL, which comes standard with VNCserver installed. To start the vncserver simply invoke the following commands:
[root@test etc]# service vncserver start
Starting VNC server: [ OK ]
[root@test etc]#
[root@test etc]# vncpasswd
Password:
Verify:
[root@test etc]# vncserver

New ‘test:1 (root)’ desktop is test:1

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/test:1.log

So what did we do there? First, we started the vncserver service. It may or may not have already been running on your system. Next we set a password to access the VNC desktop. When you set the password, you will not see any characters on the screen, and you must enter the password twice. You will only need to do this the very first time you run vncserver. The password will be saved in the Linux filesystem, and you can change it at any time by invoking the vncpasswd command again. Last, to activate the VNC desktop, we simply invoked the vncserver command.
Notice the output; the desktop is named “test:1” which can also be replaced via the machines IP address.
Connecting
Assuming you already installed VNC client, enter the desktop name:

# vncviewer test:1

You can replace the server name with an IP address if you are logging in from outside your LAN. Remember, if you are using nat port 5900 must be forwarded to your VNCserver.

Upon successful connection, you will be prompted for a password. You will then see a terminal screen that will allow you to execute commands

_________________________________________________________________________________________________________

VNCserver in Runlevel 5 (KDE or Gnome)

If you are new to linux, running VNC server with a terminal isn’t going to do you much good. You might want to have a menu-driven GUI like Windows. No problem. Follow these steps:

First, we are going to assume that VNCserver is running under the root user, as shown with the example above. For this example, I will be editing my VNCserver to enter Gnome. You can specify a KDE desktop if you have KDE installed on your server. Make sure you are in the root directory.

[root@test ~]# cd .vnc
[root@test .vnc]# ls
passwd         test:1.pid  test:2.pid  test:3.pid  test:4.pid  test:5.pid             test.area51.lan:1.pid test:1.log  test:2.log  test:3.log  test:4.log  test:5.log  test.area51.lan:1.log  test.area51.lan:2.log xstartup
[root@test .vnc]# vi xstartup

Using vi (vim) to edit the xstartup file, make sure your file matches this one:

#!/bin/sh

# Uncomment the following two lines for normal desktop:

unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
startx &

Notice that the last line is “startx &” as this command will launch Gnome upon login via VNCserver. If you are using a KDE desktop, the line “startkde &” should replace the last line.

Logging in, you will be presented with a Gnome or KDE desktop.

 

External Links :

http://bobpeers.com/linux/vnc

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: