以前寫過CentOS5 安裝vnc筆記
不知道為什麼會寫的"落落長"

這次來做個更新吧!

安裝VNC Server

# yum -y install vnc-server


修改vnc server設定檔,100這個值可以自訂,意思是說VNC Service啟動時的port(5900+100),5900可以用瀏覽器連http://IP:5900 (Fedora 不行)

# vim /etc/sysconfig/vncservers

VNCSERVERS="100:user1 101:user2" # 設定 user1 和 user2 的VNC
VNCSERVERARGS[100]="-geometry 1024x768" # 指定解析度

注意: 此範例中的user1,user2 必須是系統中的使用者帳號才能使用喔

使用 vncpasswd 設定vnc連線密碼,這邊要注意我們在上一步驟設定了VNCSERVERS="100:user1",所以我們要先su切換成 user1

 # su - user1
$ vncpasswd
Password: #輸入vnc連線的密碼
Verify: #再輸入一次


切換回root並啟動VNC Server

$ exit
# /etc/init.d/rc.d/vncserver start
正在啟動 VNC 伺服器: 100:user1
New 'test01.domain.com:100 (user1)' desktop is test01.domain.com:100

Starting applications specified in /home/user1/.vnc/xstartup
Log file is /home/user1/.vnc/test01.domain.com:100.log
[ 確定 ]
# chkconfig --level 35 vncserver on // 開機自動啟動

vnc1


這樣user1就可透過VNC Client(vnc viewer)使用port 6000(5900+100)連上VNC Server了;瀏覽器連5900。

 

如果你的作業系統是Fedora,到此就完成了。

CentOS 5必須在修改一個檔案,讓醜醜的X-windows變成美美的GNOME or KDE

#vi ~/.vnc/xstartup
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER #將此行 mark 拿掉
exec /etc/X11/xinit/xinitrc #將此行 mark 拿掉


修改後重新啟動VNC Server

# /etc/init.d/rc.d/vncserver restart
正在關閉 VNC 伺服器: 100:user1 [ 確定 ]
正在啟動 VNC 伺服器: 100:user1
New 'test01.domain.com:100 (user1)' desktop is test01.domain.com:100

Starting applications specified in /home/user1/.vnc/xstartup
Log file is /home/user1/.vnc/test01.domain.com:100.log
[ 確定 ]


大功告成!

arrow
arrow
    全站熱搜

    slv922 發表在 痞客邦 留言(0) 人氣()