Thứ Năm, 21 tháng 7, 2011

config VNC (Virtual Networked Computing)

A. Config VNC trên server.
1. Check xem đã cài vnc & vnc server chưa.
[thamht@MHST11-08 sysconfig]$ rpm -qa | grep vnc
vnc-server-4.1.2-14.el5_6.6
gtk-vnc-python-0.3.8-3.el5
gtk-vnc-0.3.8-3.el5
vnc-4.1.2-14.el5_6.6
Nếu chưa có thì dùng yum để cài.

2. Thêm vào file /etc/sysconfig/vncservers như sau (cứ 2 lines set cho 1user)
VNCSERVERS="1:mhst1108"
VNCSERVERARGS[1]="-geometry 800x600"
VNCSERVERS="2:thamht"
VNCSERVERARGS[2]="-geometry 800x600"

Setting như trên tức là server sẽ lắng nghe user mhst1108 tại cổng 5901, user thamht tại cổng 5902 (tự động cộng thêm 5900).

3. Đặt passwd
[thamht@MHST11-08 sysconfig]$ vncpasswd
Password:
Verify:

4. Để có thể view bằng graphical desktop thay vì terminal, có thể làm như sau:
sudo vi /etc/.vnc/xstartup
- thay "twm &" thành "startkde &"
- uncomment 2 dòng dưới đây:
# Uncomment the following two lines for normal desktop:
#unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc
thành
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

6. Start vnc server
[thamht@MHST11-08 sysconfig]$ vncserver :2

B. Trên client computer
1. check xem đã cài vnc chưa
[thamht@thamht]$ rpm -qa | grep vnc
2. Start vnc viewer
[thamht@thamht]$ vncviewer 119.15.161.28:5902
Lúc này, cửa sổ yêu cầu nhập passwd hiện ra. Nhập passwd vào là xong.

C. Stop vncserver.
Có 2 cách:
[thamht@MHST11-08 sysconfig]$ vncserver -kill :2
Killing Xvnc process ID 3961
Hoặc
[thamht@MHST11-08 sysconfig]$ /sbin/service vncserver stop
Shutting down VNC server: 2:thamht [OK]

Để tắt trên client, chỉ cần đơn giản là Ctrl + C trên terminal hoặc tắt cửa sổ vncviewer.

1 nhận xét:

  1. [thamht@MHST11-08 .vnc]$ vncserver

    Warning: MHST11-08:1 is taken because of /tmp/.X11-unix/X1
    Remove this file if there is no X server MHST11-08:1

    -> Nếu báo lỗi như trên, chỉ cần remove file /tmp/.X11-unix/X1 la ok.
    [thamht@MHST11-08 .vnc]$ sudo rm /tmp/.X11-unix/X1

    Trả lờiXóa