Search This Blog

Saturday, June 26, 2010

How to configure vncserver ?



Vncserver is just another application available in almost all the available Linux based distros. Configuring vncserver is very easy. But the default desktop view in vncviewer is gray scale desktop with very pathetic GUI. To view normal Gnome or KDE desktop in vncviewer, assigning a custom port for usage, user configuration and to adjust the resolution of the vncviewer window, some files need to be configured properly. Here are the required configuration in any version of Fedora/Fedora Core. But with minor modifications these can be applied to other distros like Ubuntu, SuSE, Gentoo etc.
Step 1: Installing Vncviewer, Vncserver
As root do this
[root@bordeaux saini]# yum install vnc [Enter]

Step 2: Configuring resolution, port & user

The default location of server configuration file for vncserver is '/etc/sysconfig/'. To configure the resolution, user and port open '/etc/sysconfig/vncservers' in you favorite editor and add two lines per user configuration shown ..
VNCSERVERS=":"
VNCSERVERARGS[<displayPort>]="-geometry x"
Example :
VNCSERVERS="3:saini"
VNCSERVERARGS[3]="-geometry 1000x700"

You can choose any display port, but it should not be in use by another X server. Window height and width can be anything (not in fraction of course). But keep in mind that the system on which you are going to view the desktop using vncviewer should have greater resolution than what you specify here, otherwise scrollbars will appear.
Step 3: Configuring Desktop Environment
The user specific configuration files of vncviewer resides in '.vnc' directory in user's home directory. (e.g. '/home/saini/.vnc/'). Open '.vnc/xstartup' in your favorite editor and edit as below
  • For Gnome
The 'xstartup' file shout look like this
#!/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" &
#twm &
startx &
  • For KDE
The 'xstartup' file should look like this

#!/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" &
#twm &
startkde &

Step 4: Configuring password
For setting up vncviewer password for user 'xyz', login as user 'xyz' and issue 'vncpasswd' command on a terminal/konsole (or whatever). Enter password twice and you are done with password setting.
Step 5: Starting Vncserver
To start vncserver, login as root and issue 'service vncserver start' command. If service started successfully, you are ready to use vncviewer on a remote/local machine.
Step 6: Accessing through Vncviewer
  • From Linux based machines
[saini@bordeaux saini]# vncviewer : [Enter] #(IP Address is for the machine where you set up vncserver)
  • From Windows
On windows there is a software called RealVnc. Install it and enter : in the dialog box.
[I explained how to connect via windows because it may help someone get a bit of relief.]
Screenshots:

  • Vncviewer with Gnome as Desktop environment
vncserver vncviewer Screenshot Gnome - kulbir saini, general bordeaux
  • Vncviewer with KDE as Desktop environment
vncserver vncviewer Screenshot KDE - kulbir saini, general bordeaux
Vnc is nice tool if you want to avoid using windows. I use it all the time. While I am forced to work on windows system, I install vncviewer and use it in full screen mode :P It also helps when you want to run some gui based application and monitor is remotely. Because if you close vncviewer window and use vncviewer again, you will be given the desktop session where you left it (all windows open and applications running).

1 comment:

  1. Bạn có biết, với blogspot của google bạn có thể làm mọi thứ bạn muốn! Blogspot với nhiều ưu điểm mà hầu hết các webmaster đều phải công nhận. Nó hoàn toàn miễn phí, lưu trữ ổn định lâu dài, tốc độ khá nhanh và truy cập được mọi nơi trên thế giới, bảo mật cao chống được các kỹ thuật hack mà không hosting nào có thể sánh bằng! Vì vậy blog của bạn tạo ra sẽ đc lưu trữ mãi mãi trên internet, không như các blog khác của vn, bảo trì mà không hẹn ngày hoàn thành phí biết bao nhiêu công sức của bạn.

    Vì vậy hãy giới thiệu với mọi người để cộng đồng blogger của vn ngày càng phát triển.

    Mới đầu dùng có thể bạn thấy giao diện của nó không đẹp, nhưng trên internet có rất nhiều template được chia sẻ, bạn chỉ cần copy nó bỏ vào Edit HTML, blog của bạn sẽ rất đẹp và chuyên nghiệp hơn.

    Bạn cũng có thể đổi tên tenban.blogspot.com thành tenban.com chỉ cần 180k/năm để mua tên miền.

    Có rất nhiều webmaster muốn biến blog này thành website lớn, bạn chỉ cần biết ngôn ngữ web, bạn có thể viết bất kỳ thứ gì bạn muốn trong nó.

    Đây là trang web của mình cũng dùng blogspot. Nghe Nhạc Pro - Phong Cách & Đẳng Cấp Chuyên Nghiệp, bạn cũng có thể tạo 1 trang giống như thế ở đây code nhạc .

    Mình thích dùng blog của google và muốn giới thiệu với các bạn. để có nhiều người Việt dùng hơn, mọi người sẽ hay vào blog của nhau hơn..

    Chúc blog của bạn ngày càng phát triển và hay hơn nữa!!

    ReplyDelete

leave your message if you need help ...

Related Posts with Thumbnails